FuncOscillator
Constructor
osc = T("func", numOfSamples=0, func=function(x) { return x; }, freq=440);
// numOfSamples [Number]
// func [Function]
// freq [Object] Frequency
osc.play();
Properties
osc.func // [Function]
osc.numOfSamples // [Number]
osc.freq // [Object] Frequency
osc.phase // [Number] Initial phase offset
Methods
// Reset phase
osc.bang();
Events
Example: PWM (10%)
T("func", function(x) {
return (x < 0.1) ? -1 : +1;
}, 880).play();
// x is a phase in the range 0.0 to 1.0
Example: numOfSamples
T("func", 3, function(x) { // numOfSamples is 3
return return [x-0.5, 0, 0]; // return.length is 3
}, 880).play();