Audio Spectrum Analysis in JSON

I have been unsuccessful so far in syncing animation drawn in canvas using Processing.js & audio played using the browser audio tag with audio spectrum data I create from a ByteArray in Flash. It works in Flash due to the fact that the spectrum analysis and animation are executed together in an onEnterFrame event. The drawback to not having real time audio spectrum analysis from within the browser is the need to supply all the data to Processing.js at initialization. It can be rather large and I have yet to perfect syncing the reading of the array with the current time of the audio. Some sort of progressive data stream and excellent timing system?!?

It may be I just have to wait until this feature is implemented into browsers. In the meantime, I thought I would post the source for the the Spectrum Analysis tool I created for anyone wanting a quick way to get some data from their favorite tune and perhaps figure out a way to use it in a optimized fashion. The tool is very simple and outputs JSON with Left and Right channels as floating point numbers between 0 and 1.

You can use it to make stuff move to the groove. It has a simple execution of this in the ui for you to see. Download the Flash and PHP and throw it on your local server.

The process of accessing audio data from within the browser is quite beyond me, I really just want to see what I can create visually in Processing.js and canvas. Until it’s available in an easy-to-use API, I just have to keep looking for a way to get spectrum data quickly, hence this contraption. Have fun.

Like it? Share it

Share on LinkedIn

Share on Google Plus