start_recording
Signature:
BoosterAudioManager.start_recording(
sample_rate: int = 16000,
channels: int = 1,
sample_format: PcmSampleFormat = "S16LE",
*,
use_naec: bool = False,
) -> None
Description:
Start an in-memory recording session; recorded data will be merged into a single AudioData when stop_recording() is called.
Parameters:
Parameter | Type | Default | Description |
|---|---|---|---|
|
|
| Sample rate in Hz. |
|
|
| Number of channels. |
|
|
| PCM sample format, see "Perception and State Data / PcmSampleFormat". |
|
|
| Whether to prioritize NAEC audio; requires audio input device support. |
Returns:
None
Raises:
ValueError: sample_format is not "S16LE", or sample_rate/channels is less than or equal to 0.
RuntimeError: Audio subsystem is closed, recording is already in progress, or capture initialization failed.
Example:
from boosteros.robots.booster import BoosterRobot
import time
robot = BoosterRobot()
robot.audio_manager.start_recording()
time.sleep(5)
audio = robot.audio_manager.stop_recording()
print(audio.duration)
# Example output: <Duration 4.480000s>