We’re working on an iOS app which uses FMOD to generate audio both in realtime and later as an offline rendering for saving. As such, I’m using a both a normal system and one with FMOD_OUTPUTTYPE_NOSOUND_NRT. The normal system works great and sounds great. However, we’re getting glitches with the NRT system when playing back the same data. The glitches we’re hearing are horrible crackling/distortion on the offline rendering.
The crackling seems to happen when the audio is too loud. There is a compressor in the DSP chain, with the following settings: attack = 1, gain makeup = 0, release = 300, threshold = -2. This is the same compressor we use with realtime playback, with no ill effects.
I’m suspecting a bug where the compressor doesn’t work properly on NRT systems because the same DSP chain works fine in realtime. I’ve also attached an image which shows the waveform exhibiting some weird, compressor-like effects, but obviously showing the cracking. Look at the highlighted section. Note that the waveform peaks, and is then slammed down improperly. The image shows two more places where this happens as well, both on the high-end of the samples and the low-end.
Any ideas? Has anyone else run into this on iOS? Thanks for any and all help!
- drapple asked 7 years ago
FMOD only pins the signal from -1..+1 at the final point in the chain. Pinning the values between every mix point would:
a) Become expensive, especially for large DSP trees
b) Not be desirable anyway. It is possible that one point in the mix chain will increase the amplitude of the signal above 1, but that a later point in the mix chain will bring it back down. If FMOD had clamped the signal at the original point, that information would have been lost due to clipping.
Think of it this way:
Say you had three waves that you were mixing together: two full-amplitude sine waves, and a full-amplitude inverse sin wave (y=-sin(x)), all perfectly in phase. The two sine waves get mixed together, then sent to a ChannelGroup. The inverse sine wave gets mixed in with the output of the ChannelGroup.
The proper output of these signals is a full-amplitude sine wave (one of the sines and the inverse sine cancel each other out, leaving only the sine wave). If you allow the values to go above 1 and then only clip at the end, then you will get the proper signal. If, however, you clip at every mix point (in this case, after the ChannelGroup), then you will end up mixing the inverse sine wave with a clipped signal, and get a strange and incorrect result.
Hope that helps!
- Adiss answered 7 years ago
Good news: It’s not FMOD! It’s caused by my converting from floating point to integer samples.
Another question, though: why do the samples taken from FMOD (using a custom DSP) range beyond [-1.0, 1.0]? I’m new to audio coding, but thought that FMOD would have the samples pinned between +/-1.
- drapple answered 7 years ago
Please login first to submit.