Search code examples
javascriptaudioweb-audio-api

How can I get audio sample data with Web Audio API (WAAPI)


I'm working with the web audio API, I succeed listening to microphone and get data with the analyser (getFloatFrequencyData and getFloatTimeDomainData) but how can I get the original sample data before being modify/processed by the analyser?


Solution

  • The sample datas are not modified by the analyser, what you get from the analyser are the time domain and frequency domain datas. If you want to access / modify your datas in real time, you may use a script processor node, see : http://webaudio.github.io/web-audio-api/#the-scriptprocessornode-interface.

    If you want to record your data, you may use RecordJS : https://github.com/mattdiamond/Recorderjs.

    Underneath, RecordJS uses a script processor node, so just look at the code for an example. Basically it's quite simple to use, you get input datas and set ouput datas.