Search code examples
javascripthtmlthree.jsweb-audio-api

Cross application audio analysis with the Web Audio API


I am writing an audio visualizer application using the web audio api and the three.js library. I've had a lot of success using the html5 element to get audio from a local mp3 or a streaming mp3 file with the createMediaElementSource() method from the AudioContext object, but I was hoping my user would have the ability to visualize music from their itunes or Spotify apps as well. I've briefly touched on the 'audio jack api' but most of the documentation is over my head as I have no experience with programs written in any languages prefixed with a 'c' :P. All I know and have the time to learn at the moment (as this is a curricular project) is more ruby and javascript. Any and all input is much appreciated!


Solution

  • There's no "built-in" way to do this. (On purpose, actually, because it raises a lot of security and privacy concerns.) It's possible to set up a loopback audio driver on a client's machine, and use that as the audio output device for Spotify or iTunes, and capture its input in Web Audio; that's not a great end-user solution, though, of course.