From 5f15a0f9e2a1337e208427b17554c90d712aa8ad Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 15 Jan 2024 17:59:45 +1100 Subject: [PATCH] src: Update test_record.py. Signed-off-by: Damien George --- src/test_record.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/test_record.py b/src/test_record.py index 656ef28..76a3ba6 100644 --- a/src/test_record.py +++ b/src/test_record.py @@ -22,15 +22,11 @@ "00000" ) -RECORDING_RATE = 7812 -RECORDING_SECONDS = 5 -RECORDING_SIZE = RECORDING_RATE * RECORDING_SECONDS - -my_recording = audio.AudioFrame(RECORDING_SIZE) +my_recording = audio.AudioFrame(5000) while True: if button_a.is_pressed(): - microphone.record_into(my_recording, rate=RECORDING_RATE, wait=False) + microphone.record_into(my_recording, wait=False) display.show([mouth_open, mouth_closed], loop=True, wait=False, delay=150) while button_a.is_pressed() and microphone.is_recording(): sleep(50) @@ -51,7 +47,7 @@ level *= 0.95 display.show(play * min(1, level / 100)) x = accelerometer.get_x() - audio.set_rate(max(2250, scale(x, (-1000, 1000), (2250, 13374)))) + my_recording.set_rate(max(2250, scale(x, (-1000, 1000), (2250, 13374)))) sleep(5) display.clear() sleep(100)