0.0.3 • Published 9 years ago
process-web-audio-mic-stream v0.0.3
An easy to use function that takes the boilerplate out of processing Web Audio microphone data.
Usage example
var processWebAudioMicStream = require('process-web-audio-mic-stream');
processWebAudioMicStream(function(audioData) {
var amplitude;
for (var i = 0; i < audioData.length; i++) {
amplitude = audioData[i];
if (amplitude > 0.9) {
console.log('Oh No! Too loud!');
return;
}
}
}).then(
function() {
// User has accepted the use of the microphone. Continue app code here.
}, function(err) {
// User has rejected the use of the microphone.
}
);
Docs
processWebAudioMicStream(processAudio, audioContext) ⇒ Promise
Kind: global function
Returns: Promise - Resolves/rejects once the user has allowed/disallowed the use of the microphone
Param | Type | Description |
---|---|---|
processAudio | processAudioCallback | A function that is called each time a new buffer is ready to be processed. This function is called roughly 86 times per second. |
audioContext | AudioContext |
processAudioCallback : function
Kind: global typedef
Param | Type |
---|---|
audioData | Float32Array |