Audio Tracks in Timeline

Objective: To help you understand what an Audio Track is in Unity’s Timeline.

Audio track in Timeine

We have looked at Activation and Animation Tracks so far, so now let’s take a look at the Audio Track in Timeline. Compared to the other two, Audio Tracks take in Audio Clips which come with a format of .wav, .mp3 or .ogg. Similar to the other tracks you can have multiple of the same, building out a very complex cutscene with overlapping audio clips and animations.

How to Add an Audio Track

Similar to the other tracks, this is as simple as right clicking in the Timeline editor → Audio Track, or alternatively, dragging a game object into the Timeline editor → Add Audio Track.

Adding an Audio Track to Timeline

Once added, you will see that it is now looking for an Audio Source. There is also a few options available now in the Inspector window which let’s you adjust the volume, left and right stereo pan and the spatial blend between 2D and 3D:

Audio Track — Inspector window

Adding an Audio Source or Audio Clip to Audio Track

We now have 2 options here, we could simply drag and drop in an Audio Clip to the Audio Track which would work fine, or the alternative is to have a game object with the Audio Source component and Audio Clip attached to it.

No game object/Audio Source attached
Game object with Audio Source attached

Adding an Audio Clip to the Audio Track

Right clicking on the Audio Track within the Timeline will then allow us to ‘Add from Audio Clip’ which is the attached Audio Clip located in the Audio Source component.

My Audio Clip is far too long, so I have gone ahead and split the track to a much smaller piece by highlighting it in the Timeline editor, dragging the white keyframe line to the desired position and pressing the ‘Skey. I then deleted the second clip as we don’t need it, and now we are left with this:

Adding an Audio Clip to the Audio Track

Audio Clip Properties

We now also have a bunch of Audio Clip properties that allow us to make adjustments within the Inspector, including Speed Multiplier, Blend Curves, Looping and Volume Control.

Audio Clip Inspector Properties

Issue Between Activation Track and Audio Track

However, now I have an issue between the Audio Track and Activation Track with the same game object. As the sphere is constantly being switched on and off with the Activation Track, it is also doing the same for the Audio Track, so the music is constantly cutting in and out. The easiest solution for this is just creating a new empty game object and attaching the Audio to this.

Fading in and Out

We also have the ability to make an Audio Clip fade in and out by simply dragging the ends of the Audio Clip inwards while holding down the ‘Ctrlkey.

Creating a fade in and our of Audio Clip

This will allow our music to gradually introduce itself into the cutscene (and fade out) instead of instantly being switched on and off.

--

--

Passionate Unity Game Developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store