Subscribe

  • Subscribe  

How to Get Sound Spectrum Information with AS3?

Posted by Jay | April 30, 2008 .

These days’ sound files are being readily introduced to jazz up the web pages. Once we have the preferred tracks onto our site many of us may be tempted to try our hands at creating visualizations similar to the look and feel of popular media player applications. In order to display such visualizations it is necessary to gain the related sound spectrum information.

Now if you were thinking that getting this information with AS3 is a tough ask, then you will be surprised find out that all you need is to write is just few lines of code and your are done. AS3 allows you to effortlessly generate sound spectrum information by taking the help of the SoundMixer class. This class contains the computeSpectrum method which when called makes a copy of the sound file and stores in form of normalized floating points in the output array. The output array (ByteArray) incidentally has a size of 512 with the initial 256 values being designated for the left channel and the remaining 256 designated for the right channel.

To begin with you would need to invoke the computeSpectrum method and then store this data into a ByteArray instance as shown in the following bits of code

var ourspectrum:ByteArray = new ByteArray();

SoundMixer.computeSpectrum(ourspectrum);

This information then can be readily used to create visualizations.

Leave a Comment

If you would like to make a comment, please fill out the form below.


Name

Email

Website

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Comments

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word


Related Posts

1 Comment so far
  1. Jimmy Eaken  May 12, 2008 7:37 am

    I bought a one year subscription for my son, but his computer was down and he did not get it.
    Would you check and see what i need to do to get you to re-send the download to them?
    their address is: jcouey1@cox.net
    thank you Jimmy Eaken.
    my address is: jeaken@centurytel.net

<

Direct TV Offers - usdirect has the best directtv deals