Strange Behavior Related to Encoding Settings

This is a spectrogram of a footstep sound encoded in PCM 6 kHz, played back in a standard windows media player and then recorded as-is via loopback.


This is a spectrogram of the same footstep sound encoded in PCM 6 kHz, played back in FMOD and recorded via loopback without applying any compression.

I’ve recently been having a hard time with an FMOD mixing issue. I just can’t get a clean mix, so I ran a few tests and found something strange. I confirmed that a footstep sound set to 12 kHz was being played all the way up to 48 kHz. I tested it further and ended up with results like the screenshots above. It looks as if FMOD is generating extreme harmonic distortion.

Why is this happening? Is this a bug? Or could it be related to the Resampler?

Additionally, even though I set the sample rate to 4kHz, the sound event in the Event Editor does not play back at 4kHz. (Of course, I made sure to enable the “compressed” button.)
However, when I listen to the same file in the Audio Bin or after building and running the game, it does play correctly at 4kHz. Is this a bug? i uploaded a video.

This would be caused by aliasing as a result of resampling the 6kHz asset to FMOD’s internal sample rate of 48kHz. There isn’t currently a way to configure a resampler in FMOD Studio, though we do have plans of addressing this in a future FMOD version. In your game you can select an FMOD_ADVANCEDSETTINGS::resamplerMethod to reduce aliasing.
Here I have a 200hz sine wave playing back in the FMOD API encoded at 48kHz, then at 4kHz with different resamplermethods selected to demonstrate the difference in aliasing:

As you can see, Spline is the most effective at reducing aliasing.

Auditioning the asset with compression is a feature of the Asset Preview and does not currently affect compression in the Event Editor- we have a feature request to add it to the Event Editor as well, which I have registered your interest to.

1 Like