Linear interpolating wavetable lookup oscillator with phase input
oscx = T("oscx", wave="sin", phase=0, mul=1, add=0);
// wave [String / Function / Float32Array]
// phase [Object] Phase
// mul [Number] Multiply the output (default is 1)
// add [Number] and add the output (default is 0)
oscx.set("phase", T("phasor", 440)).play();
oscx.wave // [String / Function / Float32Array]
oscx.phase // [Object] Phase
oscx.mul // [Number] Output will be multiplied by this value
oscx.add // [Number] and will be added to the output
oscx.fb // [Number] Feedback
// Reset phase
oscx.bang(); // == oscx.phase.bang();
T("sinx", T("phasor", 440)).set("fb", 0.25).play();
freq = T("phasor", 440);
op1 = T("*", T("oscx", freq), // modulator
T("adsr", 100, 4900));
op2 = T("*", T("oscx", T("+", freq, op1)), // carrier
T("adsr", 0, 10000, 0.6));
synth = op2;
synth.onplay = function() {
op1.args[1].bang();
op2.args[1].bang();
};
synth.onbang = function() {
op1.args[1].bang();
op2.args[1].bang();
};
synth.play();