Changes

Jump to: navigation, search

User:David.humphrey/Audio Data API 2

225 bytes added, 16:20, 21 May 2010
Writing Audio
<pre>
// Create a new <audio stream for writingid="a1" src="song.ogg" onloadedmetadata="loadedMetadata(event);"var aout onaudiowritten= new Audio"audioWritten(event);" controls="controls"></audio><script>aoutvar a1 = document.mozSetupgetElementById(2'a1'), 44100 a2 = new Audio(), 1);
function audioWrittenloadedMetadata(event){ samples // Mute a1 audio. a1.volume = 0; // Setup a2 to be identical to a1, and play through there. a2.mozSetup(event.mozFrameBuffermozChannels, event.mozRate, 1);
// Do any filtering, signal processing, etc. for (var i=0, slen=samples.length; i < slen; i++){ process(samples[i]); }
function audioWritten(event) { aout// Write the current frame to a2 a2.mozWriteAudio(samplesevent.mozFrameBuffer);
}
</script>
</pre>
Confirm
656
edits

Navigation menu