0
0

I need to change the speed of a short wav file that is played in a loop without changing the pitch. As I understand, one has to do this by using FMOD_Channel_SetFrequency in combination with FMOD_DSP_PITCHSHIFT. The problem is, however, that I have a hard time to find out how to use the latter, as I neither find any examples in the example programs. Could anybody be so kind to show me how to do this in practice. How to set up the FMOD_DSP_PITCHSHIFT function. I am programming in C.

Thanks in advance.

Sincerely

Keitel

  • You must to post comments
0
0

Looking more in the forum, I found the example I had been searching for. I’ve copied it in case others will be looking for the same:

FMOD_CHANNEL *channel;
FMOD_DSP *myDSP;

// Create the DSP effect.
result = FMOD_System_CreateDSPByType(system, FMOD_DSP_TYPE_PITCHSHIFT, &myDSP);
ERRCHECK(result);

// Then you need to set the pitch
result = FMOD_DSP_SetParameter(myDSP,0,2);
ERRCHECK(result);

// Then play the sound in the channel
result = FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, sound, true, &channel);
ERRCHECK(result);

// Then apply the DSP effect to the channel
result = FMOD_Channel_AddDSP(channel, myDSP,0);
ERRCHECK(result);

The pitch is set to 2, which means one octave higher. The default is 1, which is no change, while 0.5 gives one octave lower etc.

Sincerely

Keitel

  • You must to post comments
0
0

I managed to make FMOD_DSP_PITCHSHIFT work with FMOD_ChannelGroup_SetPitch to change the speed of a sound sequence without changing the pitch. But the resulting sound is awful. So this was quite useless. I therefore wondered if anybody would have any suggestions how one could change the speed of a sound while keeping the same frequency, but without distorting the sound quality too much?

Sincerely

Keitel

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.