SoundData: Facilitating Audio Visualization Experiments

March 31st, 2008 : Nik Rowell

UPDATE: I’ve discovered a serious flaw in this class… I plan to refactor things soon – stay tuned.

In an effort to simplify audio visualization experiments with ActionScript 3.0, I’ve developed a SoundData class. The class’s main attraction is centered around the flash.media.SoundMixer.computeSpectrum() method, but it also provides additional control over playback, including startSound(), stopSound() and toggle() methods. The class also allows manipulation over volume and panning.

Using the class in an experiment is a piece of cake. Simply instantiate it with the URL to the mp3 file you’d like to stream, and a few optional parameters:

import com.nikrowell.media.SoundData;
var sound:SoundData = new SoundData("myTrack.mp3", true, 0.9);

Begin playing the sound:

sound.startSound();

And obtain the spectrum data or other properties as needed:

sound.compute(true);
var float:Number = sound.read(200, 50);
sound.volume = 0.75;

A few important notes:

  • Although the SoundData.pan has been implemented, this version currently has unexpected results when combined with the compute() and read()
  • There is not yet control over buffering or preloading, making animations more prone to choppy starts.
  • Values passed to the pan and volume setter methods must be normalized. Passing 48 to the the volume will default to 1 (100%), and not 48%.

You can View the documentation or email me/add a comment for the source code - I'd love to see what you come up with!

Stay tuned for my first experiment with the new class - it will likely be a spin off of my previous post

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • ThisNext
  • Furl
  • Reddit
  • Slashdot
  • Technorati

Tags: , , ,


One Response to:
“SoundData: Facilitating Audio Visualization Experiments”

  1. a gravatarTechnology Translated » Blog Archive » Papervision3D DOES NOT meet SoundData, unfortunately

    [...] had every intention of using my recently released SoundData class in an experiment with Papervision3D. I got pretty far: Picked out a good Armin Van Buuren track, [...]


Leave a Reply:

Subscribe without commenting

  • Technology Blogs - BlogCatalog Blog Directory
  • Add to Technorati Favorites
  • Blog Directory
  • blogarama - the blog directory
  • Blogging Fusion Blog Directory