Simulated Flash Audio Spectrum Analyzer

Category: Adobe Flash Tutorials
Added: 05/02/2007
Views: 84,371

Simulated Flash Audio Spectrum Analyzer

Tutorial Goal

To code a Simulated Spectrum Analyzer for visual Audio representation using Adobe Flash and Actionscript. The analyzer accepts a spectrum object to define how the audio bars will react. This means you can adjust it to simulate different genres of music or audio levels. It is easy to change the color, size, the number of bars both horizontally and vertically, the spacing between them and their fading effect. We also code a function to turn the analyzer off.

// If we reach 0, it is time to get the next range from our spectrum array.

if(numLines == 0) curRange++, numLines = spectrum[curRange].n;;

}

}

// --------------------------

// Turning off the Analyzer.

// --------------------------

function turnOff(){

// Loop through the number of vertical lines.

for(var i = 0; i < tot_bars; i++){

var bar = this['bar'+i];

// Stop the animation.

delete bar.onEnterFrame;

// Loop through the number of bars on the line, except first one.

for(var j = 1; j < max_height; j--){

// Remove the bars.

var b = bar['bar'+j].removeMovieClip();

}

}

}

Step 5 : Changing the Analyzer Color and Size

More than likely you will want to change the size of the analyzer since it is quite large for a typical audio player. It's all vector based so we won't have a problem here.

Click on "Scene 1" to return to the Main Stage.

Select the anaylzer and open the transform pane.Window > Transform
Now change the scale to whatever you need.

You may also want to change the color. Here are two options:1. Change the "one_bar" MovieClip
Open the Library:Window > Library

Double Click the "one_bar" MovieClip and make any color and design changes you want.

2. Change the "Tint" of the Analyzer
With the analyzer MovieClip selected simply change the "Color" property to "Tint" and select a color.

Simulated Flash Audio Spectrum Analyzer : Conclusion

Change the "one_bar" MovieClip to create new visual effects. Very minor changes have dramatic effects. The Audio Spectrum Analyzer is a valuable feedback mechanism for your audio needs. Don't forget the power of MovieClips, since the analyzer is a completely self contained object you can transform, rotate, and distort it all you like and it will continue to work. Have fun!

Feel free to send Comments, Questions, and other inquires using the contact page. I hope that you enjoyed the "Simulated Flash Audio Spectrum Analyzer" tutorial. View more of my tutorials here.

Like My Work?

I am a professional freelance web developer & graphic designer. These tutorials are a small sample of what I'm capable of. Check out my client portfolio and feel free to contact me. Whether it's a full blown database driven web application or simply a flashy banner design, hire a professional.