+-------+
| OSC |
+---+---+
v
+-------+
| CONV |
+---+---+
v
+-------+
| OUT +
+-------+
var osc = ctx.createOscillator();
osc.type = osc.SQUARE;
var conv = ctx.createConvolver();
conv.buffer = loadedSamples['t600']
osc.connect(conv);
conv.connect(ctx.destination)
Convolution
+-------+
+-+ OSC |
| +---+---+
| v
| +-------+ +------+
| | CONV +>| GAIN |
| +-------+ +------+
| |
| +-------+ |
+>| OUT +<----+
+-------+
var osc = ctx.createOscillator();
osc.type = osc.SQUARE;
var gain = ctx.createGainNode();
gain.gain.value = 0.5;
var conv = ctx.createConvolver();
conv.buffer = loadedSamples['t600']
osc.connect(conv);
conv.connect(gain);
osc.connect(ctx.destination)
gain.connect(ctx.destination)
Delay
+-------+
+-+ OSC |
| +---+---+
| v
| +-------+ +------+
| | DELAY +>| GAIN |
| +-------+ +------+
| |
| +-------+ |
+>| OUT +<----+
+-------+
var osc = ctx.createOscillator();
osc.type = osc.SQUARE;
var gain = ctx.createGainNode();
gain.gain.value = 0.5;
var conv = ctx.createConvolver();
conv.buffer = loadedSamples['t600']
osc.connect(conv);
conv.connect(gain);
osc.connect(ctx.destination)
gain.connect(ctx.destination)
Delay
+-------+ +--------+
+-+ OSC | | GAIN |
| +---+---+ +--------+
| | | ^
| +----------+ |
| v |
| +-------+ +------+-+
| | DELAY +-->| FILTER |
| +---+---+ +--------+
| v
| +-------+
| | GAIN +
| +---+---+
| v
| +-------+
+>| OUT +
+-------+
// too much code!
Waveshaper
+-------+
| OSC |
+---+---+
v
+-------+
|SHAPER |
+---+---+
v
+-------+
| OUT |
+-------+
var shaper = ctx.createWaveShaper();
shaper.curve = new Float32Array([-1, -1, -0.5, 0,0.5, 1, 1]);
osc.connect(shaper);
Waveshaper
+-------+
| ABS |
+---+---+
v
+-------+
|SHAPER |
+---+---+
v
+-------+
| OUT |
+-------+
var shaper = ctx.createWaveShaper();
shaper.curve = new Float32Array([-1, -1, -0.5, 0,0.5, 1, 1]);
sample.connect(shaper);
Panner
+-------+
| ABS |
+---+---+
v
+-------+
| PAN |
+---+---+
v
+-------+
| OUT |
+-------+
var pan1 = ctx.createPanner();
var pan2 = ctx.createPanner();
pan1.setPosition(-5, 0,0);
pan2.setPosition(-5, 0,0);
Putting it Together
AwesomeSound
+-------+
| STUFF |
+---+---+
v
+-------+
| OUT |
+-------+
var osc1 = ctx.createOscillator();
var osc2 = ctx.createOscillator();
var filter = ctx.createBiquadFilter();
var gain = ctx.createGainNode();
var fxGain = ctx.createGainNode();
var shaperGain = ctx.createGainNode();
var shaper = ctx.createWaveShaper();
var conv = ctx.createConvolver();