Browse Source

Generate shape when the sound is ready

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

4
voicegardens/static/voicegardens.js

@ -554,10 +554,12 @@ function draw() {
if (newSoundJustRecorded === true) { if (newSoundJustRecorded === true) {
// build a new copy of the recording to store on the shape object // build a new copy of the recording to store on the shape object
let soundBlob = recording.getBlob(); let soundBlob = recording.getBlob();
let recordedSound = new p5.SoundFile(new p5.File(soundBlob)); let data = new p5.File(soundBlob);
let recordedSound = new p5.SoundFile(data, function() {
let newShape = new GeneratedShape(recordedSound, amplitude, duration); let newShape = new GeneratedShape(recordedSound, amplitude, duration);
shapes.push(newShape); shapes.push(newShape);
newSoundJustRecorded = false; newSoundJustRecorded = false;
});
} }
for (let i = 0; i < shapes.length; i++) { for (let i = 0; i < shapes.length; i++) {

Loading…
Cancel
Save