mirror of
https://github.com/huggingface/lerobot.git
synced 2026-05-22 03:59:42 +00:00
[skip ci] fix(audio latency): setting microphone recording latency to low as default
This commit is contained in:
@@ -170,14 +170,15 @@ class PortAudioMicrophone(Microphone):
|
|||||||
samplerate=self.sample_rate,
|
samplerate=self.sample_rate,
|
||||||
channels=max(self.channels),
|
channels=max(self.channels),
|
||||||
dtype="float32",
|
dtype="float32",
|
||||||
|
blocksize=0, # Varying input buffer length, but no additional latency
|
||||||
|
latency="low", # Low latency mode (not enabled by default !)
|
||||||
|
# never_drop_input=True, # Disabled as it generates an error for some devices
|
||||||
callback=self._audio_callback,
|
callback=self._audio_callback,
|
||||||
)
|
)
|
||||||
# Remark : the blocksize parameter could be passed to the stream to ensure that audio_callback always receive same length buffers.
|
|
||||||
# However, this may lead to additional latency. We thus stick to blocksize=0 which means that audio_callback will receive varying length buffers, but with no additional latency.
|
|
||||||
|
|
||||||
self._is_connected = True
|
self._is_connected = True
|
||||||
|
|
||||||
def _audio_callback(self, indata, frames, time, status) -> None:
|
def _audio_callback(self, indata, frames, timestamp, status) -> None:
|
||||||
"""
|
"""
|
||||||
Low-level sounddevice callback.
|
Low-level sounddevice callback.
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user