Search Unity

7.1 & 5.1 surround sound

Discussion in 'Audio & Video' started by droderick, Nov 24, 2014.

  1. droderick

    droderick

    Joined:
    Aug 25, 2008
    Posts:
    169
    Hello,
    Wondering if anyone has had any luck building with 7.1 or 5.1 surround sound. We have been working on this and haven't had any luck. We did file a bug (650039) as the editor was telling us stereo was enabled even though 5.1 was config'd in windows sound settings. anyone else have success with surround and standalone (pc) builds?
    thanks
    d
     
    andrewlackey likes this.
  2. wkaj

    wkaj

    Unity Technologies

    Joined:
    May 18, 2012
    Posts:
    50
    Does your machine have more than one soundcard? Unity will use the default output device, and if it is the 5.1/7.1 device, you should have Unity use that.

    Currently you cannot configure Unity to a different channel count than the output device.
     
  3. simonmc

    simonmc

    Joined:
    Oct 26, 2011
    Posts:
    5
    Hi wkaj,

    Even with the default output device set up correctly, AudioSettings.driverCaps will only return Stereo.

    This is in both editor and standalone on windows 7 in unity 4.5.5

    I have attached an image showing my audio setup where you can see the default device is correct and 5.1. Clicking on the speakers in the config display plays sounds out of each individual speaker correctly.

    We are also seeing this exact same behaviour on a different machine trying to use 7.1 over S/PDIF.

    Simon
     

    Attached Files:

    andrewlackey and droderick like this.
  4. droderick

    droderick

    Joined:
    Aug 25, 2008
    Posts:
    169
    Does this mean one couldn't make an app with different possible sound configurations?

    also - is the audio coming out of unity a digital or analog signal? we are evenutally feeding audio from our PC into a receiver. Is this even possible at the moment?

    thanks,d
     
  5. droderick

    droderick

    Joined:
    Aug 25, 2008
    Posts:
    169
    Wkaj - have a sec to answer my questions? many thanks,
     
    andrewlackey likes this.
  6. ZO5KmUG6R

    ZO5KmUG6R

    Joined:
    Jul 15, 2010
    Posts:
    490
    Same issue happens in Unity 4.6
     
    andrewlackey and droderick like this.
  7. droderick

    droderick

    Joined:
    Aug 25, 2008
    Posts:
    169
    Does this mean that it isn't possible to distribute an app that has different sound configurations without having separate builds for each sound configuration?

    For our purposes - we are going to try to install unity pro on the target machine & make a build. Will update with the results.
     
    andrewlackey likes this.
  8. gregzo

    gregzo

    Joined:
    Dec 17, 2011
    Posts:
    795
    I've recently had to correct bugs in G-Audio for multi-channel setups. So it's definitely possible for Unity to output, in the editor as well as in builds, more than 2 channels.
     
    andrewlackey likes this.
  9. gregzo

    gregzo

    Joined:
    Dec 17, 2011
    Posts:
    795
    Might need to set audio speaker mode in settings, it won't happen automatically...
     
    andrewlackey likes this.
  10. droderick

    droderick

    Joined:
    Aug 25, 2008
    Posts:
    169
    gregzo,
    Are you talking about setting audio speaker mode settings inside unity? (edit/project settings/audio). We have done this already to no avail.
    many thanks,
    d
     
    andrewlackey likes this.
  11. gregzo

    gregzo

    Joined:
    Dec 17, 2011
    Posts:
    795
    Hi droderick,

    Unfortunately I can't test as I don't have a multichannel setup at the moment.
    What I can tell you is that one of my users had a bug with my framework G-Audio and his quad setup. After fixing it, he was able to monitor all for channels in the editor.

    Someone else in the thread enquired about having to make separate builds for different setups: of course this is not the case.
     
    andrewlackey likes this.
  12. simonmc

    simonmc

    Joined:
    Oct 26, 2011
    Posts:
    5
    How recently and what platform? As noted we are on 4.5.5 on windows 7.
    aaro4130 above is reporting the same issue on 4.6.

    We are definitely seeing unexpected behaviour here:

    AudioSettings.driverCaps returns Stereo on a correctly configured 5.1 setup.
    OnAudioFilterRead messages always have channels as 2.

    AudioSettings.driverCaps is independent from AudioSettings.speakerMode (and have tried a bunch of different settings anyway)

    If you did, you would be seeing the same issue.

    Using an FMOD Studio native plugin detects all the channels correctly, so this is not an issue with the sound drivers or configuration either.
     
    andrewlackey and droderick like this.
  13. gregzo

    gregzo

    Joined:
    Dec 17, 2011
    Posts:
    795
    Hi @simonmc

    I did not want to imply that your problem isn't real, simply that some users seem to have had success with their setup ( in Unity 4.5 ).

    I hope your bug reports will help in getting this issue solved quickly.

    Cheers,

    Gregzo
     
    andrewlackey likes this.
  14. droderick

    droderick

    Joined:
    Aug 25, 2008
    Posts:
    169
    What's odd - is that Unity stopped contributing to this post. Maybe they view it as a feature that is unsupported (and not a bug?).
     
    andrewlackey likes this.
  15. gregzo

    gregzo

    Joined:
    Dec 17, 2011
    Posts:
    795
    Doesn't mean much. @wkaj is one of the 2 audio devs working at Unity - I'd say he's just very busy with Unity5's imminent release.
     
    andrewlackey likes this.
  16. ThaBukkow

    ThaBukkow

    Joined:
    Aug 26, 2013
    Posts:
    1
    Hi all, we are also working on a 5.1 setup, Win7, standalone.
    It just comes out of Unity in stereo even though everything in Windows is tested and OK 5.1.

    We had already promised our client 5.1, so what we would like to know: is this definitely not going to work? And will it work in Unity5?

    best regards
    Wouter
    YiPP
     
    andrewlackey likes this.
  17. andrewlackey

    andrewlackey

    Joined:
    Sep 1, 2014
    Posts:
    1
    What we've found is that Unity 4.3 Editor, Unity 5 Editor beta versions and Unity 5 beta builds are selective about which hardware drivers it will send 5.1 to. We've tested 6 surround configurations on PCs and Xbox1 and have 3 instances of of surround 5.1 working. All other things being the same except driver/hardware selections in Control Panels...it seems that motherboard hosted audio outputs work and third party hardware and drivers don't. Drivers/Hardware for RME, Focusrite and an HTC Claro sound card to not work. Analog outs on MSI and Asus motherboards do...as well as Xbox One. It should be noted that on the systems that didn't pass 5.1....all of them passed 5.1 for other applications with no special configurations. Windows, Steam, other game engines in development, audio applications....none of them had issues with surround. We have elevated the issue to Unity through various communications, but I'm looking create momentum to fix this where I can. We'd love to see a resolution this very very soon...b/c we're very close to shipping:)
     
    droderick likes this.
  18. droderick

    droderick

    Joined:
    Aug 25, 2008
    Posts:
    169
    andrew,
    fwiw, we put a new soundblaster card in our machine and have things working correctly now. turns out, our issue at least was related to the card & sound system we had. We're building an app for ONE machine so 'our' problem is sorted, but yes, there do appear to be oddities & a lack of documentation around how sound other than stereo works in unity.
    best of luck,
    d
     
  19. jsmallwood

    jsmallwood

    Joined:
    Jan 23, 2015
    Posts:
    1
    Was having trouble getting Surround Sound to work. Was using the onboard optical and coax out with no luck.
    Switched to using NVIDIA audio through display port on video card and voila!
     
  20. Andrew-Benz

    Andrew-Benz

    Joined:
    Jan 7, 2015
    Posts:
    13
    Hey everyone,

    I've been testing various surround settings (My team and I are on 4.5.5) and I can confirm that setting your speaker mode through Project Settings -> AudioManger is buggy and very unreliable!

    My advice, don't use it!! Hard code your speaker settings instead, I haven't had any issues with it yet.

    Attached is a GameObject prefab called AudioEngine which exposes various audio hardware settings in the inspector such as sample rate, buffer size, and speaker output. There is a check box for force surround, if set to true it will set speaker output to 5.1. You can pop into the script and change it very easily to 7.1 or whatever settings you want. Currently it defaults to your driver's capabilities.

    Keep in mind, this script resets Unity's audio system, so initialize this in a startup scene for your builds.

    Hopefully this will help some of you guys.

    Cheers!

    -Andrew
     

    Attached Files:

  21. hoy_smallfry

    hoy_smallfry

    Joined:
    Jan 11, 2013
    Posts:
    5
    I see a prefab in the zip @Andrew Benz , but there is no script attached to it. Did you forget to add it as part of the package?
     
  22. Andrew-Benz

    Andrew-Benz

    Joined:
    Jan 7, 2015
    Posts:
    13
    @jbarba_ballytech
    Derp, sorry about that. I forgot to include the script in the package, I just exported out the prefab.

    Here's an updated one!
     

    Attached Files:

  23. ratking

    ratking

    Joined:
    Feb 24, 2010
    Posts:
    350
    Heya Andrew,

    in your script you set "audioSpeakerMode" to "mySpeakerMode" - but "audioSpeakerMode" isn't used anywhere. Does the script actually work?
     
  24. Andrew-Benz

    Andrew-Benz

    Joined:
    Jan 7, 2015
    Posts:
    13
    @ratking

    Yep, the script works.
    audioSpeakerMode is used in two places right in my Init() function. The Init() function is then called in Awake().

    if (ForceDriverDefaults == true) {
    audioSpeakerMode = AudioSettings.driverCaps; //Set speaker setup based on your computers capabilities. E.g stereo for most peoples.
    }
    else if (ForceDriverDefaults == false) {
    audioSpeakerMode = mySpeakerMode; //Speaker mode set to whatever you choose in the inspector.
    }

    Have you actually tested it in a scene? When you startup the scene and you have the print audio settings check box checked, it will print your speaker mode setting to the console. You can further test this by changing the MySpeakerMode settings from the inspector.
     
  25. hoy_smallfry

    hoy_smallfry

    Joined:
    Jan 11, 2013
    Posts:
    5
    @Andrew Benz

    I think @ratking is referring to the fact that "audioSpeakerMode" is assigned to but the only time you are assigning from is when you are logging. It is not actually affecting any UnityEngine.AudioSettings data.
     
  26. Andrew-Benz

    Andrew-Benz

    Joined:
    Jan 7, 2015
    Posts:
    13
    Crap, I feel like a huge idiot now. Totally see what I'm messing up. This is why I don't share code. Looking like an idiot..
     
  27. hoy_smallfry

    hoy_smallfry

    Joined:
    Jan 11, 2013
    Posts:
    5
    Worry not @Andrew Benz. I made some changes to what you created, Gimme a moment and I'll post them shortly
     
  28. hoy_smallfry

    hoy_smallfry

    Joined:
    Jan 11, 2013
    Posts:
    5
    I removed the bulk of the functionality away from the MonoBehaviour into a separate class. This also allowed me to make it so that you can save this as an asset, so that you could essentially hot-swap audio settings if you have that enabled. To enable it you just need to comment out to #define in AudioSettingsEx.cs and AudioSettingsExInspector.cs. If it is enabled, creating an asset should be as simple as creating any other type of asset in Unity: In Project view, pull up the context menu and choose "Create -> AudioSettings" and assign it to the prefab.
     

    Attached Files:

  29. theotherstudio13

    theotherstudio13

    Joined:
    Oct 8, 2009
    Posts:
    46
    I'm looking to include support for surround sound in an upcoming project. At this time we don't know if console will be supported but it's looking like that's going to happen.

    Previously (like from 2008-2011) I've used FMOD Designer and other game engine audio tools to get surround sound setup to playback. I haven't had to do that in Unity yet. I assume in Unity it's still the underlying FMOD Ex api that is handling the audio and supporting all the platforms.

    @andrewlackey are you able to share any of your experience re: down mix from 5.1 where the game is setup to output surround but the console or computer is setup to output stereo. Previously using FMOD on PS3 titles when the players chose stereo speakers the surround mix was simply down mixed .. its been so long I can't remember if this would happen in FMOD ex or on the console it's self.
     
    Last edited: Jul 4, 2015
  30. theotherstudio13

    theotherstudio13

    Joined:
    Oct 8, 2009
    Posts:
    46
    Here's some call notes copied from an email between myself and Gino at FMOD back in 2010 re: surround and down mixing .. I'm not sure how much of this is supported in Unity

    Q: What conditions are required for FMOD to downmix ?

    A : On the PC FMOD checks windows output speaker mode, if stereo then FMOD throws out all the Front/Rear panning info created at the layer level.

    On the PS3 and X360 FMOD doesn't down-mix it always outputs 5.1 for X360 and 7.1 for PS3. The consoles have their own down-mix math and routines that are not exposed to FMOD.
    Hope this help to clarify my original question