From abe1bfb12655bea333704dd726ffe5607ea8986c Mon Sep 17 00:00:00 2001 From: Matt Hillsdon Date: Tue, 27 Aug 2024 14:49:54 +0100 Subject: [PATCH] Safer --- src/board/audio/index.ts | 7 +++---- src/examples/record.py | 3 ++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/board/audio/index.ts b/src/board/audio/index.ts index e779365..1fdb67e 100644 --- a/src/board/audio/index.ts +++ b/src/board/audio/index.ts @@ -242,10 +242,6 @@ export class BoardAudio { this.stopRecording(); } }; - - this.sensitivityNode!.connect(recorder); - recorder.connect(this.context!.destination); - this.stopActiveRecording = () => { recorder.disconnect(); this.sensitivityNode!.disconnect(); @@ -254,6 +250,9 @@ export class BoardAudio { this.microphoneEl.style.display = "none"; this.stopActiveRecording = undefined; }; + + this.sensitivityNode!.connect(recorder); + recorder.connect(this.context!.destination); } boardStopped() { diff --git a/src/examples/record.py b/src/examples/record.py index 6c49d0f..521b244 100644 --- a/src/examples/record.py +++ b/src/examples/record.py @@ -4,7 +4,8 @@ rate_index = 0 print("Recording...") -my_track = microphone.record(3000) +my_recording = microphone.record(3000) +my_track = my_recording.track() print("Button A to play") while True: if button_a.was_pressed():