demo/utils.js
function (bufferSize, numberOfIterations) {

    var bufSize = bufferSize || 16000,
        iterations = numberOfIterations || 100;

    for (var i = 0; i < iterations; i++) {
        var data = [];

        for (var k = 0; k < bufSize; k++) {
            data.push((parseFloat(Math.random() * 1.0) - 0.5));
        }

        // Dispatch an event
        var event = new CustomEvent('audioinput');
        event.data = data;
        window.dispatchEvent(event);
    }
}
function (bufferSize, numberOfIterations) {

    var bufSize = bufferSize || 16000,
        iterations = numberOfIterations || 100;

    for (var i = 0; i < iterations; i++) {
        var data = [];

        for (var k = 0; k < bufSize; k++) {
            data.push((parseFloat(Math.random() * 1.0) - 0.5));
        }

        // Dispatch an event
        var event = new CustomEvent('audioinput');
        event.data = data;
        window.dispatchEvent(event);
    }
}
function ( bufferSize , numberOfIterations ) { var bufSize = bufferSize || 16000 , iterations = numberOfIterations || 100 ; for ( var i = 0 ; i < iterations ; i ++ ) { var data = [ ] ; for ( var k = 0 ; k < bufSize ; k ++ ) { data . push ( ( parseFloat ( Math . random ( ) * 1.0 ) - 0.5 ) ) ; } // Dispatch an event var event = new CustomEvent ( 'audioinput' ) ; event . data = data ; window . dispatchEvent ( event ) ; } }
Generates some random audio input data and dispatches an audioinput event for each buffer

@param bufferSize
@param numberOfIterations
Generates some random audio input data and dispatches an audioinput event for each buffer