Audio distortion in WebGL build

I’m having a problem with a WebGL build. Anytime an audio file is playing, we get very loud distortion that sort of sounds like the audio is being delivered through a very bad, very staticky walkie-talkie.

The audio plays fine anywhere except WebGL, including in the Editor when on the WebGL platform “mode”. It happens in both Chrome and Firefox on WebGL, but not on Web Player.

Any help in tracking the cause of this bug down would be appreciated. I’ve attached a screenshot of the import settings of (one of the) audio files giving us trouble.

bump

I am having similar problems…

I have been doing some testing, and in my tests importing and re-exporting the files using different software (Audacity) was enough to work around the issue. So this might be a workaround you can use if no Unity-borne fix is forthcoming.

This sounds like an issue with the AAC audio import we use on WebGL. Please file a bug with a sample of the sound file you are using.

I have filed a bug report: https://fogbugz.unity3d.com/default.asp?726623_tqfuvdtitfmvqisa

As StarManta mentioned, an Audacity import/export fixes the issues.

It looks to be any audio file that has over 16 bits per sample (24 might actually be ok, 32 definitely not). Going through our project and re-exporting any audio files above 16 bits per sample sorted everything out for us.

Thanks for the bug report. I just got to take a look at it - it does not actually seem to be an issue with 32-bit samples in WAV files, but with floating point samples in WAV files, which our importer tool does not handle correctly. I have a fix, which I expect to land in 5.3 (no guarantees, though).

We’re experiencing different kind of audio distortion on WebGL build (Chrome). Our background music slows down all the time. Music sounds very sloppy during gameplay and during certain events (like reaching a checkpoint or killing an enemy) the music slows down even more.

Game is running easily 60fps and WebGL is only platform we’re experiencing this.

The music sounds like someone is cranking it by hand…

Edit: I have tried opening the .mp3 file in audacity and saving it as 16-bit .wav without any luck.

There is a bug (which is fixed in 5.3 and also coming to a 5.2 patch release), where Unity will incorrectly apply doppler effect simulation on AudioSources having their spatial blend set to 2D. You can work around this by setting the doppler level of the AudioSource to zero.