feat: AudioRecorder accepts device param — reads audio.device from config

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-01 20:32:44 +02:00
parent 5e7faa8844
commit ef4aa2a840
3 changed files with 17 additions and 2 deletions
+3 -1
View File
@@ -4,8 +4,9 @@ import numpy as np
class AudioRecorder:
def __init__(self, sample_rate: int = 16000):
def __init__(self, sample_rate: int = 16000, device: str | None = None):
self.sample_rate = sample_rate
self.device = device or None
self._buffer: list[np.ndarray] = []
self._stream = None
self.is_recording = False
@@ -25,6 +26,7 @@ class AudioRecorder:
channels=1,
dtype="int16",
callback=self._callback,
device=self.device,
)
self._stream.start()