Download Project File

How To Create an Audio Meter Using Text & Expressions in After Effects

In this post, you will learn how to create an audiometer using text and expressions in After Effects.

How To Create an Audio Meter Using Text & Expressions in After Effects

By the way, just a little disclaimer: I will not be able to show you how to set up everything you see in this composition, however, you can download the project file and follow along!

With that said, In this tutorial, I will show you the most important parts you should know and you will be able to pick it up from there.

So for this example, I have an audio level.

Audio level in After Effects

I am going to convert the waveform from the image above into numbers, that way I can actually use them.

To do that, I am going to right-click on the [AUDIO SAMPLE.wav] and go to Keyframe AssistantConvert Audio to Keyframes.

Convert Audio to Keyframes in After Effects

You should now see a new [Audio Amplitude] layer appear and a null in our composition.

Audio Amplitude in After Effects

Press U on the keyboard to see all of the keyframes.

See all keyframes keyboard shortcut in After Effects

As you can see, it gave us the Left Channel, the Right Channel and Both Channels.

All audio channels in After Effects

I am going to get rid of the Right and Left Channels by first selecting them and then pressing delete.

Delete right and left audio channel in After Effects

I now only have Both Channels.

Both channels in After Effects

Next, I am going to create a text in my composition. So I am going to write just something like value inside of my composition, but you can write anything you want.

Write value inside of my composition in After Effects

And I am going to go inside the value text layer and select its Source Text.

Select Source Text in After Effects

Hit S twice on my keyboard to solo it.

Solo text source in After Effects

Then I will click on the stopwatch icon to activate the expression.

Activate the expression by clicking on the icon stopwatch in After Effects

Now I am going to set some variables inside of the text box.

First, I am going to say, audio you are going to be and then I will pick-whip to the [Audio Amplitude] slide like so:

Pickwhip to Audio Amplitude in After Effects

audio = thisComp.layer(“Audio Amplitude”).effect(“Both Channels”)(“Slider”);

This will create a random variable, I will call it n and n will equal an empty string.

audio = thisComp.layer(“Audio Amplitude”).effect(“Both Channels”)(“Slider”);

n = “”;

Next, I am going to do a For loop.

So I am going to say for() and inside of the parenthesis, I am going to say i = 0 and then as long as i is less than audio, we are going to run an expression. Lastly, we are going to increase i by one with each loop. Then we will write our expression inside of the curly brackets.

audio = thisComp.layer(“Audio Amplitude”).effect(“Both Channels”)(“Slider”);

n = “”;

for(i=0; i<audio; i++){

}

Inside of the curly brackets, I am going to say n, you are going to += i.

audio = thisComp.layer(“Audio Amplitude”).effect(“Both Channels”)(“Slider”);

n = “”;

for(i=0; i<audio; i++){
n += i;
}

Stay with me! I hope I did not confuse you there. Let’s now see what happens.

Audio Meter in After Effects

As you can see, in a way it created like an audiometer. So if I drag through it with my time indicator, you can see it is kind of interesting, but what happens if we replace this i for like a string, maybe a lowercase L.

audio = thisComp.layer(“Audio Amplitude”).effect(“Both Channels”)(“Slider”);

n = “”;

for(i=0; i<audio; i++){
n += “l”;
}

Lowercase l in After Effects
So now it looks more like an audiometer! It does not show random numbers anymore like it did in the previous example. Instead, it displays lowercase L, which looks a lot like an audiometer!

Let’s keep going. Because the string is text, now we can go into these Character Options and play with them.

Character Options in After Effects
We can bring text closer together.

Closer together in After Effects
We can scale the whole thing.

Scale text in After Effects

We can make it fatter.

Make Text fatter in After Effects

Or skinnier.

Skinnier text in After Effects

So as you can see, the sky’s the limit with what we can do here but I think where I am at right now is probably fine.

Another cool thing about this is that we can disable the expression.

Disable expression in After Effects

and type lowercase L 15 times.

Type lowercase L 15 times in After Effects

The reason why I entered lowercase L 15 times because that is how long I want the audiometer to be.

I can now activate the expression again.

Activate the expressions in After Effects

A it will now take a value between 0 and whatever the highest one here, which is something between 18 and 19. Then it will create these bars.

Taking the highest value in After Effects

But how can I restrict it to where it only goes up to a certain number? Let me show you.

I am going to type a Linear Expression, so I am going to say audioFix you will be linear() and I will plug in the audio inside of the parenthesis. I also want 0 to be my minimum value and I also want it to go up to 20 just to be safe. So it is going to go between 0 and 20. It will not go any higher or lower.

audio = thisComp.layer(“Audio Amplitude”).effect(“Both Channels”)(“Slider”);

audioFix = linear(audio, 0, 20)

n = “”;

for(i=0; i<audio; i++){
n += “l”;
}

And then I want to convert it from 0 to 15 because we have 15 bars. So it will not go more than 15 bars. That should be good.

audio = thisComp.layer(“Audio Amplitude”).effect(“Both Channels”)(“Slider”);

audioFix = linear(audio, 0, 20, 0, 15);

n = “”;

for(i=0; i<audio; i++){
n += “l”;
}

Then where it says audio in our code, I want to change that to audioFix like so:

audio = thisComp.layer(“Audio Amplitude”).effect(“Both Channels”)(“Slider”);

audioFix = linear(audio, 0, 20, 0, 15);

n = “”;

for(i=0; i<audioFix; i++){
n += “l”;
}

If I let go, it is still going to do the same thing but this time it is going to stay within 0 and 15 bars.

So you definitely get an idea of how to set something like this up. You can keep altering things as you like. For example, you can say instead of 0 maybe you want to start at like 5 and it is going to start at 5 and go up to 20.

audio = thisComp.layer(“Audio Amplitude”).effect(“Both Channels”)(“Slider”);

audioFix = linear(audio, 5, 20, 0, 15);

n = “”;

for(i=0; i<audioFix; i++){
n += “l”;
}

So you can kind of adjust which peaks you want and how many bars you want. You can also change 15 to say 25 and now we are seeing a lot more bars in our audiometer.

audio = thisComp.layer(“Audio Amplitude”).effect(“Both Channels”)(“Slider”);

audioFix = linear(audio, 5, 20, 0, 25);

n = “”;

for(i=0; i<audioFix; i++){
n += “l”;
}

Seeing more bars in After Effects audiometer

This thing is definitely not perfect but I just want to show you how awesome expressions are and just another way to create an audiometer using text.

I hope you found this post useful. If you would like to learn more about Expression and how it can speed up your workflow in After Effects, check out my Learn After Effects Expressions Course.

Download Project File

About the author:

Sergei Prokhnevskiy

Sergei Prokhnevskiy is a Charlotte, NC based motion graphics designer, an online tutor, an entrepreneur, and Adobe MAX Master Speaker. Sergei is known for his quick and practical After Effects tips and tricks on YouTube, where he generated well over 6 million views on his tutorials. He has authored an online video course on After Effects Expressions and developed scripts for After Effects. He is also a former senior motion graphics designer at Fox Sports where he worked on graphics for NFL, Super Bowl, MLB, World Series, College Football, NASCAR, Women’s World Cup, and NASCAR Race Hub. He is very passionate about learning and teaching others.

5 FREE TIME-SAVING TOOLS

Over 100,000 downloads & counting!

These 5 After Effects tools will seriously speed up your workflow and save you hours of wasted time. More than that, they could be the difference between being able to complete a project on time or not!