# Change pitch of an instance

**URL:** <https://qa.fmod.com/t/change-pitch-of-an-instance/16409>\
**Category:** FMOD Studio\
**Created:** [November 8, 2020, 12:42pm UTC](https://qa.fmod.com/t/change-pitch-of-an-instance/16409 "2020-11-08T12:42:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dimitrisgiov](https://avatars.discourse-cdn.com/v4/letter/d/74df32/32.png) [@dimitrisgiov](https://qa.fmod.com/u/dimitrisgiov)\
**Post date:** [November 8, 2020, 12:42pm UTC](https://qa.fmod.com/t/change-pitch-of-an-instance/16409/1 "2020-11-08T12:42:26Z")

</div>

Hello everyone,

I am trying to change the pitch of an instance before and after the instance is called but I cannot really do it.

I don’t want to use **parameter** or **snapshot** but I want to change the pitch value via **script** and I want to do that **real time** so the instance will change pitch while playing.

I have tried the .setPitch(float) function for the instances but there is no change on the pitch when I pass positive numbers to the function. Also, if I pass negative values to the function it throws an assertion error. I checked the API and it is a range error.

Any ideas?

I am using Unity 2019.2.4f1 and FMOD Studio 2.01.04.

---

<div class="post-metadata">

**Author:** ![Paalo](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/paalo/32/616_2.png) [@Paalo](https://qa.fmod.com/u/Paalo)\
**Post date:** [November 8, 2020, 9:51pm UTC](https://qa.fmod.com/t/change-pitch-of-an-instance/16409/2 "2020-11-08T21:51:30Z")

</div>

Could you post some of your code examples so that we can see how you’re trying to achieve this?

---

<div class="post-metadata">

**Author:** ![mathew](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/mathew/32/431_2.png) [@mathew](https://qa.fmod.com/u/mathew)\
**Post date:** [November 9, 2020, 1:17am UTC](https://qa.fmod.com/t/change-pitch-of-an-instance/16409/3 "2020-11-09T01:17:25Z")

</div>

It sounds like what you need is indeed [setPitch](https://fmod.com/resources/documentation-api?version=2.1&page=studio-api-eventinstance.html#studio_eventinstance_setpitch), keep in mind that function only accepts positive numbers. For instance a pitch of 2.0f is one octave up and a pitch of 0.5f is one octave down. As mentioned by @Paalo, a code example might highlight what your issue is.

---

<div class="post-metadata">

**Author:** ![dimitrisgiov](https://avatars.discourse-cdn.com/v4/letter/d/74df32/32.png) [@dimitrisgiov](https://qa.fmod.com/u/dimitrisgiov)\
**Post date:** [November 11, 2020, 11:39am UTC](https://qa.fmod.com/t/change-pitch-of-an-instance/16409/4 "2020-11-11T11:39:01Z")

</div>

Hello @Paalo @matthew ,

Thank you for your replies.

I am not sure what I was doing wrong but my code looks like this and it works fine.

\_instance = FMODUnity.RuntimeManager.CreateInstance(\_eventPath);  
\_instance.setPitch(0.5f);
