Hi,
I’m trying to increase the tempo of the sound without affecting its pitch.
For now, I managed by altering the frequency with setFrequency() and adding FMOD_DSP_TYPE_PITCHSHIFT on top of that channel.
But this approach degrades the quality of the sound when played.
Also tried changing FMOD_DSP_PITCHSHIFT_FFTSIZE and increasing the DSPBufferSize but no luck so far.
Is there any better way to achieve a smooth and clear time-stretching with better sound quality?
Unfortunately, your options are quite limited here. The main way to perform any sort of invariant pitch/time alteration in FMOD is to combine the pitch shifter effect with changing the channel frequency. However, the pitch shifter is fairly old at this point and comes with a number of flaws as a result, the main one being it isn’t the highest quality. This is in part due to its age, but is also due to computationally expensive audio processing like pitch shifting being more impactful in the real-time context of FMOD compared to a DAW, which doesn’t need to worry about it quite as much.
Depending on your needs, a relatively simple alternative would be to perform the pitch-invariant time stretching in various stages in a DAW, and then blend/transition between assets as needed in FMOD.
A more complex but potentially more effective alternative would be to create your own DSP plugin to use instead of the FMOD pitch shifter. We recently added a wrapper for RNBO plugins to the Core API examples, which you may wish to take a look at if you’re used to working in Max/MSP.
That said, the FMOD pitch shifter DSP been flagged for some improvements - I’ll note your interest on our internal feature tracker.