Browse Source

Rig up some funky sounds

main
Luke Murphy 4 years ago
parent
commit
87bc40a52b
No known key found for this signature in database GPG Key ID: 5E2EF5A63E3718CC
  1. 9
      vocoder/static/vocoder.js

9
vocoder/static/vocoder.js

@ -122,6 +122,8 @@ class GeneratedShape {
this.xDirection = 1; this.xDirection = 1;
this.yDirection = 1; this.yDirection = 1;
this.synth = new p5.MonoSynth();
} }
collide(shapes) { collide(shapes) {
@ -158,7 +160,12 @@ class GeneratedShape {
/** /**
* Play a sound after a collision is detected. * 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() { move() {

Loading…
Cancel
Save