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
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.
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.
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.
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.
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.
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:
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
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.
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?
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!
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.
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.