The music is stopped for a short time

void MusicPlayer::multSpeedSpecific(int index, float speed){
speeds[index] = speeds[index] * speed;
FMOD_DSP_SetParameterFloat(dsp, 0, 1/speeds[index]);
FMOD_Channel_SetPitch(channel[index], speeds[index]);
FMOD_Channel_AddDSP(channel[index], 0, dsp);
}

This is a function that I’m using. When I call that function when the music is playing, the music is stopped for a short time. Is it natural? Can I remove the blinking of music?

[ EDIT ]
I tested it with a simple code snippet.

include “fmod.h”
include “fmod_common.h”
include “fmod_errors.h”
include <unistd.h>

int main(int argc, char argv[])
{
FMOD_SYSTEM system;
FMOD_SOUND
sound;
FMOD_CHANNEL
channel;
FMOD_DSP* dsp;
FMOD_System_Create(&system);
FMOD_System_Init(system, 320, FMOD_INIT_NORMAL, nullptr);
FMOD_System_CreateDSPByType(system, FMOD_DSP_TYPE_PITCHSHIFT, &dsp);
FMOD_System_CreateSound(system, “C:/Users/Aaron/Desktop/Central park.mp3”, FMOD_LOOP_OFF | FMOD_2D, nullptr, &sound);
FMOD_System_PlaySound(system, sound, nullptr, false, &channel);
sleep(1);
FMOD_Channel_SetPaused(channel, true);
FMOD_Channel_SetPitch(channel, 1.1f);
FMOD_DSP_SetParameterFloat(dsp, 0, 1/1.1f);
FMOD_Channel_AddDSP(channel, 0, dsp);
FMOD_Channel_SetPaused(channel, false);
sleep(1);
FMOD_Channel_SetPaused(channel, true);
FMOD_Channel_SetPitch(channel, 1.2f);
FMOD_DSP_SetParameterFloat(dsp, 0, 1/1.2f);
FMOD_Channel_AddDSP(channel, 0, dsp);
FMOD_Channel_SetPaused(channel, false);
sleep(1);
FMOD_Channel_SetPaused(channel, true);
FMOD_Channel_SetPitch(channel, 1.3f);
FMOD_DSP_SetParameterFloat(dsp, 0, 1/1.3f);
FMOD_Channel_AddDSP(channel, 0, dsp);
FMOD_Channel_SetPaused(channel, false);
}

And I found that short stop occurs in FMOD_Channel_AddDSP function.
How can I handle this?

Hi Aaron,

It seems the type of DSP you’re using (the pitch shifter) is causing the hiccup in audio. Would you be able to move the addDSP function out of your call and see if you can hear the same gap in audio? There’s no need to dynamically add a DSP each time you call a function like this.

Thanks,
Richard

Hiccup does not occur if I remove the function. However, I need to use addDSP function because I want to change the speed of playback multiple times during playing the audio.
FMOD_Channel_SetPitch(channel, 1.2f);
FMOD_DSP_SetParameterFloat(dsp, 0, 1/1.2f);
This code (which is without addDSP) speeds up the audio, but also changes the pitch. I want to remain the pitch.

Hi Aaron,

You can have the DSP always on a channel dedicated to the music. That way you don’t need to dynamically add and remove the DSP with this function.

Thanks,
Richard