smoketetsuo: (david tennent)

Surround Sound

There's one thing I want to talk about today and it's the state of 3D sound for games on Mac OS X… but first some background. Warning, this is fairly technical and you should know your way around a config file or in-game command line console although an increasing number of games don't need such "arcane" trickery. You might also want to make sure that if you are using surround sound speakers rather than headphones that your speakers are setup correctly such as in the example picture shown above. A relatively simple guide can be found here at Dolby's site. Subwoofer placement is more tricky and should be done via a "subwoofer crawl" rather than just placing it front center or tucking it in any old corner. There are also other resources on the web to help you with speaker placement if you need more in depth information.

It also goes without saying but if 2.1, also known as regular stereo is good enough for you then this article does not apply to you at all.

  1. Introduction

  2. Games With Support

  3. Looking Ahead

What is 3D Sound?
"3D Sound" here means that when you have a game loaded up the sound in the virtual world pans and fades to the correct speaker in your surround sound setup depending on the location of the sound in respect to the camera. So if you stood in front of a burning fire you would hear it in front of you.. as you turn around with 3D sound you can hear it pan around you much like it would if you where there live. This applies to most sounds in the virtual world. Without 3D Audio most of the panning only happens in the front speakers with a little bit of ambient sounds going to the rear.

Brief History
It seems to me that especially in the past most Macs have only come with basic software based stereo sound as the ubiquitous sound support it has. This has also been true in the PC world for quite some time too…. although in the past more people probably had dedicated sound cards on the PC and at one time a dedicated sound card such as the ones from Creative Labs known as Sound Blaster was required to have sound on at all on the PC. At one time all PCs came with some kind of dedicated sound hardware such as my first two PCs with sound cards had Ensoniq sound cards. Some of the best sound support on the PC to this day seems to come from PCs equipped with Creative Labs cards that have advanced driver support. But integrated and software based sound has been catching up.

Many have moved onto integrated sound cards which for most people are good enough even more so than integrated graphics. These chips can perform much of the duties typically usually performed by a dedicated sound card including multichannel surround sound. Even GPUs such as the ones from ATI and Nvidia have been including these kind of capabilities since they have HDMI output which outputs sound as well as video. Some of these chips even support hardware based Dolby Digital Live (AC3) encoding or the equivalent from DTS called DTS Connect. Some people and even companies don't take sound seriously and only use basic sound support so they don't notice if it has any further support available.

Does The Mac Platform Support It?
Many Mac games don't support 3D Audio but an increasing amount do… to varying degrees. Here I'll talk about some of the best and some of the worst and some of the things I did or tried to improve their support… there's one caveat… I know some of the errors I mentioned may be due to bugs in the sound API the game uses or the game itself more than anything… also many of the FMVs I know are most likely encoded in 2 channel sound so they are excused. Although I do notice that for example Feral has used quicktime videos in their ports so it should be possible for them to encode them from handbrake with AAC5.1 which would play multichannel in PCM mode. If I don't mention a game here either it doesn't support it or I don't yet have that game. You may ask me if I have tried a certain game and or request that I test a game especially if it's a free game. If you'd like to send me a free copy of a game for me to test and report my findings that would be fine too.

I've included some games that specifically support Dolby Pro Logic II rather than true discrete mode if they provide the same effect…. believe it or not it's possible.

How to Setup Your Hardware
Example From Audio MIDI Setup
Example Audio MIDI setup with Mini Displayport to HDMI adaptor

I'm currently using a Mini DisplayPort to HDMI adaptor hooked up to a surround sound receiver that has an HDMI port. That's what I'm using for the test results I report later in this entry I am using a Mini Display Port to HDMI adaptor hooked up to an Onkyo home theater receiver with 5.1 speakers. Of course this option is not possible if one has PC oriented sound systems with no HDMI port such as Logitech Surround Sound Speakers or Astro A4 surround sound headphones. I use an optical cable for AC3 or DTS passthrough or two channel audio because there's no utility for Prologic II+ decoding with the HDMI cable and it simply plays two channel audio 1:1 to the front left and right speakers. So I switch to the Optical Cable for movies and most games and videos and I switch to the HDMI cable for games that support the setup pictured above.

Games With Support

Feral Interactive
Many of Feral's latest games seem to support 3D sound although I don't know if it's on purpose or just a side effect of some of the newer sound libraries they have been using. Many of their games seem to have similar properties when played in 3D sound. I think I have pinned down the problem they tend to have which is at times sound that aren't spatialized to the in-game world meaning it is always the same volume no matter how far you are from the source doesn't get sent to the center channel as it should.. instead it gets sent to the front left and right speaker… with some exceptions.

Mafia II Works great for the most part out of the box…. some of the in-game voices come from the front left and right when they should be coming from the center however, most of the in-game sounds and even sounds from the in-game cut scenes.

Batman Arkham Asylum Pretty much the same as Mafia II except during the game over screens the voices there come from the front left and right rather than how they should be played.. from the center… for some characters like scarecrow it's acceptable but not for others like Harley Quinn and Joker.

LEGO Harry Potter Years 5-7 Virtually perfect.. all the sounds seem to come from the appropriate channel at all times whether the grunts and sighs in the in-game cut scenes or all the in-game sounds. Nothing special needs to be done here either. This was the first LEGO game I have noticed to have this kind of sound support and it's pretty amazing.

Bioshock 2 The original game was made prior to Feral starting to use their libraries that support it but 2 does support it. Seems to work well for the most part although I haven't finished retesting this game so I don't remember if the sounds always come from the correct channels.

One wrinkle here is Bioshock 2 has a specific Dolby Pro Logic II output mode which works in Transgaming's Cider but doesn't in Feral's version. It's entirely possible to encode 3D sound to a Dolby pro logic II compatible matrix so when decoded it sounds like you have 5.1+ dedicated channels. But it doesn't seem to function in Feral's version.

Deus Ex Human Revolution 3D sound is pretty good here except this is one game that tends to send onscreen dialog incorrectly to the front left and right speakers rather than the center channel where they should go.

Aspyr Media
None of Aspyr's more recent games such as Duke Nukem Forever, RAGE or Call of Duty Black Ops seem to support anything more than basic two channel audio even if they have logos in the title screens indicating otherwise (a common thing since the game is ported from other platforms). Some of their previous games do though such as:

Star Wars Jedi Knight II Jedi Outcast This is an older OpenAL title and in multichannel mode seems to treat all surround sound systems as if they are quadraphonic rather than 5.1+ which means it doesn't use the center channel speaker at all. Also, the panning\fading isn't as good as later games and sometimes puts dialog in the incorrect channel like from the rear when it should be from the front but it works. The only problem is there's a slowdown in the audio system which needs to be worked around by adding in s_restart into your autoexec.cfg so that after the game starts it immediately restarts the audio subsystem.

Star Wars The Force Unleashed Ironically enough even though this is a newer game it seems to have the same problem Jedi Knight II has with treating 5.1 as quadraphonic for the most part ignoring the center channel. This is despite it being a newer game with a totally new engine rather than the id tech 3 Jedi Knight II and Academy used.

Doom III Out of all their id tech 4 based games Doom III is the only one with functioning OpenAL and thusly the only id tech 4 game with functioning 3D sound. However, due to lack of graphic enhancement mod known as sikkmod and another reason which I'll talk about later I'm currently running this in WINE. The rest of the id tech 4 games of theirs have non-functioning OpenAL. It's not their fault though they don't even work with the Windows versions in WINE.  

Update: Prey from the Mac app store also works if one edits the prey plist file in your ~/library/preferences/ folder to load up OpenAL. However it's not outputting a center channel. I think there needs to be a version of OpenAL Soft compiled for Mac to work around this. I need to check to see if Quake 4 is the same.

Ubisoft Games
Currently the only two games I know of from Ubisoft that support it are the Assassin's Creed series. For the most part the sound works great in them with 3D audio and nothing special has to be done to enable it other than enabling it in audio MIDI setup. They sometimes play sounds in the wrong channels but for the most part they work.  I can't say how well Assassin's Creed Revelations works with it though because they haven't seen fit to release it on the Mac platform. I may give that a go in WINE some time (more on WINE below).

Games on Steam Including Those from Valve
None of Valve's source engine games currently support it and I'm not even sure OpenAL is enabled with them. I got the idea for using an HDMI cable from the Rob Barris developer who ported the source engine games to the Mac who previously worked at Blizzard he had written in support for it in WoW. Yet to this day support hasn't been enabled in any source engine game.

Serious Sam 3: BFE Supports it.. as long as you leave the sfx_iAPI variable as 3 for the Xaudio backend (a Windows API brought over from the Xbox) ironically enough…. switching it to 1 (OpenAL) disables it. However like with other games it underutilizes the center channel speaker.

Zen Bound Surpisingly enough Zen Bound supports it. There's no characters or in-game dialog so there's nothing to mess up here. Mostly the surround channels are used for background music and special effects.

Open Sourced Games
Open Sourced games have some of the best surround sound you can find on the Mac. Most of these games are ports of source code releases of id software's titles.

Quake 1 For Quake1 I strongly recommend Darkplaces even if you want your Quake experience to be vanilla. I load mine up with high res texture packs, real time lighting, remastered sounds and MP3 music however. Anyway, more to the point. This port supports both true discrete PCM sound channels or a Dolby Pro Logic II compatible version which gives pretty much the same effect. This is currently my benchmark\standard for sound as it's pretty much the best in my opinion. In this game I actually prefer the Dolby Pro Logic II mode because it decodes the music as well as doing positional audio for all the in-game sound effects. It is activated by the following cvar…

snd_spatialization_prologic "1"

Quake 3 Supported via the ioquake3 port and OpenAL. Haven't tested it in a while though as I'm not a big fan of Quake 3.

Doom My current two favorite source ports for Doom are the Doomsday Engine and GZDOOM. They both have true 3D sound mode and purport to also have Dolby Pro Logic II specific mode. The former works in both… the latter doesn't at the moment. I like the graphics in Doomsday better because of the fake radiosity, MSAA and other features like that but GZDOOM at least has FXAA and unlike the support Doomsday currently has decodes the music into surround sound. Doomsday only plays the sound 1:1 to the front left and right speakers currently.

So I mostly use Doomsday for Doom 1, 2, Heretic and Hexen and I use GZDOOM for total conversions such as fan made Rise of The Triad sequel Return of The Triad, Wolfenstein 3D TC,Action Doom & Urban Brawl, and commercial Doom clone Strife. The sound works mostly correct in them except for in Wolf3D TC where the door sounds aren't spatialized and one can hear them from the front at the same volume no matter how far or what direction one is facing from them.

An interesting thing about GZDOOM is going by the preferences it seems to use OS X's Core Audio directly rather than use a middleman such as OpenAL. Which I have heard is really just a wrapper for Core Audio on the Mac.

WINE based Gaming
I bet you are thinking… WINE? It doesn't have support for 3D sound does it? Traditionally you would be right. Historically speaking it didn't and the branch of WINE known as cider for the most part doesn't unless they have added it very recently and I have yet to get a game that has that support. But none of my current cider wrappers have it. But I digress. The WINE builds from WINEHQ have it now and it was enabled by their refactoring of the audio engine which was done around the 1.3 phase or so phase and then later on someone adding in a patch enabling it. Most of these games are either installed from legit Retail Box copies or from a service like Good Old Games.

Whether or not a game functions with it is another story and it falls down to the sound API the game originally used.. what DLL you use to enable it and the level of support the game has for it… the following games currently work with it with minimal to moderate configuration required:

Alan Wake & Alan Wake's American Nightmare Required no additional configuration on my part apart from what it took to install it into a wineskin wrapper. As far as I know this game uses XAudio… the Microsoft sound API brought over from the Xbox. So WINE wraps this API to whatever output your system uses such as Core Audio on the Mac. The sound in this game is mostly correct although the surround channels can sound pretty weak at times. Otherwise great sound and the in-game dialog always plays on the correct speaker channel… the wrinkle here is with the FMV cut scenes.. no sound plays in them generally speaking unless by sheer luck you catch it in a good mood and sound works both in-game and in the cut scenes but usually only one or the other works.. typically only the in-game sound works and not in the FMVs.

Alien vs Predator (2010) This game is currently very buggy on my system due to driver conflicts on my ATI GPU with WINE which are exposed by how demanding or unoptimized the game is in general. But more relevant to this entry the surround sound which is probably XAudio based works almost perfectly except for the in-game cut scenes which come from more channels than just the center when they should be just coming from the center. But some of that may be due to the buggy nature of how the game is running on my system more than anything.

FEAR3 Out of the entire FEAR trilogy currently only FEAR3 works with it for a few reasons. The previous FEAR games used an engine known as lithtech which has rendering bugs with the newer versions of WINE on my GPU at least. So I have to keep them on an older version of Crossover Games WINE engine specifically because even newer Crossover WINE engines exhibit the same bug where the weapons look like they are made out of transparent aluminum. Also, most of the previous games use Directsound3D which currently doesn't seem to have a proper wrapper to wrap its functions to the underlying 3D sound functions now exposed in WINE. FEAR3 uses a different engine by a different studio and newer sound API which is most likely Xaudio so it works… and for the most part the sound channels are correct except during the FMV cut scenes where sound only comes out of the left speaker.

Many other older games that used DirectSound3D could be enabled when we get proper DirectSound3D to underlying functionality wrapping going on in WINE or a good DirectSound to OpenAL Soft wrapper going on. Speaking of which…

Doom III regular, not BFG edition (I haven't tried that one yet) As with the state of 3D sound with Aspyr's native versions out of all the id tech 4 games I've tried only Doom III works with OpenAL and by extension 3D Audio. I bet you are like me if I where reading this would wonder.. why am I even bothering with WINE for these games when native ports exist? For the most part I myself am against that sort of thing especially since I like to support efforts for having games official to the Mac. However there are some tangible benefits to at least run Doom III in WINE.

Benefit 1 is being able to run the sikkmod which greatly enhances the graphics and even the gameplay some. Secondly one can use a third party OpenAL library with the game called OpenAL Soft which mostly fixes the 3D audio in the game. Without it much of the in-game dialog comes incorrectly from the front left and right but with it most of the in-game audio comes from the correct speaker depending on where you are facing. The only remaining problem is during the in-game cut scenes dialog comes from the surround speakers when it shouldn't and sound volume in the different channels could use some debugging for some scenes. In order to use OpenAL Soft with the Windows version of Doom III one needs to download
OpenAL Soft, extract the files from the .zip file.. copy over the oal_soft.dll to a folder in your path. Then go into your DoomConfig.cfg or Autoexec.cfg and add or modify the lines for example:

seta s_useEAXReverb "1"

seta s_useOpenAL"1"

seta s_libOpenAL "c:\Windows\system32\soft_oal.dll"

seta s_numberOfSpeakers "6"

For number of speakers you need to set it to 8 if you have 7.1. You also need an OpenAL32.dll file but you can just make a copy of the aformentioned dll and name it that and it'll work if it's not included in the wrapper already although replacing what's included with a copy of soft_oal.dll renamed doesn't hurt either. None of the other id tech 4 games allow one to specifiy an alternative OpenAL file so we are SOL when it comes to them no matter if they are the mac or pc version.

OpenAL Soft actually has written in Mac OS X support with Core Audio with their latest version but there only seems to be a precompiled binary for Windows on their web site right now. But if a Mac version could be compiled and used it could fix some problems some OpenAL based games have in OS X. I don't know if any porting studios currently use it.

It also supports DirectSound capture right now so it could be in theory used to enable 3D sound for older games in WINE. I don't know how to use this functionality at the moment though.

While I'm on the subject of OpenAL there's been some talk about creating a patch for OpenAL that would allow one to turn on a downmixing option to enable 3D sound via prologic II+ if only two channels are available. I don't know if anything has come of it though.

On the subject of id tech 4, Wolfenstein from Raven Software released in 2009 supposed to have support but it doesn't work. There's no telling what API they are using. They seem to be using miles sound system rather than what Doom III used. When the sound output in the game is set to 2.1 there are some tactical sound sent to the rear channel and some sounds like gun fire behind you or certain sounds in the environment are spatialized but not everything.

Unreal Gold Out of all the Unreal Engine 1 based games I have tried only Unreal Gold currently has a patch to enable 3D audio via OpenAL. The only problem is it too doesn't seem to use the center channel properly and I tried installing OpenAL Soft with it but it didn't seem to work. In order to get this working one needs to install the latest unofiicial Unreal Gold patch from Old Unreal and choose the OpenAL API for sound output. 

Update: I also fixed the under-utilization of the center channel speaker here by installing OpenAL soft as the OpenAL32.dll and setting a DLL override for it in WINE. In-game dialog on return to Nali Pali expansion come from the surround speakers though.

Painkiller Engine Games Such as well.. Painkiller and NecroVision None of these games currently work with discrete 3D sound especially since they are all DirectSound3D based or use a now older version of Miles Sound System. However this version supports a Dolby Sound provider and allows you to choose it via the in-game menus. Newer games that use the Miles Sound System lack this option sadly enough. This provides varying degrees of 3D sound depending on age of the game and age of the Miles Sound System included. The older games such as the original Painkiller have it mostly working but it was written before Dolby Pro Logic II was invented so it encodes sound for the front left, center, front right, rear left, and both rear left and right together but seems to not encode a channel for rear right. So if a sound comes from your left rear side or extreme left it comes from the left as it should.. but not from the right…. it's incomplete when it comes to the newer udio doesn't work..

NecroVision from Aspyr (oddly enough they never ported it to the Mac) doesn't suffer this but the game is crashy beyond a certain point and up until recent was rated garbage at WINEHQ meaning it used to not work at all so that game still needs work in general to be fully playable without crashing.

Star Trek Elite Force II Uses a Miles Sound System engine similar to Painkiller and while again it does not support true discrete 3D sound it sports a Dolby sound provider which.. with the revision of miles it's saddled with does pro logic 1 encoding so it doesn't provide a rear right channel… only rear left and both rear speakers together.

Jedi Academy An older OpenAL title and works pretty much the same as Aspyr's ports…. ignoring the center channel speaker and all. 3D sound only works here if you enable EAX in the in-game audio settings.

Serious Sam HD Uses the same "Serious Engine 3" as Serious Sam 3: BFE and has pretty much the same compatibility profile as the native version of that game when it comes to 3D sound. The OpenAL support is buggy and the music cuts off after a few minutes. in Serious Sam 3 that doesn't happen with OpenAL but 3D audio doesn't work. Xaudio works but underultilizes the center channel speaker with this game in either SSHD or SS3BFE native or wrapped. 

Update: I've partially fixed this by setting the audio output to OpenAL, installing OpenAL Soft and then setting a DLL override in WINE to load up a renamed soft_oal.dll to OpenAL32.dll instead of the builtin OpenAL WINE provides. The music still cuts out sometimes though.

XLENGINE running Dark Forces 1 Another game that has 3D audio support but treats my 5.1 as if it's quadraphonic instead. I don't know what the xlengine is using for its sound API and its web site doesn't shed any light on the subject. I tried fixing this with OpenAL Soft but XLENGINE crashes if I set a DLL override to it with WINE.

Others If I could run Unreal Engine 3 games via Wineskin rather than Cider I could get 3D sound working with them too. The downside is they all currently have bugs with the AMD\ATI drivers which force me to have to run them in Cider which again as far as I can tell does not yet have the 3D sound patch WINE now has. As soon as I get a system with an Nvidia card though they should be doable at least with OpenAL Soft since they tend to use OpenAL or Xaudio which then I would not need OpenAL Soft.

Looking Ahead

As I said earlier more and more games on the Mac are supporting 3D sound every day even via WINE. The missing piece of the puzzle is a real time AC3 or DTS encoder or downmix to Dolby Pro Logic II utility so that people who only have access to an optical cable or headphone jack cable can get 3D sound from games such as the ones from Feral as well. Considering how some games ignore the center channel speaker in true discrete mode the latter actually would be more ideal for those games. Many people don't believe one can get positional audio from Dolby Pro Logic II due to experience with standard stereo being run through it. But most of those games don't apply the proper processing and enocding to the sound output to take advantage of it. Games like Darkplaces with its prologic specific mode have proven it.

Unfortunately there seems to be little interest in making even just a real time AC3 encoder that works in OS X.
JackOSX has a helper app called AC3Jack that can take the multichannel output from any application and encode it to AC3 in real-tlme with a 5% CPU utilization on a typical Intel Core i5 CPU. However, due to the changes in the way Mac OS X works it currently does not seem to work in Lion or Mountain Lion. The last update to AC3Jack seems to have been in 2009. JackOSX for Mountain Lion is in beta testing right now but after setting it up and trying AC3Jack I can get all the way up to the part where I enable AC3 Output and switch the output to the Optical Cable. At that point JackOSX complains that another application has changed its settings and shuts down. Also it's a pretty involved process involving setting up two applications, figuring out which output channel from the game goes with which speaker and assigning those channels via AC3Jack every time you run a game. It's not exactly a plug and play setup.

Plex has a real time AC3 encoder built in for the purpose of transcoding Apple's AAC 5.1+ channel audio tracks to AC3. Those tracks are played much like the unencoded PCM sound that games output. The encoder in Plex takes that unencoded output and encodes it in real time to AC3. The developer who programmed that expressed an interest in making that function into a plugin or software that could be used system wide. However, since then it seems interest has waned especially after he got a job which ate up his free time. In theory also a similar function could be programmed into games as what Plex has but from what I have gathered via e-mail there's little interest in pursuing this. Both from the author of the Plex function because he's too busy mostly or I got no response from companies like Feral. The author of the function in Plex has told me that the code is simple and freely available if they wanted to use it though.

As of right now the only place a user friendly working real time surround sound encoder for Mac games exists is in my imagination. A hypothetical utility would have a preference pane that installs into system preferences and does the following:

  • Inclusion list: Any application that gets put into this list gets presented with a virtual up to 7.1 channels.
  • Per Game Preference Sheet : When you double click on any game in the inclusion list a sheet drops down. The options here would be number of virtual channels, layout, what to output the sound to AC3, DTS or downmix to Dolby Pro Logic II and optionally apply 3 channel logic to the front channels for when you run a game in AC3\DTS but it ignores the center channel so it can decode a center channel from the front stereo pair and add it to the center. That last thing would be a checkbox when AC3\DTS is chosen as output. This might even be good for those games that incorrectly put some of the audio meant for the center channel speaker equally between front left and right. It would extract that sound from those channels by monitoring what sounds are totally equal in front left or right and and redirect it to the center along with the other sounds that already go there.
  • Include OpenAL Soft for those games that need it.

I would also like such a utility because while using my HDMI cable works it'd be nice to not have to switch to it every timeI want to play a supported game and then back after I'm done. Also having a surround sound receiver with HDMI hooked up makes OS X think I have a second monitor hooked up so I have a phantom second screen and that can cause problems particularly with wineskin which has some bugs with multi-monitor systems. Native ports disable the second screen but wineskin doesn't seem to yet so the mouse can escape the screen to the second monitor and mess up mouse input.


smoketetsuo: (Default)

October 2012

 1234 56
21 222324252627

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jul. 28th, 2017 10:45 am
Powered by Dreamwidth Studios