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.
Meanwhile, might come in handy. Please note I have 0 experience with Adobe products but I was curious enough to google some.
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.
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
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.