Re: is sampling audio input possible?

On 30/11/2011 17:58, Stephen Bannasch wrote:
 > I'd like to be able to sample and display both amplitude and frequency
 > domain representations of audio input from an audio source.

If by "audio source" you mean the HTML <audio> element, then yes that is 
an example of the kind of thing that is possible with the proposed Audio 
APIs. I believe the Mozilla API will allow access to the amplitude data 
(the samples of the audio stream themselves) which you can then 
transform to a frequency domain representation using a javascript FFT 
implementation. I think the Webkit API as currently implemented does not 
give access to the audio samples, but does allow you to set up a block 
to calculate the spectrum (using an FFT).


If you wish to capture audio from the browser, you'd need the 
getUserMedia API 
(http://www.whatwg.org/specs/web-apps/current-work/multipage/video-conferencing-and-peer-to-peer-communication.html), 
the current support for which is very patchy (I think Opera have a 
partial implementation, and I heard Erricson were working on something 
too but haven't released it).

In the meantime, we've had some success with a Flash shim which allows 
audio input from the microphone: https://code.google.com/p/wami-recorder/

Hope that helps and that others can fill in the details or correct my 
mistakes!

Cheers,

Chris

Received on Thursday, 1 December 2011 14:03:18 UTC