LIBRARY: Tutorials Reviews Interviews Editorials Features Business Authors RSS Feed

Creating an Audio LED Meter

Creating an Audio LED Meter


A CreativeCOW After Effects Tutorial

Creating an Audio LED Meter

Roland Kahlenberg

Roland R. Kahlenberg, Singapore, Singapore
Video * Motion Graphics * Original Music



Article Focus:
In this tutorial, Roland Kahlenberg demonstrates creating an 'as real as you want it to be' audio LED meter using Motion Math and Expressions. At the bottom of the page is a sample of its use in Roland's demo reel -- just to give you a 'real world' example.


Download Project Movie Project file Download Stuffit Expander for Windows

 Prerequisites - Stuff you should know before attempting to follow through with this tutorial.
  1. Expression Basics including vector Math addition and subtraction
  2. Applying MotionMath (There's an Expression script provided below for those without the PB)

Things you'll need to work on the tutorial:

  1. Audio File (not included)
  2. A wide eye and a fresh pair of brains (no worries, I was merely referring to the left and right ones)

Today, we'll be creating an "as real as you want it to be" audio LED meter. This tutorial uses a number of Expressions that aren't that difficult. The interpolation script that I've used here was 'borrowed' from JJ Gifford's on-line site at http://www.jjgifford.com/expressions/basics/interpolation.html. You too can be decently successful in integrating some Expression scripts into your work. If you haven't done so yet, then I'm hopeful that this tutorial will help to get you started.

Another good reason to get into Expressions is that you can easily use a single Expression and apply it in many other ways to create other cool effects.

Let's begin by examining the 'physics' of an LED meter. It's made up of equal-sized discrete rectangles. The conventional LED meter is usually strung from bottom to top. A loud audio track will light up most of the rectangles, while a softer one will only light up those on the lower rungs. And if the audio file has a silent spot, then none of these rectangles will be lighted. Given these characteristics, we'll try to emulate this 'real-world' phenomenon. There are obviously other stylistic adaptations of an LED meter.

We'll need a few thingies - rectangles, an audio file, and not so obvious is a "controller" layer. The "controller" will accept audio level information from the audio file (via MotionMath Script, layeraud.mm - ships with the AE Production Bundle only). For those without the Production Bundle, all is not lost. You can use the following Expression to move the Controller along its y-axis.

//Start
(position[0].position.wiggle(3,200)[1])
//End of Expression

Checkout the AE manual for info on the wiggle function so that you can control the movement of the Controller better.


1) Create a new Comp (100 x 240)

2) Create an 80x4 pixel layer and name it "Controller" - Set its position to (70,120)

3) Create a 40x10 layer and name it "Rectangles" - Set its position to (50,235) so that it sits at the bottom of the Comp Window.

- We will be duplicating this layer once we've written the necessary Expressions

4) Drop your audio file into the timeline

Note - Ensure that all files start at the same point on the timeline.

5) Let's apply an Expression to our rectangle's opacity so that it's level at any point in time is dependent on the Y-POSITION of the "Controller" layer. To do this, apply an Expression to the opacity of layer "Rectangles". Type in the following -


PosA = position[1];

// this statement creates a variable, PosA, that refers to this layer's y-position

CntrlPos = this_comp.layer("Controller").position[1];

// this statement creates a variable, CntrlPos, that refers to the "Controller"'s y-position

delta = sub(PosA,CntrlPos);

// this statement creates a variable, delta, that subtracts the current layer's position from that of the Controller layer.

distance = length(delta);

// this statement creates a variable, distance, that returns the result of the delta = ... statement.

length is a built-in Expression function that calculates distances

if (delta>0)

opacity = 100

// This section of the "if ... else" conditional statement checks to see if the Controller is higher (y-position) than the current active layer. If the controller is higher, ie. closer to the bottom of the comp, then the current layer's opacity should be set to 100%. Remember that AE calculates [x,y] positions starting from the top left-hand corner of a Comp Window. It's a little counter-intuitive, so sketch out the problem to have a better idea of what's going on here.

else

linear(distance, 0, 30, 100, 40)

//if the first line is not true, then we'll apply a linear interpolation between the distance of layer Controller and the current layer. Basically we're remapping the values of the distance between the two layers and applying the result towards our opacity. This is done in a linear fashion. To ease in, use the following line instead:

ease_in(distance, 0, 30, 100, 40)

When the distance is 0, the opacity of our rectangles will be 100%. When the difference is 30 or more, then the opacity will be set at 30%. This ensures that our rectangles will have an opacity value of at least 30% at all times. If you want the rectangles to be totally off until it's 'hit' by the controller then simply change the last line to - linear(distance,0,30,100,0).

6) The Expression in its entirety reads as such;

PosA = position[1];

CntrlPos = this_comp.layer("Controller").position[1];

delta = sub(PosA,CntrlPos);

distance = length(delta);

if (delta>0)

opacity = 100

else

linear(distance,0,30,100,40)


7) Now, mass-duplicate the layer "Rectangles" and offset each one to create a ladder of rectangles.

8) To test our script, we'll manually move the y-position of our Controller layer. Open up the position parameter in your timeline for the Controller layer by selecting the layer and pressing the "P" key. Now manually move the Controller up along the y-position. Alternatively, you can select the Controller (object) in the Comp Window, depress the Shift Key (to restrict the movement to the y-axis) to physically move it along the y-axis. As you do so, you should notice that the opacity of each rectangle reacts to the movement of the Controller.

9) With everything in place, we'll now apply MotionMath script, layeraud.mm, to the Controller layer's y-position. You may have to finesse the min. and/or max. ranges within the layeraud.mm script to fine-tune the results.

Start with a min. setting of 240 (the lowest point in our 100x240) comp and max. setting of 0 - the highest point in our comp. Yep, that's right, we have to reverse the min. and max. settings - again to take into account the fact that AE calculates position starting at (0,0) from the top left hand corner of your comp.

Tip: If the Controller's motion path is bunched up within the middle of the comp, you can spread it out easily by changing the min. to a number higher than 240 and setting the max. to less than 0. And if the the top of the motion path maxes out too soon, you'll only have to change the max. setting to a lower number. This will 'stretch' the motion path while retaining the lower values.

10) You can dress up the rectangles with glows, bevels, textures - whatever your fancy is. I've included a tiny section from my partially completed demo reel as an example of how else to use the same Expression you've seen here. Pay attention to the red areas at top left and bottom right of the movie. Notice how the red buttons (Controller Layers) highlight the different rectangles as it moves up and down their respective y-axes. Each rectangle has a different word written on it. Instead of using an audio file to drive the button, I simply wrote an Expression to wiggle the button along the y-axis. Take a look by clicking on the graphic below.


That's it for now. Have fun and as always, God Bless.
 
###



Roland is a leader in the Adobe After Effects forum at CreativeCow.net.




Visit our forums and view other articles at Creativecow.net if you found this page from a direct link.




Related Articles / Tutorials:
Adobe After Effects
Imagineer mocha Pro 5 Plug-In for Adobe: An In Depth Review

Imagineer mocha Pro 5 Plug-In for Adobe: An In Depth Review

Imagineer mocha Pro 5 Plug-in for Adobe brings all the amazing features of the professional version of the mocha Planar Tracker directly into After Effects and Premiere Pro in the form of a plugin. In this in-depth review, After Effects tutorial guru Tobias Gleissenberger of Surfaced Studio will show you what you can do with this new plug-in, and discuss what he likes and doesn't like about the new update.

Tutorial
Tobias Gleissenberger
Adobe After Effects
After Effects 2015.3 - My Favorite Features

After Effects 2015.3 - My Favorite Features

Learn why you should upgrade to After Effects CC 2015.3 - 13.8.1 - a close and detailed look at the latest release of After Effects (August 2016). Roei Tzoref will be focusing on his favorite features that set this release apart from previous versions: Performance, Queue in AME, Lumetri Color new features, and more.

Tutorial
Roei Tzoref
Adobe After Effects
Advanced Masking in Adobe After Effects

Advanced Masking in Adobe After Effects

Some of the coolest stuff you can do inside of Adobe After Effects is only possible once you unlock the power of masks. Join After Effects whiz Tobias Gleissenberger of Surfaced Studio to learn about mask animation and interpolation, using the variable width feathering tool, managing mask modes and ordering, and more.

Tutorial
Tobias Gleissenberger
Adobe After Effects
Fixing Common After Effects Problems and Mistakes

Fixing Common After Effects Problems and Mistakes

Got problems using Adobe After Effects? Exported files too large, Expressions not working, mixing shapes and makes, modes/switches, selecting previews for layers vs. comps - Surfaced Studio's Tobias Gleissenberger shows you fast fixes for these and more!

Tutorial
Tobias Gleissenberger
Adobe After Effects
mocha AE Planar Tracker for Absolute Beginners

mocha AE Planar Tracker for Absolute Beginners

Want to learn how to create advanced visual effects? Learn how to use mocha AE to track your shot and add advanced visual effects to live action footage inside Adobe After Effects. mocha can help you track shots that would be hard to track using traditional 2D point or feature trackers because it is a PLANAR TRACKER. A planar tracker uses planes and textures to track as opposed to points or groups of pixels. This allows the tracker to stay on track even if your shot contains motion blur or a very shallow depth of field. mocha AE comes included with Adobe After Effects and is available since CS3 and there is no reason for you not to use this awesome tool to make it easier for you to track your shot, replace screens or rotoscope!

Tutorial
Tobias Gleissenberger
Adobe After Effects
How to Make After Effects Faster with Proxies

How to Make After Effects Faster with Proxies

Learn how to make Adobe After Effects faster by using PROXIES! A proxy is a placeholder that stands in place for a very large video file or image sequence in your project. You can easily create proxies for the large source files that you are using and After Effects will automatically link them to the item in your project panel.

Tutorial
Tobias Gleissenberger
Adobe After Effects
Stabilize & Smooth: mocha 5 Plug-in for Adobe & Avid

Stabilize & Smooth: mocha 5 Plug-in for Adobe & Avid

Imagineer Systems and Boris FX product specialist Mary Poplin shows you how to stabilize with the new mocha Pro 5 plug-in inside of Avid Media Composer, Adobe Premiere Pro and After Effects. This tutorial covers artistic stabilization, such as smoothing out camera movements or stabilizing around moving objects, completely locking down shots, and automatically replacing edge fill on planar backgrounds.

Tutorial
Mary Poplin
Adobe After Effects
Adobe After Effects Puppet Tool

Adobe After Effects Puppet Tool

Become a puppet master by learning how to use the Puppet Tool in Adobe After Effects! This intermediate-level tutorial from After Effects guru Tobias will show you how the Puppet Tool allows you to add joints and animations to bring life to any static image!

Tutorial
Tobias Gleissenberger
Adobe After Effects
How to Spawn A Clone in Adobe After Effects

How to Spawn A Clone in Adobe After Effects

Want to learn how to create a cool clone spawn effect in Adobe After Effects? Follow along with After Effects whiz Tobias from Surfaced Studio in this exciting new visual effects tutorial that combines green screen using Keylight, CC Vector Blur, the Liquefy Effect, CC Particle World, and much more, delivered in Tobias' inimitable style!

Tutorial
Tobias Gleissenberger
Adobe After Effects
Creating A Flame on Your Finger with After Effects

Creating A Flame on Your Finger with After Effects

It is easy to do some motion tracking and attach a basic stock footage element of fire onto your hands, but there is a little bit of work involved if you actually want to make it look good. In this intermediate tutorial by After Effects expert Tobias, you'll see how to use a fire stock footage element to set your thumb on fire! There are lots of useful tricks for null objects, expressions, and more in this tutorial that will help you create all sorts of other cool visual effects -- or set even more things on fire!

Tutorial
Tobias Gleissenberger
MORE
© 2016 CreativeCOW.net All Rights Reserved
[TOP]