How to add a dsp pitch-shifter for eventInstance

Hi,
want to setPitch for eventInstance to speed up my audio and want to use FMOD PITCHSHIFT to
reduce the tones.
l use pitch shift like this

ChannelGroup channel = new ChannelGroup();
            if (!RuntimeManager.GetMasterChannelGroup(out channel))
            {
                UnityEngine.Debug.LogWarning("Get Channelgroup failed!");
                return;
            }
res = RuntimeManager.CoreSystem.createDSPByType(DSP_TYPE.PITCHSHIFT, out dsp);
                if (res != RESULT.OK)
                {
                    UnityEngine.Debug.LogError("Create DSP for sound failed!" + res);
                    return;
                }
                res = channel.addDSP(CHANNELCONTROL_DSP_INDEX.HEAD, dsp);
res = dsp.setParameterFloat((int)FMOD.DSP_PITCHSHIFT.PITCH, 0.5f);
            if (res != RESULT.OK)
            {
                UnityEngine.Debug.LogError("DSP SetParameterFloat failed! " + res);
                return;
            }

but the audio sounds strange, just like the tone is very low.
I wonder what is the right way to add a dsp pitchshifter for EventInstance.
Thanks!

You can add the FMOD Pitch Shifter effect to the events directly and use automation with parameters in order to adjust the pitch shifting and the pitch of the event at the same time. This is a bit simpler and more manageable than doing setPitch and adjusting the pitch shifting DSP manually in code.

In regards to your question on the quality of the outcome, adjusting the frequency of the output will always have an impact on the quality of the sound. You could try to mitigate this by using high sample rate audio files and higher sample rate banks but there is always going to be some quality loss.

Thank you, Richard
I guess what you said is to modify the pitch_shift for events in Studio.
But, what we want is to allow player to play audios at original speed or double speed while the game is going on.
I wonder the right way to apply pitch_shift while the game is going on.
Thank you again!

If you want double speed then you can automate the pitch of the event to go to 12st and automate the pitch shift effect to drop 0.5x. This will speed up the playback to be double whilst maintaining the original pitch of the event. This is all automated by the same parameter which you can access with EventInstance::setParameterByName()

Thank you!
I will try it.