Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The returned error from the callback function is null because in the current <a href="http://w3.org/TR/webaudio/#AudioContext-section">webaudio api spec</a> that function does not return an object error</p> <pre><code>callback DecodeSuccessCallback = void (AudioBuffer decodedData); callback DecodeErrorCallback = void (); void decodeAudioData(ArrayBuffer audioData, DecodeSuccessCallback successCallback, optional DecodeErrorCallback errorCallback); </code></pre> <p>DecodeSuccessCallback is raised when the complete input ArrayBuffer is decoded and stored internally as an AudioBuffer but for some unknown reason decodeAudioData can not decode a live stream.</p> <p>You can try to play the captured buffer setting the output buffer data when processing audio</p> <pre><code>function connectAudioInToSpeakers(){ //var context = new webkitAudioContext(); navigator.webkitGetUserMedia({audio: true}, function(stream) { var context = new webkitAudioContext(); liveSource = context.createMediaStreamSource(stream); // create a ScriptProcessorNode if(!context.createScriptProcessor){ node = context.createJavaScriptNode(2048, 1, 1); } else { node = context.createScriptProcessor(2048, 1, 1); } node.onaudioprocess = function(e){ try{ ctx.clearRect(0, 0, document.getElementById("myCanvas").width, document.getElementById("myCanvas").height); document.getElementById("myCanvas").width = document.getElementById("myCanvas").width; ctx.fillStyle="#FF0000"; var input = e.inputBuffer.getChannelData(0); var output = e.outputBuffer.getChannelData(0); for(var i in input) { output[i] = input[i]; ctx.fillRect(i/4,input[i]*500+200,1,1); } }catch (e){ console.log('node.onaudioprocess',e.message); } } // connect the ScriptProcessorNode with the input audio liveSource.connect(node); // if the ScriptProcessorNode is not connected to an output the "onaudioprocess" event is not triggered in chrome node.connect(context.destination); //Geb mic eingang auf boxen //liveSource.connect(context.destination); }); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload