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()