From 580008663b9f7d6f41b6bdf46163317c474b216f Mon Sep 17 00:00:00 2001 From: CarolinePascal Date: Wed, 9 Apr 2025 15:00:18 +0200 Subject: [PATCH] Adding flag for file writting recording case --- src/lerobot/microphones/microphone.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lerobot/microphones/microphone.py b/src/lerobot/microphones/microphone.py index 41c63bb1a..16ab275b3 100644 --- a/src/lerobot/microphones/microphone.py +++ b/src/lerobot/microphones/microphone.py @@ -149,6 +149,7 @@ class Microphone: self.logs = {} self.is_connected = False self.is_recording = False + self.is_writing = False def connect(self) -> None: if self.is_connected: @@ -208,7 +209,8 @@ class Microphone: logging.warning(status) # Slicing makes copy unnecessary # Two separate queues are necessary because .get() also pops the data from the queue - self.record_queue.put(indata[:, self.channels]) + if self.is_writing: + self.record_queue.put(indata[:, self.channels]) self.read_queue.put(indata[:, self.channels]) @staticmethod @@ -312,6 +314,8 @@ class Microphone: self.record_thread.daemon = True self.record_thread.start() + self.is_writing = True + self.is_recording = True self.stream.start()