Music Tech Meetup 2016
- Chinmay Pendharkar
bgsound
<object> , <embed>
<audio>
— W3C WebAudio Draft Spec
// Create Context and Nodex
var audioCtx = new AudioContext();
var oscillator = audioCtx.createOscillator();
var filter = context.createBiquadFilter();
// Set parameter values
oscillator.detune.value = -400;
filter.type = filter.LOWPASS;
filter.frequency.value = 5000;
// Connect nodes
oscillator.connect(filter);
filter.connect(audioCtx.destination);
var context = new window.AudioContext();
var buffer = context.createBufferSource();
buffer.connect(context.destination);
playRate.setValueAtTime(2, 5);
frequency.linearRampToValueAtTime(400, 2);
delayTime.exponentialRampToValueAtTime(3.1, 10);
pan.setTargetAtTime(-1, 7.2);
gain.setValueCurveAtTime([0, 1, 0.7, 0.7, 0.5, 0.2, 0], 0, 0.5)
filter.frequency.value = 400; // Set Frequency to 400Hz.
filter.Q // Filter Q-value
filter.gain // Filter gain
oscillator.frequency // Oscillator frequency.
oscillator.detune // Detune an oscillator
gain.gain // Set gain value (loudness)
delay.delayTime // Set the delay
buffer.playbackRate // Speed of playbackRate
panner.pan // Left/Right Panning
....
var osc = context.createOscillator();
var gain = context.createGain();
// Connect oscillator to gain
osc.connect(gain.gain);
// Connect buffer to gain and gain to output
buffer.connect(gain);
gain.connect(context.destination);
var carrier = context.createOscillator();
var message = context.createOscillator();
// Connect oscillator to frequency
message.connect(carrier.frequency);
// Connect carrier to gain and gain to output
carrier.connect(context.destination);