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
Compositing Secrets Everyone Can Use: Pt. 3 - Alpha Channels

Compositing Secrets Everyone Can Use: Pt. 3 - Alpha Channels

When most people hear the words "alpha channels", they think "transparency", but that's not exactly accurate. The truth is more complex, and a quite bit more interesting! Join longtime VFX artist, editor, software developer, and business owner Simon Ubsdell for Part 3 of the best look behind the technology of compositing that you've ever seen, packed with practical advice for applying the secrets of alpha channels that's simply not possible before understanding these underlying principles. No matter which applications you're using for editing, compositing, or visual effects, this one is a must-see!

Tutorial
Simon Ubsdell
Adobe After Effects
Compositing Secrets Everyone Can Use 2: Advanced Blend Modes

Compositing Secrets Everyone Can Use 2: Advanced Blend Modes

Whether you're a full-time compositor and VFX artist, an editor working in one of the many NLEs that supports Blend Modes (including Adobe Premiere, Apple FCP and FCPX, Avid Media Composer, DaVinci Rsolve, and VEGAS Pro), or whether you just want the additional graphics power that comes with insight into the secret world of pixels, this is the tutorial for you! Join longtime VFX artist, editor, software developer, and business owner Simon Ubsdell for Part 2 of the best look behind the technology of blend modes that you've ever seen, with some practical steps you can start taking today to make your work look better than ever.

Tutorial
Simon Ubsdell
Adobe After Effects
Compositing Secrets Everyone Can Use: Pt. 1 - Blend Modes

Compositing Secrets Everyone Can Use: Pt. 1 - Blend Modes

Join longtime VFX artist, editor, software developer, and business owner Simon Ubsdell for the best look behind the technology of blend modes that you've ever seen. This isn't just for graphics and VFX, but for video editors too -- anyone who puts anything together, and wants to learn more about HOW images combine at the most basic level, in a way that applies to every application you might use, whether Adobe Premiere Pro, Apple FCPX, Avid Media Composer, DaVinci Resolve, VEGAS Pro, and yes, graphics and VFX programs like After Effects, Motion, Fusion, Nuke, Scratch, and many more.

Tutorial
Simon Ubsdell
Adobe After Effects
Disintegration VFX in Adobe After Effects

Disintegration VFX in Adobe After Effects

Join VFX guru Tobias Gleissenberger of Surfaced Studio for a classically energetic Adobe After Effects tutorial combining difference mattes, displacement maps, edge glows, and compositing tricks to dissolve (or explode!) one element in your frame while leaving the rest alone.

Tutorial
Tobias Gleissenberger
Adobe After Effects
Adobe After Effects: Common QT & Export Problems & Solutions

Adobe After Effects: Common QT & Export Problems & Solutions

Problems with Adobe After Effects? Can't import or export QuickTime videos? Exports too big? Missing codecs? AE guru and VFX whiz Tobias Gleissenberger of Surfaced Studio has the answers you're looking for to make every project come to completion more smoothly, including a comparison of exported file sizes for common codecs.

Tutorial
Tobias Gleissenberger
Adobe After Effects
Fancy Title Animations In Adobe After Effects -- FAST!

Fancy Title Animations In Adobe After Effects -- FAST!

Follow along as VFX guru Tobias Gleissenberger shows you how how to quickly create professional-looking animated text elements using the free presets that are included with Adobe After Effects, customizing them to suit your needs. Tobias will also show you how to apply masks to your text layers to have them appear from behind other elements.

Tutorial
Tobias Gleissenberger
Adobe After Effects
Remove People from Moving Video in After Effects with Mocha

Remove People from Moving Video in After Effects with Mocha

Learn how to remove a person from a moving video using the Remove module of the Mocha Pro plug-in for Adobe After Effects! In one of his most epic tutorial's yet, Surfaced Studio's Tobias Gleissenberger then adds a bonus Beam Up effect using some of the great filters from the Boris Continuum and Sapphire collections.

Tutorial
Tobias Gleissenberger
Adobe After Effects
Basic Clone Effect Interaction - After Effects Tutorial

Basic Clone Effect Interaction - After Effects Tutorial

Want to take your CLONE EFFECT to the next level? Want to know how to make your clones INTERACT? Tobias Gleissenberger shows you how.

Tutorial
Tobias Gleissenberger
Adobe After Effects
Adobe After Effects: Glitch Effects Without Using Plug-ins!

Adobe After Effects: Glitch Effects Without Using Plug-ins!

Join VFX guru Tobias Gleissenberger for a fun, high-energy look at how to create all sorts of digital noise, glitch, and other disturbing video effects with any version of Adobe After Effects, without using any plug-ins!

Tutorial
Tobias Gleissenberger
Adobe After Effects
Adobe After Effects Energy Ball

Adobe After Effects Energy Ball

In his latest high-energy Adobe After Effects tutorial, VFX guru Tobias Gleissenberger of Surfaced Studio combines a variety of effects to create the pulsating energy ball, composited with motion tracking, optical flares, and more.

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