It seems that using the FMOD Pitch Shifter to adjust the pitch of the audio is the best way to do this, but it only has a parameter range of 0.5~2.
If we need to adjust the playback speed for a larger range, its parameter limit will be a problem.
Is there any way to adjust its parameter range? Or can you provide us a copy of the source code for it like the other effects in api/core/examples/plugins?
As of the time of writing (November 2023), FMOD has no simple solution for pitch-invariant time stretching, or time-invariant pitch shifting. There are number of recommended solutions and workarounds, as you’ve noted, the most commonly used among them being automating a pitch shift effect inversely to the pitch of an instrument/event.
Unfortunately, there’s no way to adjust the parameter range of the pitch shift effect, besides to add an additional pitch shift effect to the chain. An alternative might be to also use an two additional copies of your source asset, pitch shifted outside of FMOD Studio, and blend between them and the original asset alongside the use of a pitch shift effect to work around this.
FMOD provides a Plugin API that can be used to define a DSP plugin that can be placed into your effect chain - it is entirely possible for you to implement your own pitch shift plugin using this API, if desired. However, this is notably not support for common DAW plugin formats such as VST.
And I’ve gotten a general idea of the FMOD Studio plugin production process with the sample project that comes with the FMOD Engine.
Regarding your suggestion of using multiple pitch shifters to achieve the effect, I have already tried it. But it seems that using that DSP one more time reduces the sound quality again. And it doesn’t seem to be that easy to make a pitch shifter completely by myself.
But the source code for the pitch shifter doesn’t seem to be given in FMOD Engine, is this something that can’t be published? If it can’t be published, can you provide some information about the principle or algorithm of its implementation?
Unfortunately, I cannot provide you with the source code. However, the algorithm is based on a pitch shifting implementation by Stephan Bersnee. An article explaining the implementation can be found here, and an example .cpp can be downloaded here.