Sound quality on Windows builds

Has anyone else noticed that the sound quality on Windows builds is considerably degraded from its Mac OS X build counter-part? Also the headroom/mixing of the audio signals is not being handled as well, it’s a lot easier to go above 0 db and clip the digital audio stream on Windows. It basically sounds like the audio is being mixed at below 44.1khz, but it doesn’t sound like a lower bit depth on the audio stream. I’m just judging by experience/using my ears.

Either something is degrading the precision of the audio file data (most likely frequency because that’s what it sounds like) during a build to Windows, or perhaps whatever sound init methods are being called (DirectX, FMOD, whatever Unity is using for audio on Windows) are being done so at some lower mixing frequency. It honestly sounds like it’s mixing at around 32khz or something like that instead.

I’ve noticed this on last several versions of Unity when making Windows builds. Currently I noticed this when using 44.1khz 16bit WAV files (uncompressed). I’ve experienced this on multiple Windows machines (On every Windows machine I’ve run Unity on).

Unity team if you can, would you try to fix the audio mixing issues on Windows, and create a little more headroom by lowering the default volume the audio channels are mixed at? Thanks!

Its not something that has shown up in our testing so far. In any case, file a bug report with information about the specific windows machine you are using and simple project folder witha single sound file in it where you can clearly hear the difference.

I reported issues with Windows only players (report # 23792). The problem I experienced then (and continue to experience on Windows builds with 2.1) is a loud repetitive “crackle”. This report was closed by UT without comment so I don’t know why it was closed or if it has been resolved in a future update.

Can you get us a recording of this? (If you’re using a Mac, with Parallels or Fusion, you could use Soundflower, but I have no idea what to use to do this on Windows).

I have a sample of what bigkahuna in talking about in the thread he made:

http://forum.unity3d.com/viewtopic.php?t=11495&highlight=audio+clicking

I don’t agree that Unity should be lowering the volume of all sound, though (“increasing headroom”). Maybe if they gave us a setting to have that happen by default, but it could be overridden, I would be okay with that. But I don’t want to go through a bunch of mastering work, in an effort to compete in the loudness wars, only to have that work undone automatically.

Sure I will try to make a recording of the same audio running in both the Universal Binary build and the Windows build later tonight.

For the type of machine running Windows, as far as I know whenever I’ve actually paid attention to the audio quality on Windows builds I’ve always heard this on any Windows machines I’ve used, which most recently has been 2 different desktops (one p4 with an intel chipset mobo running XP, and a Mac Pro running Vista with bootcamp), and a handful of laptops (running XP).

I agree there shouldn’t have to be any mastering work involved, nor should the volume be dramatically lower in Windows. I’m primarily asking/mentioning this because sounds that I have in Unity games that sound fine on the Mac side of things are distorting by default on Windows, which is indicative of few things, one of which the audio is being mixed at a global level that is too high. But even an option as stated would be nice.

Unfortunately in a digital sound signal to increase signal headroom (so you can mix more signals simultaneously without causing digital distortion) you really only have two real options: increase bit depth, or mix all audio channels at a reduced global volume.

At any rate I will try to make several recordings of various material later tonight when I get home which should shed some light on the situation and allow you guys to hear what I’m hearing.

Ok I made a pair of quick recordings of the same Unity material for both builds. This really shows off the distorting on Windows, but you should also be able to hear the quality degradation. I will try to record a series of single sounds later, as the quality degradation is more obvious.

If you’re having trouble hearing the different, it’s probably easiest with a nice pair of headphones that have a good frequency response.

103077–3960–$unitypc_soundtest1_377.zip (1.3 MB)
103077–3961–$unityub_soundtest1_292.zip (1.28 MB)

It doesn’t matter how many bits you use in the mixing process; it’s all going to have to be output at 16 or 24 bits. Headroom in the mixing phase is only useful if you can do processing on the master output, such as compressing and limiting, to tame the signal back down. So if Unity is able to mix in 32-bit float, say, then a limiter on the master output should take care of the problem. If not, though, mixing everything at a lower volume is indeed the only option.

It does matter how many bits you use in the mixing process if you don’t automatically scale your original signals proportionally to the new bit depth. For example I can mix a lot more 16 bit signals together in a 32 bit mixing space if I don’t scale each signal’s values x 2. But ultimately you’re right this essentially has the effect of just reducing the global volume by 1/2 by the time the bit precision is dropped back down to say a 16 bit signal path again for output.

And yes a digital limiter would help to some degree (prevent clipping, but not necessarily fix limiting artifacts of a strongly clipped signal), but I kind of considered the fact that Unity would not really be interested in adding DSP algorithms audio library implementation and that straight additive mixing was what we’re going to be dealing with.

Now I don’t know as much about the audio on the Mac OS X side of things. Is it possible there is a digital limiter in place at more of a system audio level (by default) that is causing the minimizing of the distortion effect on Mac OS X?

I’m not sure there is any kind of distortion going on, other than maybe some artifacts from conversion to a new sample rate. There isn’t any clipping of the waveform - maybe it sounds distorted because the low end is being emphasized more than it was in the full-range version. But the sample rate issue is worse than you thought - it’s being sampled at 22 kHz, not 32.

103092–3962–$waveform_145.zip (37.9 KB)
103092–3963–$macfreq_437.zip (287 KB)
103092–3964–$pcfreq_252.zip (623 KB)

Jessy thanks for looking into this. I’m now at work so I can’t do as much analysis, and just rattled off those two recordings before leaving.

At any rate, I think you may be right about the distorted quality coming from the low end perhaps being emphasized more in the 22khz Windows mix. I looked at the wave forms and nothing looked overly clipped (although at first listen it sort of has that effect compared to the Mac version). Of course the recordings are not representative of the actual internal Unity mix because in both cases I was recording the stereo software mix directly but that volume was adjusted further by the recording program.

At any rate I’ve just played the Unity PC build here at work on my laptop running XP and I hear the same quality/effect. So at this rate it doesn’t look isolated to just my machine at home. The interesting thing about my machine at home is that it’s a Mac Pro running Mac OS X Leopard and Vista Ultimate both via bootcamp, so it’s the same hardware in both cases.

So out of curiosity I downloaded Audacity and recorded the stereo mix of another Unity Windows build that I did not make (not my content). Again spectral analysis shows an extremely large drop off right around 11khz, which would also indicate an audio playback sample rate of 22050 hz on Windows builds. From where I sit now it just looks like Unity Windows builds might mix all audio at 22khz instead of 44.1khz.

This seems to be true for Windows web player too, which makes sense, but just verifying.

Just ran into this problem too, when adding music to my game. :frowning: crackle fest!