0.0.3 • Published 9 years ago

process-web-audio-mic-stream v0.0.3

Weekly downloads
2
License
ISC
Repository
github
Last release
9 years ago

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

ParamTypeDescription
processAudioprocessAudioCallbackA function that is called each time a new buffer is ready to be processed. This function is called roughly 86 times per second.
audioContextAudioContext

processAudioCallback : function

Kind: global typedef

ParamType
audioDataFloat32Array