How To Change Audio Speed in Unreal Engine

With the April 2022 release of Unreal Engine 5 came MetaSounds, Epic’s new audio system that provides audio designers with a daunting amount of control over their game’s runtime sound capabilities.

Having dabbled a little with the system myself (although no way near as much as I’d like!) I thought it was worth revisiting one of the more common use-cases for dynamic audio transformation; changing the playback speed of audio at runtime.

There are a few different ways to change the speed of your audio in Unreal Engine, including blending between multiple sound cues at different speeds, or pitching the sound to your desired speed then pitch-shifting it back using MetaSounds.

In this tutorial we’ll have a look at each of these techniques, how they work, and explore some practical use cases that you can download for yourself.

Example
Download the Unreal project

If you’re interested in further unpacking the techniques we cover in this article you can access the Unreal project I used in the video below from its GitHub page.

Please feel free to use the assets and Blueprints within for your own projects, should they prove useful.

Changing audio speed in real time

Being able to dynamically change the playback speed of your audio might seem like a pretty basic and fundamental part of any audio engine but it can actually be a relatively expensive operation.

Most audio editing software packages like Audacity may be able to achieve this relatively quickly, but to do so dynamically and at the speed you’d need to hit your target framerate is an altogether different and larger challenge. Case in point: Using Audacity to change the speed of the 2 minute clip I used for this tutorial took almost a minute to finish processing.

Changing the speed of an audio file in Audacity can be achieved via either the Change Tempo or Sliding Scale operations found in the Effects menu. For this tutorial I used the latter of these methods because I found it generated better results, but I recommend trying them both out for yourself.

I am not an audio engineer so I’ll leave more technical breakdowns of the problem to those who’re feel more confident in the space, but I hope this explains why changing the speed of your audio in Unreal may not be as simple as pressing a ‘change speed’ button. We may have to tackle this problem in a bit more of a roundabout way.

Let’s have a look at some solutions.

Changing audio speed by altering the pitch

The simplest and easiest way to change the speed of your audio in any iteration of the Unreal Engine is to modify its pitch. This can be done in the Sound Cue, or by changing the settings of your Audio Component.

This operation can be done at runtime, as in this example from our demo project where I am using the rotation rate of my record player to dictate both the speed and pitch (volume as well, but that’s not super relevant) of the Audio Component.

If this kind of behaviour is what you’re looking for (as I was for the Record Player interactable) then you’ve got what you need. If you’re looking to change the tempo of your audio without altering its pitch we have a little more work to do.

Example
Keep in mind

In Unreal Engine tempo and pitch are intrinsically linked. This is because they’re quite literally the same thing. Just like in the real world, the faster a sound waveform oscillates, the ‘higher’ our brain will perceive that sound to be. Special thanks to friend of the site Hollister Starrett for this layman’s explanation!

Rectifying pitch with MetaSounds

Unfortunately this step needs access to MetaSounds so this solution is for Unreal Engine 5 developers only.

Through the use of a custom MetaSounds Pitch Shift node we can ‘correct’ pitch alterations made earlier in the process to end up with a change in tempo without a detectable change in pitch. This process is similar in principle to Audacity’s Sliding Scale Effect except we’re doing it in two discrete steps, and much faster.

Creating the Pitch Shift MetaSounds node isn’t a trivial task, especially if you’re like me and your experience with raw, unfiltered C++ is limited. Luckily for me, the Lead Audio Programmer at Epic, Aaron McLeran, has written a detailed tutorial on this exact process. We couldn’t ask for more!

In deference to the hard work Aaron and his team put in to create the Pitch Shift tutorial, this node is not included in the demo project.

Example
Further reading

This trick was brought to my attention by Chris Zuko in this reddit post. Chris has created a range of interesting audio experiments in Unreal Engine, one of the most exciting being his audio sandbox game Mix Universe, currently in Early Access on Steam. Check it out!

Changing audio speed by blending different versions of the same audio file

If you’re looking to jump between different audio speeds without too much of a transition (or if you don’t have access to MetaSounds) you might consider blending between different versions of the same sound file.

For this method you’ll need to import your audio file into an external audio editor and author multiple versions of your file at each speed you require before you jump into Unreal. As you might have expected by now, for my project I used the Sliding Scale effect in Audacity.

Once you’ve got your different audio files for each speed iteration and you’re back in Unreal, all you need to do is switch audio cues as required. To make the transition seamless make sure you start playing the new file at the same relative position as the previous one. This is a two-stage process, where we first bind an event that will fire every tick that the audio is playing, and sets a Percent variable. We then multiply that value by the sound file’s duration to get the current time to start playing the next cue.

You can see an example of this in the demo project, where you can switch between five different versions of the same piece of music set to different speeds.

Click either of the images for a higher resolution version.

Changing audio speed using a third-party sound engine

If none of the above solutions meet your needs or you’re curious about alternatives, you might consider looking at an external sound engine like FMOD or Wwise. These tools open up a wealth of possibility and complexity in equal measure, but as cool as they are they’re well beyond the scope of this article.

There is a lot of interesting overlap between external audio software packages like these and the MetaSounds system which is now fully integrated into the engine itself. I feel like we’re only scratching the surface, and I’m super excited to explore more of these avenues in future techarthub tutorials.

I am a technical artist from Adelaide, Australia. I created techarthub to share my knowledge and love for this industry. I hope you feel it too!

Related Posts

Seven different techniques you can try that will significantly lessen the amount of time it will take to compile your shaders.
A practical guide to Unity's units of measurement, why they are important, and how you can alter them to suit your project's needs.
Scroll to Top