Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript - Get Sound Data

I'm wondering if any new HTML5 functions or existing JS library would allow me to access information about the sound that's currently playing in an Audio object. For example, I'd like to be able to access an array of ranges the a song is currently playing at (that is, low values appear for deep bass sounds and higher values appear for shriller sounds). I'm not a sound engineer, so I'm not quite sure what the correct terminology is.

A comparable library would be the C++ BASS library (http://www.un4seen.com/), although I certainly don't need the same breadth of functionality.

I did a little more digging around and found this: chromium.googlecode.com/svn/trunk/samples/audio/visualizer-gl.html It's pretty much what I'm looking for, but I can't figure out how it works. Thoughts?

like image 503
Will Avatar asked Sep 23 '11 03:09

Will


1 Answers

  • The chromium visualizer uses the Web Audio API.
  • Firefox offers the Audio Data API.

These are the two options available at the moment, and they're not compatible with each other. Eventually an agreement will be reached.

If you intend to do something cross-browser, you're condemned to using Flash for now, there is a pretty good library called SoundManager2 that gives you the necessary data. Check out their visualization demos.

like image 95
Ricardo Tomasi Avatar answered Sep 29 '22 05:09

Ricardo Tomasi