# Increase or Decrease Music Tempo without Pitch Change

**URL:** <https://qa.fmod.com/t/increase-or-decrease-music-tempo-without-pitch-change/12902>\
**Category:** FMOD Studio\
**Created:** [January 2, 2017, 1:02am UTC](https://qa.fmod.com/t/increase-or-decrease-music-tempo-without-pitch-change/12902 "2017-01-02T01:02:30Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![saulls](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@saulls](https://qa.fmod.com/u/saulls)\
**Post date:** [January 2, 2017, 1:02am UTC](https://qa.fmod.com/t/increase-or-decrease-music-tempo-without-pitch-change/12902/1 "2017-01-02T01:02:30Z")

</div>

Hello:

Is there anyway to increase or decrease the tempo of the music in an audio track without changing its pitch in the process?

Thanks.

---

<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:** [January 3, 2017, 5:23am UTC](https://qa.fmod.com/t/increase-or-decrease-music-tempo-without-pitch-change/12902/2 "2017-01-03T05:23:39Z")

</div>

You can counter the pitch change by using the FMOD Pitch Shifter DSP.

---

<div class="post-metadata">

**Author:** ![saulls](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@saulls](https://qa.fmod.com/u/saulls)\
**Post date:** [January 3, 2017, 11:20pm UTC](https://qa.fmod.com/t/increase-or-decrease-music-tempo-without-pitch-change/12902/3 "2017-01-03T23:20:32Z")

</div>

> [@](#):
>
> You can counter the pitch change by using the FMOD Pitch Shifter DSP.

Awesome! Thank you so much!

---

<div class="post-metadata">

**Author:** ![Bradgentle](https://avatars.discourse-cdn.com/v4/letter/b/898d66/32.png) [@Bradgentle](https://qa.fmod.com/u/Bradgentle)\
**Post date:** [April 17, 2019, 2:40am UTC](https://qa.fmod.com/t/increase-or-decrease-music-tempo-without-pitch-change/12902/4 "2019-04-17T02:40:40Z")

</div>

I was having trouble getting the pitch of the Pitch shifter DSP plugin to shift accurately. I found an old thread that used a formula to calculate how much you need to shift for a specific keychange. Instead of providing the formula, i thought id just share my results from a google sheets doc. hope this helps some future person.

It would be awesome if the Pitch shifter plugin could just use a semitone or cents shifter rather than an arbitrary 0 to 2 number thing…

For now heres the numbers.  
[![Imgur](https://i.imgur.com/h4821Mm.png?fb "Imgur") ](https://imgur.com/h4821Mm)

---

<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:** [April 29, 2019, 7:49am UTC](https://qa.fmod.com/t/increase-or-decrease-music-tempo-without-pitch-change/12902/5 "2019-04-29T07:49:06Z")

</div>

Very helpful, thank you for that!

---

<div class="post-metadata">

**Author:** ![ff-f](https://avatars.discourse-cdn.com/v4/letter/f/a88e4f/32.png) [@ff-f](https://qa.fmod.com/u/ff-f)\
**Post date:** [November 5, 2022, 3:25am UTC](https://qa.fmod.com/t/increase-or-decrease-music-tempo-without-pitch-change/12902/6 "2022-11-05T03:25:37Z")

</div>

Just dropping this info for anyone still reading. If you’re using C#/Unity, you can use the following functions to transform the values just as shown in the Pitch Shifter formula:

```auto
    private static float SpeedMultiplierToPitchSemitones(float speed)
    {
        return 12f * Mathf.Log(speed, 2f);
    }

    private static float PitchSemitonesToSpeedMultiplier(float pitch)
    {
        return Mathf.Pow(2f, pitch / 12f);
    }

```

The actual code I use is this:

```auto
    private void SetSpeed(float speed)
    {
        float pitch = SpeedMultiplierToPitchSemitones(speed);
        float pitchShift = 1f / speed;
        Debug.Log($"speed: {speed}, pitch: {pitch}, pitchShift: {pitchShift}");
        // change the tempo
        m_MusicInstance.setParameterByName("Pitch", pitch);
        // compensate for pitch change
        m_MusicInstance.setParameterByName("PitchShift", pitchShift);
    }

```

NOTE: This requires having parameters set up so that “Pitch” and “PitchShift” apply the same values to the respective controls.

---

<div class="post-metadata">

**Author:** ![ff-f](https://avatars.discourse-cdn.com/v4/letter/f/a88e4f/32.png) [@ff-f](https://qa.fmod.com/u/ff-f)\
**Post date:** [February 1, 2023, 12:30am UTC](https://qa.fmod.com/t/increase-or-decrease-music-tempo-without-pitch-change/12902/7 "2023-02-01T00:30:05Z")

</div>

I’ve improved my code a bit. Here’s a glimpse:

```auto
    private void SetSpeed(float speedMultiplier)
    {
        float pitchSemitones = SpeedMultiplierToPitchSemitones(speedMultiplier);
        float pitchShift = 1f / speedMultiplier;
        Debug.Log($"speedMultiplier: {speedMultiplier}, pitchSemitones: {pitchSemitones}, pitchShift: {pitchShift}");
        // change the tempo
        m_MusicInstance.setPitch(speedMultiplier);
        // compensate for pitch change
        m_MusicInstance.setParameterByName("PitchShift", pitchShift);
    }

```

You can also rename `speedMultiplier` to `pitch`, which I have done in my actual code.

---

<div class="post-metadata">

**Author:** ![ANevskiy](https://avatars.discourse-cdn.com/v4/letter/a/cc9497/32.png) [@ANevskiy](https://qa.fmod.com/u/ANevskiy)\
**Post date:** [February 1, 2023, 11:05am UTC](https://qa.fmod.com/t/increase-or-decrease-music-tempo-without-pitch-change/12902/8 "2023-02-01T11:05:10Z")

</div>

This is very cool! Thank you so much for your help!
