Spectrum Analyzer in After Effects

If you want the CS 5.5 version of this After Effects preset for Satya’s tutorial on Spectrum Analysis in After Effects using the standard plugins that come with standard install without employing the use of Trapcode or other plugins:

Create a Sound Reacting 3D Waveform Animation without 3rd Party Plugins

I’ve made it and is available for download here:

Spectrum Analysis CS5.5 Preset

Thanks Satya! This was an excellent tutorial.

Here’s the expression to get the sampleImage :

p1 = toComp(effect("Top Left")("Point"));
p2 = toComp(effect("Bottom Right")("Point"));
w = Math.abs(p1[0] - p2[0]);
h = Math.abs(p1[1] - p2[1]);
a = toComp(transform.anchorPoint);
l = effect("Spectrum Layer")("Layer");
s = l.sampleImage(a, [w/2, h/2]);

Put this in your Presets folder, you’ll need Admin access. Open After Effects, create a new Comp. Add a new Null object. This preset will default to *Animation Presets in the Effects & Presets panel (Ctrl-5). Drag it on to your Null object and set the Spectrum Layer selection box to the layer that has the image you want to sample. Drag and alter the Null object’s position and scaling. Also don’t forget to change your Anchor point to (50,50). You can change s[3]*100; to be what ever parameter you want.

The number in the square brackets mean :

0 – Red
1 – Green
2 – Blue
3 – Alpha

Which is just an index into an array of numbers representing the average value of the spectrum range as defined by the Null object top-left and bottom-right boundaries. This example illustrates the extracting the Alpha channel sample and its value between 0 – 100.

That’s it I think.

*UPDATE – 14/04/2015*
This script should still probably work with the latest version of After Effects CC but I’ve updated it and added a few more expression sliders to control the RGB + A channels independently and also added a new ‘Average Colour’ control. I’ve also abstracted the spectrum analyzer logic with the visualizer logic to try and tidy up the layer structure and hopefully make it a little more modular and easier to amend and adapt.

I’ve also included an example After Effects project to demonstrate how to use this preset.

Download all the files here:
After Effects CC2014 Animation Preset : Spectrum_Analysis_CC2014.ffx
After Effects CC2014 Demo Project : Spectrum Analysis

This After Effects example used The Trapcode3d Stroke Plugin from Red Giant Software. You can get a trial version here: https://www.redgiant.com/products/trapcode-3d-stroke/

This music track I used from from Free Music Archive http://freemusicarchive.org/genre/Dubstep/ It’s called “Quaro”, by Summon.

Here are some videos I made using this demo:

to download please right click here

This next video, I made using the Trial version to test that I could download everything myself and get this working. If you need assistance let email me.

p.s. I like the way this animation automatically creates the treble and bass clefs.

You must be logged in to post a comment.