Skip to content

Commit

Permalink
monosynth_basic example uses mouse
Browse files Browse the repository at this point in the history
  • Loading branch information
therewasaguy authored and jvntf committed Aug 19, 2017
1 parent dd4420b commit 13e185a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
9 changes: 6 additions & 3 deletions examples/monosynth_basic/sketch.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@ var monoSynth;

function setup() {
monoSynth = new p5.MonoSynth();

createCanvas(400, 400);
text('press to play a random note at a random velocity', 20, 20);
}

function keyPressed() {
function mousePressed() {
// pick a random midi note
var midiVal = round( random(50,72) );
monoSynth.triggerAttack(midiVal, random() );
}

function keyReleased() {
function mouseReleased() {
monoSynth.triggerRelease();
}
}
1 change: 0 additions & 1 deletion src/oscillator.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,6 @@ define(function (require) {
// this.oscillator.frequency.cancelScheduledValues(now);

if (rampTime === 0) {
// this.oscillator.frequency.cancelScheduledValues(now);
this.oscillator.frequency.setValueAtTime(val, tFromNow + now);
} else {
if (val > 0 ) {
Expand Down

0 comments on commit 13e185a

Please sign in to comment.