[Android] New AudioMixerAndroid in 4.17p1 results in crackling audio

EDIT: Just tested my project with 4.17P1 and the new audio mixer and unfortunately while the crackle is no where near as bad as in 4.16 it is still there on some sounds :frowning:

Any ideas/workarounds how to prevent that? Was really hoping to use 4.17 for 3D audio in our GearVR game …

I’m testing the new Audio Engine in 4.16P1 on android using:

“For Android, in AndroidEngine.ini set AudioDeviceModuleName=AudioMixerAndroid”

when testing on my device: Samsung S7 Edge 6.0.1 minSDK 19 armv7 I get spatialized audio finally however it has a cracking to it. I tested a few different sound files with the same result.

I can reproduce it on a blank project by importing a sound keeping all defaults and playing the sound at a distance from the player.

If I disable the new audio engine the crackling sound is gone. Are there any special sound settings required on the wav or cue itself? I was really hoping to get this working for gearvr with the 4.16 release.

Hi .

I’ve discussed with our audio developers and this is a known issue with the new audio engine that affects Android, iOS, and some consoles. This is being worked on.

I don’t have the ticket number for reference at the moment, but if I can track that down I will follow up with additional details.

Cheers

any update if this will be fixed for the 4.16 final?

Apologies, but this is not going to be fixed for 4.16.

The focus for the new audio engine for 4.16 has been the PC implementation.

Specifically, the android backend implementation has a number of issues with the OpenSL ES implementation that I am fixing now. For example, the buffer callback from the platform queued voice is doing the actual audio rendering (rather than using a double-buffer approach like is used on PC). This causes immediate buffer underruns (which is the “crackling” you’re hearing) even with just a small number of source voices.

The good news is that it only took a couple hours to fix up but the number of changes from the original Android implementation to the new one are significant and is way too risky to bring into 4.16 right now, especially since the new audio engine is “experimental”. In other words, there isn’t an expectation to work fully and no content has been made which is using it, which means there’s no regression issues. Any request for code changes at this point to experimental features are generally denied since there is no reasonable expectation that it will work.

I apologize for the inconvenience, but please bare with me on this. We’re trying to role out a new audio engine on 9 platforms (PC/Mac/XboxOne/PS4/iOS/Android/Linux/HTML5/Switch) that has backwards compat on all existing features, while also supporting all our internal game releases (e.g. Paragon/Fortnite/Spyjinx/Battlebreakers/RoboRecall), all the old audio engine stuff (can’t have regressions!), as well as licensee and forum support. :smiley:

To help with the back end implementations, we contracted out a “first pass” implementation on Android/iOS/Switch/Mac but I have not yet personally looked at these back ends deeply as my focus has been fixing bugs in the multi-platform audio renderer so at least PC is relatively stable and bug-free in 4.16 since that’s where most users are going to be trying things out.

ok thanks for the additional info - Can we expect it working for 4.17?

FYI I just tested a pitch multiplier via blueprints with 4.16 on S7 Edge/GearVR. Works… Thank you Epic finally! And with no crackling.

How many sounds are you trying to render on android? Android is still a very limited platform (CPU-wise) for audio. You might have to reduce your channel (voice) limit to something around 10-20 voices. One of the primary reasons is CPU threads can get throttled very quickly for a number of reasons (background apps, temperature, feathers in china, etc).

I wrote some code which should mitigate this issue by queuing a bunch of rendered audio buffers so any individual buffer might take more time due to CPU throttling, but overall should be good.

However, there’s still general performance issues on android and it’s possible to simply “underrun” if it’s trying to do too much.

Hey there,

So for projects switching content implemented in old audio engine to the new multiplatform audio mixer, I tried my best to make it as smooth as possible.

However, here’s one case where I intentionally chose not to move a feature from the old audio engine to the new one. A long time ago I had added a platform-dependent headroom scaler (I believe it defaults to -3 dB). The theory on this was that different platforms have different volumes due to totally different backend APIs. In particular, I was hunting around for a way to make our our Mac backend match, volume-wise, to our PC backend.

Moving to a multiplatform audio mixer, this issue is no longer present. each platform uses the exact same math for mixing. If you want to add a headroom value to all your audio, you simply need to reduce the volume of the master sound class.

Note that in the audio mixer, I am still doing the same volume clamp per source that was being done in the old audio engine:

	CurrentVolume = FMath::Clamp<float>(CurrentVolume * AudioDevice->GetPlatformAudioHeadroom(), 0.0f, MAX_VOLUME);

I simply am not adding an addition -3dB (default) headroom reduction.

Philosophically I’d prefer not to add even this clamp since MAX_VOLUME, being 4.0, isn’t any real protection against clipping. The reason I kept this is that, unfortunately, it’s common practice to add volume-scalers greater than 1.0 in many gain stages in UE4 and people do check in non-normalized source. A source playing at, for example, 2.0 volume scale, won’t actually clip if the content in it is not normalized. This is all too common a (bad) practice since not only does it not take advantage of the full bit-depth of the source file (often the same people complaining about wanting 24/32 bit audio are using non-normalized source!).

In general, it’s a bad idea to do mixing with volume value greater than 1.0 because at some point, due to the nature of digital audio, you’re eventually going to get some kind of clamp. You either clamp to 1.0 in the output, or you clamp via clipping. You can also clamp via dynamic range DSP compressor, but even then it can make reasoning about your mixes difficult.

This is because, when you clamp, you’re creating a non-linearity between your gain stage input and gain stage output. Non-linearity means that if you change your mix (adding a new sound class mix, change the volume of a sound source), it may or may not have a predictable effect on the final volumes of sources. Inputs do not map linearly to outputs.

We’re planning on developing better tools to help you debug your gain stages, but in the meantime, I’d recommend looking over your implementation to make sure you’re not adding too much volume scaling.

Note that the audio mixer actually has support for a master dynamic range compressor. You can create a dynamics processor preset in the editor, set it to be a “limiter”, and then add it to the master submix in BP. It defaults to not being added currently since the old audio engine didn’t have support for a master compressor.

I can confirm that reducing the volume below 1, and upgrading to Preview 2 solved nearly all audio issues for me. I think at this point any audio issues I’m experiencing are probably specific to individual wav files rather than to anything else. It’s really cool to have spatialization working now. Very excited when this version of the engine is released. This is a significant upgrade for the kinds of things I’m working on (android and daydream).

Strange I’m still getting crackling - could you give some info on how your calling your audio? Are you calling it via playSoundAtLocation to have it spatialized?

Just tested my project with 4.17P1 and the new audio mixer and unfortunately while the crackle is no where near as bad as in 4.16 it is still there on some sounds :frowning:

Any ideas/workarounds how to prevent that? Was really hoping to use 4.17 for 3D audio in our GearVR game …

I just checked in an update for Android which uses the optimal buffer size and sample rate for the new mixer. On an S7 it seems to work properly for me with this so please give it a try.

GitHub audio fix

Hey Minus_Kelvin and Chris,

I tried the github audio fix and unfortunately the same issue. I guess I found what triggers it - many of sounds I’m using I have increased the volume to match the volumes of other sounds. See this example project with one sound (played every 10secs) that crackles on my S7

I usually don’t have more than 3 sounds going at once but put the channel limit to 10 just to be sure and same issue.

Increasing the volume like this did not have an effect on the old audio engine and would be nice if it was not the case with the new engine either. Now I have to go through all sounds checking their volume for crackling and lower the overall volume of each sound manually so they normalize each other - or is there a simpler way to do this?

link text

Thanks Minus_Kelvin for the detailed answer - I’ve still alot to learn about digital audio but definitely makes sense that volume mixing probably shouldn’t go above 1. Anyway I try to reduce the master sound class else fix the volume mixing manually - I’m just glad spatialized audio for mobile VR now works! :slight_smile:

Edit:
Multiplier instead of Modulation.

I have never got the modulation to change using a sound cue on gearvr. Only by using “Set Pitch Multiplier” function for the sound component in the actor itself.

Sorry been on the road quite a bit. I was only talking about pitch modulation. Its was indeed crackling until I turned off spatialization in 4.16, Now with 4.17 spatialization works, but my pitch modulation doesn’t.

Is pitch modulation now broken on gearvr 4.17?

To answer your question it was a sound component in an actor (Helicopter). Just wanted the engine sound to change pitch with more or less load on the rotor.

In my spatialization test for 4.17 I added and empty actor to the map and added a sound component to that. Spatialization worked just fine with headphones on. However the the pitch doesn’t change anymore.

I have never got the modulation to change using a sound cue on gearvr. Only by using “Set Pitch Modulation” function for the sound component in the actor itself.

Hi Minus_Kelvin,

We’ve noticed a Daydream related audio problem with the new engine. Could you take a look to see if there is a quick fix?

It does not occur with the old audio mixer. Many thanks in advance! :slight_smile:

For those still banging their head trying to remove the last crackling audio I found adjusting this setting did the trick for my project:

Project Settings - Android - Callback Buffer Size: 2048

No noticeable increase in latency and no more small random crackles :slight_smile: