Creates a triangle oscillator.
Syntax
p5.TriOsc([freq])
Parameters
freq
Number: Set the frequency * @example
function setup() {
describe("a sketch that creates an oscillator with a triangle wave shape");
createCanvas(100, 100);
textAlign(CENTER);
textWrap(WORD);
textSize(10);
osc = new p5.TriOsc(440);
}
function mousePressed() {
osc.start();
}
function draw(){
background(220);
text('click to hear a triangle wave shape', 0, 10, 100);
}
Notice any errors or typos? Please let us know. Please feel free to edit src/sources/Oscillator.js and open a pull request!