Paul Adenot, @padenot && padenot@mozilla.com
Paul Adenot, FOSDEM, Brussels, 2013-02-01
$ hg log -r : -l 1 content/media/webaudio
changeset: 104061:ee9b17600025
user: Ehsan Akhgari <ehsan@mozilla.com>
date: Fri Aug 31 16:59:37 2012 -0400
summary: Bug 775302 - Stub out the implementation of mozAudioContext; r=bzbarsky,khuey
816 commits so far, feature complete implementation, landed in Firefox 25 (2013-10-29).
Commit time repartition:
ArrayBuffers What does the spec tell us?
[...] A high-level JavaScript API for processing and synthesizing audio in web applications. The primary paradigm is of an audio routing graph, where a number of AudioNode objects are connected together to define the overall audio rendering.http://webaudio.github.io/web-audio-api/index.html#abstact
var ac = new AudioContext(); ac.decodeAudioData(ogg_arraybuffer, function(audiobuffer) { var source = ac.createBufferSource(); source.buffer = audiobuffer; var d = ac.createDelay() var osc = ac.createOscillator(); osc.type = "square"; osc.frequency.value = 100; // Hz var g = ac.createGain(); source.connect(d); source.connect(ac.destination); d.connect(ac.destination); g.connect(d); d.connect(g); osc.connect(g); }, function error() { alert("This is broken"); });
MediaStreamAudioSourceNode, from WebRTC, getUserMedia, etc.AudioBufferSourceNode to play a raw PCM audio bufferOscillatorNode to play predetermined waveforms ScriptProcessorNode (with no input) to generate arbitrary waveforms using JavaScriptMediaElementAudioSourceNode to pipe the audio from <audio> or <video> in Web AudioGainNode: Change the volumeDelayNode: Delays the input, in timeScriptProcessorNode (with both input and output connected): arbitrary processingPannerNode: Position a source and a listener in 3D and get the sound panned accordinglyChannel{Splitter,Merger}Node: Merge or Split multi-channel audioConvolverNode: Perform one-dimensional convolution (e.g. church-like reverb)WaveShaperNode: Non-linear wave shaping (e.g. guitar distortion) BiquadFilter: low-pass, high-pass, etc. (e.g. graphical equalizer)DynamicsCompressorNode: harmonizes audio levelsMediaStreamAudioDestinationNode: Outputs to a
MediaStream(send to a PeerConnection, a
MediaRecorder)AudioDestinationNode: Outputs to speakersScriptProcessorNode: arbitrary processing on input audioAnalyserNode: Get time-domain or frequency-domain
audio data, in ArrayBuffersAudioContext in workers, so ScriptProcessorNode can actually work properly.