# How to add a dsp pitch-shifter for eventInstance

**URL:** <https://qa.fmod.com/t/how-to-add-a-dsp-pitch-shifter-for-eventinstance/18783>\
**Category:** FMOD Studio\
**Tags:** unity, csharp\
**Created:** [May 22, 2022, 7:49am UTC](https://qa.fmod.com/t/how-to-add-a-dsp-pitch-shifter-for-eventinstance/18783 "2022-05-22T07:49:30Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![RiddleC](https://avatars.discourse-cdn.com/v4/letter/r/b2d939/32.png) [@RiddleC](https://qa.fmod.com/u/RiddleC)\
**Post date:** [May 22, 2022, 7:49am UTC](https://qa.fmod.com/t/how-to-add-a-dsp-pitch-shifter-for-eventinstance/18783/1 "2022-05-22T07:49:30Z")

</div>

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

```auto
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!

---

<div class="post-metadata">

**Author:** ![richard\_simms](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/richard_simms/32/261_2.png) [@richard\_simms](https://qa.fmod.com/u/richard_simms)\
**Post date:** [May 27, 2022, 12:27am UTC](https://qa.fmod.com/t/how-to-add-a-dsp-pitch-shifter-for-eventinstance/18783/2 "2022-05-27T00:27:42Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![RiddleC](https://avatars.discourse-cdn.com/v4/letter/r/b2d939/32.png) [@RiddleC](https://qa.fmod.com/u/RiddleC)\
**Post date:** [May 30, 2022, 9:18am UTC](https://qa.fmod.com/t/how-to-add-a-dsp-pitch-shifter-for-eventinstance/18783/3 "2022-05-30T09:18:48Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![richard\_simms](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/richard_simms/32/261_2.png) [@richard\_simms](https://qa.fmod.com/u/richard_simms)\
**Post date:** [May 31, 2022, 12:39am UTC](https://qa.fmod.com/t/how-to-add-a-dsp-pitch-shifter-for-eventinstance/18783/4 "2022-05-31T00:39:14Z")

</div>

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()`

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/e/e27f8c356b55d2ff33147bf7741b571c04c068be.png)

---

<div class="post-metadata">

**Author:** ![RiddleC](https://avatars.discourse-cdn.com/v4/letter/r/b2d939/32.png) [@RiddleC](https://qa.fmod.com/u/RiddleC)\
**Post date:** [June 2, 2022, 9:39am UTC](https://qa.fmod.com/t/how-to-add-a-dsp-pitch-shifter-for-eventinstance/18783/5 "2022-06-02T09:39:43Z")

</div>

Thank you!  
I will try it.

---

<div class="post-metadata">

**Author:** ![eduardofmod](https://avatars.discourse-cdn.com/v4/letter/e/54ee81/32.png) [@eduardofmod](https://qa.fmod.com/u/eduardofmod)\
**Post date:** [April 26, 2023, 8:06pm UTC](https://qa.fmod.com/t/how-to-add-a-dsp-pitch-shifter-for-eventinstance/18783/6 "2023-04-26T20:06:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Leah\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/leah_fmod/32/3685_2.png) [@Leah\_FMOD](https://qa.fmod.com/u/Leah_FMOD)\
**Post date:** [April 26, 2023, 11:25pm UTC](https://qa.fmod.com/t/how-to-add-a-dsp-pitch-shifter-for-eventinstance/18783/7 "2023-04-26T23:25:40Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![eduardofmod](https://avatars.discourse-cdn.com/v4/letter/e/54ee81/32.png) [@eduardofmod](https://qa.fmod.com/u/eduardofmod)\
**Post date:** [April 27, 2023, 5:52am UTC](https://qa.fmod.com/t/how-to-add-a-dsp-pitch-shifter-for-eventinstance/18783/8 "2023-04-27T05:52:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![eduardofmod](https://avatars.discourse-cdn.com/v4/letter/e/54ee81/32.png) [@eduardofmod](https://qa.fmod.com/u/eduardofmod)\
**Post date:** [April 27, 2023, 5:59am UTC](https://qa.fmod.com/t/how-to-add-a-dsp-pitch-shifter-for-eventinstance/18783/9 "2023-04-27T05:59:56Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Leah\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/leah_fmod/32/3685_2.png) [@Leah\_FMOD](https://qa.fmod.com/u/Leah_FMOD)\
**Post date:** [April 27, 2023, 6:04am UTC](https://qa.fmod.com/t/how-to-add-a-dsp-pitch-shifter-for-eventinstance/18783/10 "2023-04-27T06:04:51Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![eduardofmod](https://avatars.discourse-cdn.com/v4/letter/e/54ee81/32.png) [@eduardofmod](https://qa.fmod.com/u/eduardofmod)\
**Post date:** [April 27, 2023, 6:18am UTC](https://qa.fmod.com/t/how-to-add-a-dsp-pitch-shifter-for-eventinstance/18783/11 "2023-04-27T06:18:36Z")

</div>

Thanks again.  
I am so sorry!

---

<div class="post-metadata">

**Author:** ![eduardofmod](https://avatars.discourse-cdn.com/v4/letter/e/54ee81/32.png) [@eduardofmod](https://qa.fmod.com/u/eduardofmod)\
**Post date:** [May 4, 2023, 9:07pm UTC](https://qa.fmod.com/t/how-to-add-a-dsp-pitch-shifter-for-eventinstance/18783/12 "2023-05-04T21:07:21Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Leah\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/leah_fmod/32/3685_2.png) [@Leah\_FMOD](https://qa.fmod.com/u/Leah_FMOD)\
**Post date:** [May 5, 2023, 12:44am UTC](https://qa.fmod.com/t/how-to-add-a-dsp-pitch-shifter-for-eventinstance/18783/14 "2023-05-05T00:44:09Z")

</div>

> [@eduardofmod](#):
>
> 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.

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](https://www.fmod.com/legal), which details when the FMOD Engine is permitted to be used and redistributed.

> [@eduardofmod](#):
>
> Is it possible without code ?

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.
