Generate shape when the sound is ready
This commit is contained in:
parent
4fcb9fd0be
commit
5e092df9d6
@ -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 newShape = new GeneratedShape(recordedSound, amplitude, duration);
|
let recordedSound = new p5.SoundFile(data, function() {
|
||||||
shapes.push(newShape);
|
let newShape = new GeneratedShape(recordedSound, amplitude, duration);
|
||||||
newSoundJustRecorded = false;
|
shapes.push(newShape);
|
||||||
|
newSoundJustRecorded = false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let i = 0; i < shapes.length; i++) {
|
for (let i = 0; i < shapes.length; i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user