Add configurable input device selection

This commit is contained in:
2026-03-01 12:49:39 +03:00
parent a87840c78d
commit 7ca6958488
6 changed files with 50 additions and 2 deletions

View File

@@ -128,13 +128,16 @@ class SpeechRecognizer:
def _get_stream(self):
"""Открывает аудиопоток PyAudio, если он еще не открыт."""
if self.stream is None:
device_index, device_info = get_audio_manager().resolve_input_device()
self.stream = self.pa.open(
rate=SAMPLE_RATE,
channels=1,
format=pyaudio.paInt16,
input=True,
input_device_index=device_index,
frames_per_buffer=4096,
)
print(f"🎙️ STT input: {device_info.get('name', 'unknown')}")
return self.stream
async def _process_audio(