diff --git a/vocoder/static/vocoder.js b/vocoder/static/vocoder.js index 9f0e0e1..8de1cc9 100644 --- a/vocoder/static/vocoder.js +++ b/vocoder/static/vocoder.js @@ -122,6 +122,8 @@ class GeneratedShape { this.xDirection = 1; this.yDirection = 1; + + this.synth = new p5.MonoSynth(); } collide(shapes) { @@ -158,7 +160,12 @@ class GeneratedShape { /** * Play a sound after a collision is detected. **/ - return; // TODO: placeholder for now ... + var notes = ["G2", "C3", "G3"]; + var duration = 0.8; + var time = 0; + var velocity = 0.5; + var index = random(0, notes.length + 1); + this.synth.play(notes[index], velocity, time, duration); } move() {