All Articles Motion
Animating to Audio: Creating a Spectrum Analyzer in Motion 5
David Smith on Sun, August 26th 3 comments
The Motion vs After Effects debate is becoming more and more prevalent amongst video artists. David Smith demonstrates how, despite its different way of working, Motion can create a spectral analyzer.

As someone who regularly teaches courses in both After Effects and Motion, I am often asked what the differences are, and what application is better. One of the primary differences between the two is the use of Keyframes in After Effects and the use of Behaviors in Motion. This article explores one of my favorite behavior workflows in Motion, its called Parameters. 

The effect we are going to create is to build an Audio Spectrum Analyzer, then have it animate to a piece of music so that it responds to various frequency ranges. So lets begin. 

Step 1 - Draw a Rectangle Shape

In a new project select the Rectangle Tool, press R and draw a rectangle in the Canvas. 

Rectangle drawn

We will need four more of these, which we will duplicate. First though, let's make the rectangle look more like a Spectrum Analyzer.

Step 2 - Create a Gradient

Press F5 to open the Project pane and select the rectangle. Then press Command-3 to open the Inspector pane thus accessing the parameters for the selected rectangle. Four tabs are available: Properties, Behaviors, Filters and a contextual tab that changes depending on what you are working with. In this case it says Shape. 

Fill Gradient

In the Shape tab, under the Style options change the Fill Mode from Color to Gradient. A generic gradient will now fill the rectangle. 

Step 3 - Edit the Gradient

Click on the disclosure triangle under the Gradient to reveal the gradient editor. Select the first stop under the gradient editor and using the Color option set the color to R: 236 G: 53 and B: 37. This add a bright Red, that will represent Audio Peaks in the Analyzer.

Then set the Second stop to a color of R: 118 G: 244 and B: 22 which adds a bright green to the main part of the Analyzer. To finish the look, drag the mid point between the two stope to the left so the Green is more prominent, and the Red area is only at the top part of the rectangle.

Gradient Editor

Step 4 - Duplicate the Rectangle

Now that the Rectangle is set to look the way we want, we need four more. Press Command-D to duplicate the shape, and move the duplicate to the right to start creating a row. Repeat this process until there are 5 rectangles spaced out across the screen in a row.


Step 5 - Align and Space

It's possible to keep the five shapes in line, and spaced equally as they are moved, however accuracy is important. Select all the shapes, either in the Project pane or in the canvas. 

Open the Object menu and select Alignment > Distribute Horizontal Centers (you can also use Align Vertical Centers if necessary). The rectangles will be lined up and equally distributed, ready for the next stage.

Distribute Menu

Step 6 - Add a Mask

Select only the first rectangle, then pick up the Rectangle Mask tool. Use the tool to draw a rectangular mask over the first rectangle, ensuring the mask is slightly larger than the shape it will cover. 

Draw mask

The shape will still be visible, but that will soon change. 

Step 7 - Invert the Mask

In the Inspector pane (which if it's not already visible press Command-3 to open), the contextual tab will have the Mask options visible. 

Mask Options

Click on the Invert Mask option to invert the mask and make the rectangle shape disappear. It is the animation of this mask that will create the effect needed for the Spectrum Analyzer. 

Step 8 - Add More Masks

Repeat step 7 until each of the rectangles is hidden. 

Step 9 - Add an Audio Track

OK so the Animation is about ready to start, but first we need something to animate to. Press Command-1 to open the File Browser and browse for an Audio file. It's important that the Playhead is set to the first frame of the project before you import the audio. Press the Home key to make sure it is. (Fn-Left Arrow on a laptop). 

Audio File Selected

With the Audio file selected press Import at the top of the File Browser. This will add the Audio track to the timeline at the start of the project. 

Step 10 - Add Behaviors to Animate a Mask

Using the Project pane, click on the disclosure arrow next to the first rectangle and select the Rectangle Mask. Open the Inspector pane and choose Properties or press F1. We are going to animate the Position parameter so that the Mask moves up and down on the Y axis. 

Add Parameter

Control-Click or Right-Click on the Position Parameter and from the menu that appears choose Add Parameter Behavior > Audio. This will add the Audio parameter, and open the Behaviors tab that contains the Audio options. 

Step 11 - Set Audio Parameters

In the Audio Behavior settings set the Source Audio to your audio track by selecting it from the To drop-down menu. 

Audio Graph

Use the handles on the Horizontal axis on the Audio Graph to limit the range of the Audio Parameter applied to the mask to the lower frequencies of the track. 

Step 12 - Adjust the Parameter Scale

This Audio parameter will now animate the mask, however it's unlikely to animate the mask by any great amount. We need the mask to move much more substantially. 

Set the Scale slider up to 195 (TIP: a negative number would make the mask move in the opposite direction) and the mask will start to move the amount we need. Feel free to experiment with this value. Also to ensure the mask only moves on the Y axis set the Apply To option to Properties > Transform > Position > Y

Range Scale

Step 13 - Add More Animation

Select each mask in turn and repeat steps 10 - 12 so that each one animates. Make sure that each mask is set to a different Horizontal range in the Audio Graph, Medium Frequencies, High Frequencies etc.  Otherwise all the masks will animate to the same parameters. 

Audio Graph Ranges

Step 14 - Playback and Experiment

Play the animation, pretty cool huh? If any of the masks don't animate enough, or perhaps animate too much, experiment with the Scale setting in the Behaviors tab. 

Motion really is a lot of fun to work with. As you may have noticed, we didn't use a single keyframe in this exercise, making this a particularly fast workflow. In future, if you're looking to do this again, try creating and animating just one rectangle. Then duplicate the rectangle along with its animated mask and change the Audio Graph range for each duplicate. This will make the job even quicker next time.

Related Videos
Comments (3)

You must be logged in to comment.

  • Jupygou
    Great tutorial, David! I had no idea Motion could do this. Wish there was a video to show this effect in action, though. Can't wait to play around with this technique. Thanks again!
    • 8 years ago
    • By: Jupygou
  • David Smith
    Ok the video should be up any moment.
    • 8 years ago
    • By: David Smith
  • AthensBoy
    Great tutorial, but I ran into a slight problem that I can't seem to figure out. Originally, I had the project set for ten seconds. I later expanded it to the full length of the song. However, beyond the initial ten seconds, the animation freezes. I have tried everything I can think of, including deleting the behavior and reapplying it,in addition to searching for the issue online and have come up with nothing. Does anyone have any suggestions as to what I'm missing for this to be happening? Thanks!
    • 8 years ago
    • By: AthensBoy
The ART of DJing
DJ Skills and Performing 101
Dream It. Do It.
Do you want to learn The ART of DJing?
Yes, I want to learn!
No Thanks, I just want to read the article.
Course Advisor
Don't Know Where To Start?
Ask A Course Advisor
Ask Us!
Copy the link below and paste it into an email, forum, or Facebook to share this with your friends.
Make money when you share our links
Become a Affiliate!
The current affiliate rate is: 50%
Classes Start Next Week!
Live 8-week Online Certification Classes for: