Browse Source
Tuck this sound related stuff into the success cb
main
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
1 changed files with
3 additions and
11 deletions
-
voicegardens/static/voicegardens.js
|
|
@ -68,17 +68,6 @@ function stop() { |
|
|
|
**/ |
|
|
|
if (recorder.recording) { |
|
|
|
recorder.stop(); |
|
|
|
|
|
|
|
// https://p5js.org/reference/#/p5.SoundFile/getPeaks
|
|
|
|
amplitude = recording.getPeaks(1)[0] * 100; |
|
|
|
|
|
|
|
// https://p5js.org/reference/#/p5.SoundFile/duration
|
|
|
|
duration = recording.duration(); |
|
|
|
|
|
|
|
// automatically archive this sound to the back-end
|
|
|
|
sendToArchive(); |
|
|
|
|
|
|
|
// signal to the draw loop that we should generate a new shape
|
|
|
|
newSoundJustRecorded = true; |
|
|
|
} |
|
|
|
} |
|
|
@ -556,9 +545,12 @@ function draw() { |
|
|
|
let soundBlob = recording.getBlob(); |
|
|
|
let data = new p5.File(soundBlob); |
|
|
|
let recordedSound = new p5.SoundFile(data, function() { |
|
|
|
amplitude = recording.getPeaks(1)[0] * 100; |
|
|
|
duration = recording.duration(); |
|
|
|
let newShape = new GeneratedShape(recordedSound, amplitude, duration); |
|
|
|
shapes.push(newShape); |
|
|
|
newSoundJustRecorded = false; |
|
|
|
sendToArchive(); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|