When playing an uncompressed WAV sound file from memory using FMOD_OPENMEMORY_POINT with FMOD_CREATESAMPLE, there is an audible “click” or “pop” at the end when the sound stops playing. If I use FMOD_OPENMEMORY or FMOD_CREATESTREAM instead, there is no problem. I have tested my sound files in several different audio programs and players, including Audacity, and I’ve even played them through another opensource audio library (SoLoud on GitHub) from memory, and they only seem to produce the “click” in FMOD. The sound files I’m using are uncompressed WAVs in 16-bit signed int and 32-bit float. IMA-ADPCM files seem to work fine. What is most puzzling is that some uncompressed WAVs work fine, but most I’ve tried produce the “click”/”pop”.

I just would like to know if anyone has any insight as to why this might happen. I’ve provided a minimal working example that reproduces the problem below. I am using the FMOD API version 1.10.03 on Windows 7 64-bit with Visual Studio 2015. I get the same results for 32-bit/64-bit and logging/non-logging versions of the FMOD runtime.

// My code:
int main(int, char**) {
FMOD::System* system = nullptr;
system->init(512, FMOD_INIT_NORMAL, nullptr);

std::vector<char> buf = getBytesFromFile("Media/stone_impact.wav");

memset(&exinfo, 0, sizeof(exinfo));
exinfo.cbsize = sizeof(exinfo);
exinfo.length = (unsigned int)buf.size();

FMOD::Sound* sound = nullptr;
system->createSound((const char*), mode, &exinfo, &sound);
FMOD::Channel* channel = nullptr;
system->playSound(sound, nullptr, false, &channel);

// the sound is about half a second long, so this is just long enough to hear the artifact

return 0;


  • You must to post comments
Best Answer

I found a workaround. What I’m doing instead is FMOD_OPENMEMORY | FMOD_CREATESAMPLE with the WAV file in memory, then using FMOD::Sound::lock to retrieve the raw PCM. I then copy that to another buffer and release the first sound, and use FMOD_OPENMEMORY_POINT | FMOD_OPENRAW for any sounds that need that particular file thereafter. This works perfectly and allows me to reuse that same buffer for any number of sounds with various settings without duplicating it again.

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.