# The music is stopped for a short time

**URL:** <https://qa.fmod.com/t/the-music-is-stopped-for-a-short-time/14088>\
**Category:** FMOD Engine\
**Created:** [September 6, 2018, 12:03pm UTC](https://qa.fmod.com/t/the-music-is-stopped-for-a-short-time/14088 "2018-09-06T12:03:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jedah](https://avatars.discourse-cdn.com/v4/letter/j/cc9497/32.png) [@Jedah](https://qa.fmod.com/u/Jedah)\
**Post date:** [September 6, 2018, 12:03pm UTC](https://qa.fmod.com/t/the-music-is-stopped-for-a-short-time/14088/1 "2018-09-06T12:03:08Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![richard\_simms](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/richard_simms/32/261_2.png) [@richard\_simms](https://qa.fmod.com/u/richard_simms)\
**Post date:** [September 10, 2018, 5:23am UTC](https://qa.fmod.com/t/the-music-is-stopped-for-a-short-time/14088/2 "2018-09-10T05:23:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Jedah](https://avatars.discourse-cdn.com/v4/letter/j/cc9497/32.png) [@Jedah](https://qa.fmod.com/u/Jedah)\
**Post date:** [September 10, 2018, 5:29am UTC](https://qa.fmod.com/t/the-music-is-stopped-for-a-short-time/14088/3 "2018-09-10T05:29:28Z")

</div>

> [@](#):
>
> 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.

---

<div class="post-metadata">

**Author:** ![richard\_simms](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/richard_simms/32/261_2.png) [@richard\_simms](https://qa.fmod.com/u/richard_simms)\
**Post date:** [September 11, 2018, 2:25am UTC](https://qa.fmod.com/t/the-music-is-stopped-for-a-short-time/14088/4 "2018-09-11T02:25:19Z")

</div>

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
