add logging to the local audio streamer

This commit is contained in:
Andres Marafioti
2024-08-27 15:30:23 +02:00
parent a6f27a2888
commit 4909824ba3

View File

@@ -3,7 +3,9 @@ import sounddevice as sd
import numpy as np
import time
import logging
logger = logging.getLogger(__name__)
class LocalAudioStreamer:
def __init__(
@@ -26,6 +28,8 @@ class LocalAudioStreamer:
else:
outdata[:] = self.output_queue.get()[:, np.newaxis]
logger.debug("Available devices:")
logger.debug(sd.query_devices())
with sd.Stream(
samplerate=16000,
dtype="int16",
@@ -33,6 +37,7 @@ class LocalAudioStreamer:
callback=callback,
blocksize=self.list_play_chunk_size,
):
logger.info("Starting local audio stream")
while not self.stop_event.is_set():
time.sleep(0.001)
print("Stopping recording")