Saturday, March 7, 2009

Sound Spectrum Using Flash ActionScript 3.0

Working with the sound functions in Flash ActionScript 3.0, it took some work to understand the Sound, SoundMixer, SoundChannel, and SoundTransform classes. My goal was to use a sound object to animate other display objects. I found a few examples that applied sound spectrum functions, so I started by looking at Lee Brimelow's Sound Spectrum Display tutorial on his excellent Flash tutorials site,

I created a SpectrumTest class for manipulating the animation and sound object, which worked out well. Using an EnterFrame event handler, the function draws colored circles along a linear path representing frequency, and the size of the circles is derived from the values extraced from the SoundMixer's computeSpectrum function.

The first iteration displayed the animated objects in spectrum along a horizonal axis.

I decided to change the orientation of the spectrum along a vertical axis, so I modified the function. Additional controls include a play button and a volume slide bar. I also wanted to view the media load process, so I added a media progress bar along the top. You can view the Flash movie here:

This was a good learning experience for me, and didn't take too long to produce.

The song I used for this project is All Of Your Love by Aphek, an artist I enjoy listening to on

Download for this Flash project (song not included):

Aloha, Joe

No comments:

Post a Comment