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.

Hi!!

I wonder if is it posible to change the pitch without changing the speed, only using the pitch control.
And if the only way is using the pitch shifter effect, what are de values to control exact semitones?
Thnaks

The only way to use time-invariant pitch shifting is with the Pitch Shifter effect, yes. The pitch control macro simply changes the playback speed of all child instruments. As for exact semitone values, the pitch control macro uses the formula 2.0^(st/12.0), with st being the semitone difference between the normal pitch and your target pitch - if you plug your desired semitone value into that formula, it’ll give you the corresponding pitch knob value to use. For example, a shift of 7 semitones (perfect fifth interval) above the base pitch would be 2.0^(7.0/12.0) = 1.58740....

Hope that helps!

Many, many thanks!
I am going to test!
Thanks again!

Many thanks for your quick mail!!!

For the next time to give you thanks, I can write you here or in the forum?

Thanks again!

Eduardo.

Either one works - if you reply via email, your email reply will show up on the forum.

Thanks again.
I am so sorry!

Hi again!

I would like to ask if I can use Fmod to implement audio in open sources. I mean without Unity or Unreal, in other develop software. Is it possible without code ? Where can I found the info please?

Many tahnks!

Eduardo.

You can use FMOD to implement audio in non-game projects, yes. For integration with your project, you’ll want to download the appropriate version of the “FMOD Engine” from the FMOD Downloads page.

However, I would recommend reading over our standard End User License Agreement, which details when the FMOD Engine is permitted to be used and redistributed.

No, it is not possible without code. Fundamentally, you will need to make calls from code into the FMOD Studio API or FMOD Core API in order to play sounds with FMOD.

Also, for future reference, if you have a question that is distinct from the topic of the current forum post, please make a new post for your question.