SoundMixer + ByteArray

As I was writing a prototype for a voice-driven user interface, I ran into a wall. I was convinced that I could analyze a sound’s frequency spectrum with ActionScript 3. It turn out that the awesome SoundMixer.computeSpectrum(), which implements the Fast-Fourier Transformation, can only sample currently played sounds. It cannot be supplied a ByteArray, such as microphone data.

I do not see any reason why feeding a ByteArray to SoundMixer.computeSpectrum() would not be allowed. I would appreciate if Adobe would supply the SoundMixer’s source code to the public so that I may implement the missing feature, instead of reverse engineering the whole class.

Edit: Robin Millette found a library packaged as a SWC that I could easily inject into my prototype. Here is the app and source.

Try to speak, whiste, blow into the microphone or clap your hands to see different results. Every bar represents a half-octave.

4 thoughts on “SoundMixer + ByteArray

  1. Meanwhile, http://code.google.com/p/in-spirit/wiki/ASFFT might come in handy. Please note I have 0 experience with Adobe products but I was curious enough to google some.

  2. I’ll check that one out. I found a large number of alternative FFT classes but most of them are written for old versions of AS or do not compile.

  3. Noah

    Hi Anna,

    Great little app you’ve built there! I’m building something and I want it to detect and separate pitches, so low notes will affect one thing while higher notes affect another. I’ve downloaded Robin’s swc which looks promising, but I haven’t been able to find any documentation on how to use it… would you be able to point me in some direction? Meanwhile, I will keep hacking at it…

    Cheers!

    Noahdecoco

  4. I didn’t find any documentation beyond what is on their main page. I had to figure most of it out by myself. Download my example’s sources. Maybe it will be helpful if you see how I used it.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">