Unreal Engine 4 Audio Tutorial

In this Unreal Engine 4 audio tutorial, you will learn how to play audio in 3D space using different methods, and control audio volumes through a UI. By Tommy Tran.

4.7 (20) · 1 Review

Save for later
Share

In video games, the term audio is used to refer to things such as music, dialogue and sound effects. In this era of gaming, if your project does not have audio, it can seem unpolished and incomplete.

Audio also helps increase the immersion between the player and the game. Music provokes an emotional response. Dialogue develops characters and the story. Sound effects provide feedback and believability. All of these can turn a good game into a great game.

In this tutorial, you will learn how to:

  • Play music and loop it
  • Play a sound effect at specific points in an animation
  • Modulate the pitch of a sound every time it plays
  • Pan and adjust the volume of a sound depending on its location in 3D space
  • Control the volume of music and sound effects independently using the UI

Please note, you will be using Blueprints in this tutorial. If you haven’t already, please go through the previous tutorials as they cover different areas of Blueprints.

It is also recommended to use headphones for this tutorial as you will learn how to spatialize audio.

Note: This tutorial is part of a 10-part tutorial series on Unreal Engine:

Getting Started

Download the starter project and unzip it. Open the project by navigating to the project folder and opening SkywardMuffin.uproject.

Press Play to start the game. The goal of the game is to touch as many clouds as possible without falling. Click the left-mouse button to jump up to the first cloud.

Unreal Engine 4 Audio Tutorial

The game is relaxing, isn’t it? To emphasize the feeling of relaxation, the first thing you will do is play some calm piano music.

Playing Music

Go to the Content Browser and navigate to the Audio folder. Here, you will find all the sounds you will use in this tutorial. You can listen to them by hovering over their icon and then clicking the play icon that appears.

Unreal Engine 4 Audio Tutorial

Playing music is as simple as dragging and dropping the sound asset into the Viewport. However, the music will only play once. This is because you need to manually enable looping within the asset. Double-click on S_Music to open it.

Unreal Engine 4 Audio Tutorial

A new window with a single Details panel will appear. Go to the Sound Wave section and enable Looping.

Unreal Engine 4 Audio Tutorial

Next, go back to the main editor and then drag-click the S_Music asset into the Viewport.

Unreal Engine 4 Audio Tutorial

This will create an AmbientSound actor with S_Music as the sound source. This actor will automatically play S_Music when the game starts.

Press Play to listen to the music. After 17 seconds (the length of the music), it will loop and play again.

Unreal Engine 4 Audio Tutorial

Next, you will add a sound effect whenever the muffin takes a step. To do this, you will use an Animation Notify.

What is an Animation Notify?

An Animation Notify allows you to trigger an event at a specific point in an animation. You can use them in many different ways. For example, you could create a Notify to spawn a particle effect.

Unreal Engine 4 Audio Tutorial

In this game, the restart button appears as soon as the muffin touches the ground. However, using a Notify, you could make it appear at the end of the death animation.

Unreal Engine 4 Audio Tutorial

In this tutorial, you will Animation Notifies to play a sound when each foot hits the ground.

Creating an Animation Notify

Navigate to the Characters\Muffin folder and then open SK_Muffin_Walk. This will open the Animation editor.

In the panel below the Viewport, you will see an area called Notifies. The light grey area is a Notify Track. This is where you will create and manage your Notifies.

Unreal Engine 4 Audio Tutorial

Frame 10 and frame 22 are when each foot hits the ground so you will need to create a Notify at both of these points. To create a Notify, right-click on the Notify Track and select Add Notify\Play Sound. This will create a Notify called PlaySound.

Unreal Engine 4 Audio Tutorial

Next, you need to position the Notify so that it occurs on frame 10.

Moving an Animation Notify

It’s a bit hard to know where to move the Notify to because the Notify Track doesn’t indicate where frame 10 is. However, you can display a marker by using the Timeline.

First, go to the Timeline located at the bottom of the panel. Drag-click the red playhead and release when Current Frame is 10. Make sure to pause it first!

Unreal Engine 4 Audio Tutorial

Now, the Notify Track will have a red line indicating where the playhead is.

Unreal Engine 4 Audio Tutorial

Drag-click the PlaySound Notify and release when it aligns with the red line.

Unreal Engine 4 Audio Tutorial

Next, you need to tell the Notify to play the footstep sound.

Playing the Footstep Sound

Left-click on PlaySound to select it and then go to the Details panel. In the Anim Notify section, set Sound to S_Footstep.

Unreal Engine 4 Audio Tutorial

Next, repeat the process for the other foot. Do the following:

  • Create another Play Sound Notify
  • Move the Notify to frame 21
  • Set the Notify’s sound to S_Footstep

Unreal Engine 4 Audio Tutorial

Now, whenever the walk animation reaches frame 10 and frame 21, the Notifies will trigger and play the S_Footstep sound.

Close SK_Muffin_Walk and then go back to the main editor. Press Play and start walking around to hear the footsteps.

Unreal Engine 4 Audio Tutorial

After listening to the footsteps repeatedly, players may notice something. It’s the same sound effect each time! If only there were some way to vary the sound each time.

In the next section, you will play a sound effect when the player touches a cloud. But this time, you will vary the sound each time using a Sound Cue.

What is a Sound Cue?

A Sound Cue is an asset that allows you to manipulate multiple sounds and combine them. You can then treat the Sound Cue as its own sound. Anywhere you can use a regular sound, you can use a Sound Cue instead.

Here is an example of a Sound Cue using a Concatenator to play three sounds in succession:

Unreal Engine 4 Audio Tutorial

If you use a Random node instead, you can select a random sound every time you play the Sound Cue.

Unreal Engine 4 Audio Tutorial

In this tutorial, you will create and use a Sound Cue to change the pitch of a sound.

Tommy Tran

Contributors

Tommy Tran

Author

Over 300 content creators. Join our team.