Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
4
Question by TalkingDog · Sep 18, 2015 at 12:31 PM · audiosoundsurround

Playing 5.1 surround audio

I have looked around and found some old questions related to this but nothing concretely answered and nothing for unity 5.

I am working on a project where we need control over a specific speaker output. To play sounds out of specific speakers we made a 6 channel wav file. The problem is no matter what I do, unity will consolidate the audio down to 2 channels.

alt text This is the wav file, it just plays snippets on each channel independently. I have changed the format to PCM so that it doesnt mess with the format too much (you can see 100% ratio in the above image)

The audio source's Spatial Blend is set to 2D.

Edit > Project Settings > Audio, Default Speaker Mode is set to Surround 5.1

If I output the audio source to a mixer I can see that it correctly has 6 levels, however, the 4 on the right never show activity. In the image below you can see that the channels are separate since only 1 channel has activity at a time (except center and sub channels, which activate both) alt text

 Debug.Log(AudioSettings.speakerMode);
 Debug.Log (AudioSettings.GetConfiguration ().speakerMode);

Both of these methods return "Mode5point1"

The only thing that I have found as a lead is that Debug.Log(AudioSettings.driverCapabilities);returns "stereo". This confuses me since the system is obviously willing and able to play surround sound. I have tested the wav file in other applications and it plays each channel out of a separate speaker.

I have also tried reseting the speaker mode during runtime:

 AudioConfiguration config = AudioSettings.GetConfiguration ();
 AudioSettings.Reset (config);

If I do this I get no sound output.

Any help or discussion on this would be very appreciated. Thank you so much.

Side note: This project is intended to be published to a select few PCs so I dont need to worry about making it compatible with different sound systems or setups. We will be in control of the computers it will be installed on.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by TalkingDog · Feb 26, 2016 at 11:20 PM

Turns out this is not really a unity issue but an XAudio2 issue.

XAudio2 is an audio engine used in xbox 360 and some windows installs. There seems to be an incompatibility with xaudio and AC3/Dolby Digital audio output where it will erroneously report stereo configuration, so when Unity asks XAudio what the system is capable of it returns "stereo". This issue affects game engines and many games; anything that would tie into the XAudio API. I was able to find some hacky workaround that involves replacing DLL files in your system directory. For example this was intended to help with the witcher 3 but it works for my purposes.

http://forums.cdprojektred.com/threads/37740-Fix-Force-Surround-Audio-(if-your-W3-stuck-in-Stereo-this-makes-it-surround)

This is obviously not ideal and I can't guarantee the safety of downloading these DLLs but it does fix the issue. A better option would be if microsoft provided an update. If anyone has more info on this issue or a better option that would be great.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by vertexxx · Mar 02, 2017 at 09:48 AM

I have the same issues here with a Realtek sound card.

Try to set new speaker mode at runtime

In the audio settings, I've set the default speaker mode to Quad. Also set the speaker mode at runtime

 void Awake() {
     Debug.Log ("Caps: " + AudioSettings.driverCapabilities);
     Debug.Log ("Speaker mode: " + AudioSettings.speakerMode);

     AudioConfiguration conf = AudioSettings.GetConfiguration ();
     conf.speakerMode = AudioSpeakerMode.Quad;
     AudioSettings.Reset (conf);
 }

but it doesn't help.

Use the XAudio DLL patch

The link you've posted about patching the XAudio2 DLL doesn't work here on Windows 10. The ZIP file contains only patches for XAudio2_0.dll, XAudio2_1.dll, ..., XAudio2_7.dll but on my system there are only XAudio2_8.dll and XAudio2_9.dll.

Try to patch XAudio2_8.dll and XAudio2_9.dll with a Hexeditor

Found this post http://xboxforums.create.msdn.com/forums/t/22533.aspx about patching the DLL.

Changing xaudio2 DLL files works fine to fix realtek dolby digital live. just hex edit the dll files replace 4D069FF12C08274EBC736882A1BB8E4C00000000 with 260E87E4C53CD24CBA46CA0A9A70ED0400000000

Unfortunately I doesn't found this hex string in the DLL files, using wxHexEditor.

Use FMOD instead

I know, this is not the best solution, but it works. By default, FMOD also use stereo sound on this system, but you can force FMOD to use 5.1 sound. In the menu go to FMOD > Edit Settings. Change the Speaker Mode of Play in Editor Settings and Default Settings to 5.1. The disadvantages with this solution are obviously a third party library, managing an additional project (the FMOD Studio project), licensing etc.

Hope anybody find a fix that works with Unity's native sound engine.

Edit: The FMOD solution works only on my laptop but not for the PC with a on board sound card with a Realtek ALC892.

Additional Test with a new sound card

I've test it with a new sound card, a Creative Sound Blaster Z1500 and it works with FMOD and also with Unity's native sound engine. You have to turn DTS on (Cinema settings in the Control Panel), make loudspeakers as the default audio endpoint (in Windows). FMOD can play stereo WAV files from 3d positions. When I downmix the WAV from stereo to mono, it works with Unity's native sound engine too. Default Speaker mode is set to Surround 5.1, AudioSource Spatial Blend is set to 1 (=3D) and Spread is set to 360.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Changing Audio Playback Devices for Unity 2 Answers

play sound when moving stop sound when not 1 Answer

Why is my backtrack's volume getting lower? 0 Answers

3D Sound Max Distance Not Working. 0 Answers

Playing sound file from resources 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges