mirror of
https://github.com/huggingface/lerobot.git
synced 2026-07-24 18:26:11 +00:00
fix(Microphone): adding missing properties and argument in Microphone base class
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
import abc
|
import abc
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from threading import Barrier
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
@@ -65,6 +66,26 @@ class Microphone(abc.ABC):
|
|||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@property
|
||||||
|
@abc.abstractmethod
|
||||||
|
def is_recording(self) -> bool:
|
||||||
|
"""Check if the microphone is currently recording.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
bool: True if the microphone is recording, False otherwise.
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
|
@property
|
||||||
|
@abc.abstractmethod
|
||||||
|
def is_writing(self) -> bool:
|
||||||
|
"""Check if the microphone is currently writing to a file.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
bool: True if the microphone is writing to a file, False otherwise.
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def find_microphones() -> list[dict[str, Any]]:
|
def find_microphones() -> list[dict[str, Any]]:
|
||||||
@@ -86,14 +107,16 @@ class Microphone(abc.ABC):
|
|||||||
self,
|
self,
|
||||||
output_file: str | Path | None = None,
|
output_file: str | Path | None = None,
|
||||||
multiprocessing: bool | None = False,
|
multiprocessing: bool | None = False,
|
||||||
overwrtie: bool | None = True,
|
overwrite: bool | None = True,
|
||||||
|
barrier: Barrier | None = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Start recording audio from the microphone.
|
"""Start recording audio from the microphone.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
output_file: Optional path to save the recorded audio.
|
output_file: Optional path to save the recorded audio.
|
||||||
multiprocessing: If True, enables multiprocessing for recording.
|
multiprocessing: If True, enables multiprocessing for recording. Defaults to multithreading otherwise.
|
||||||
overwrite: If True, overwrites existing files at output_file path.
|
overwrite: If True, overwrites existing files at output_file path.
|
||||||
|
barrier: If not None, ensures that multiple microphones start recording at the same time.
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user