Processing recorded sound in real time?

,

Hi,

I’m quoting from this 9 years old article and I would like to know if it has changed since then.

The problem with any kind of analysis or processing of sound in FMOD is that it can only be done on an FMOD::Sound object that is currently playing through your own application on an FMOD::Channel . You can’t take an external sound source and process it. This is obviously a problem. The workaround is the following slightly creative procedure:

1. Create an FMOD::Sound which is empty and has short duration
2. Configure FMOD to record the sound card output to this sound, wrapping around and overwriting the oldest content every time it fills (using the sound buffer as a circular buffer)
3. Play the sound in a loop with a slight lag with the volume set to zero
4. Use any processing or analysis functions we would normally use on the sound as it plays

This works because playing the sound in a loop will ensure that the output is the same as the sound card’s output. The latency is required to ensure the sound buffer doesn’t empty at the start, or playback overruns and we end up re-playing bits of old already played sound in the buffer. Playing the sound back silently works because analysis functions are performed on the original waveform before FMOD applies volume adjustments.

Yes that is still the recommended way to record audio in FMOD. Please see the record and record_enumaration Core API examples available from the FMOD Engine downloads for up-to-date examples on how to do this.

1 Like