liumaolin
commited on
Commit
·
5f9eaee
1
Parent(s):
4e071d3
Handle overflow errors in audio capture by adding `exception_on_overflow=False` and skip processing when no data is available.
Browse files
src/voice_dialogue/core/launcher.py
CHANGED
|
@@ -63,7 +63,6 @@ def launch_system(
|
|
| 63 |
|
| 64 |
# 音频采集
|
| 65 |
enable_echo_cancellation = not disable_echo_cancellation
|
| 66 |
-
logger.info(f"Echo Cancellation: {enable_echo_cancellation}")
|
| 67 |
audio_frame_probe = AudioCapture(
|
| 68 |
audio_frames_queue=audio_frames_queue,
|
| 69 |
enable_echo_cancellation=enable_echo_cancellation
|
|
@@ -73,7 +72,6 @@ def launch_system(
|
|
| 73 |
|
| 74 |
# 语音状态监测
|
| 75 |
enable_vad = disable_echo_cancellation
|
| 76 |
-
logger.info(f"VAD: {enable_vad}")
|
| 77 |
user_voice_checker = SpeechStateMonitor(
|
| 78 |
audio_frame_queue=audio_frames_queue,
|
| 79 |
user_voice_queue=user_voice_queue,
|
|
|
|
| 63 |
|
| 64 |
# 音频采集
|
| 65 |
enable_echo_cancellation = not disable_echo_cancellation
|
|
|
|
| 66 |
audio_frame_probe = AudioCapture(
|
| 67 |
audio_frames_queue=audio_frames_queue,
|
| 68 |
enable_echo_cancellation=enable_echo_cancellation
|
|
|
|
| 72 |
|
| 73 |
# 语音状态监测
|
| 74 |
enable_vad = disable_echo_cancellation
|
|
|
|
| 75 |
user_voice_checker = SpeechStateMonitor(
|
| 76 |
audio_frame_queue=audio_frames_queue,
|
| 77 |
user_voice_queue=user_voice_queue,
|
src/voice_dialogue/services/audio/capture.py
CHANGED
|
@@ -92,7 +92,9 @@ class AudioCapture(BaseThread):
|
|
| 92 |
|
| 93 |
try:
|
| 94 |
while not self.is_exited:
|
| 95 |
-
data = stream.read(chunk)
|
|
|
|
|
|
|
| 96 |
|
| 97 |
if self.is_paused:
|
| 98 |
continue
|
|
|
|
| 92 |
|
| 93 |
try:
|
| 94 |
while not self.is_exited:
|
| 95 |
+
data = stream.read(chunk, exception_on_overflow=False)
|
| 96 |
+
if data is None:
|
| 97 |
+
continue
|
| 98 |
|
| 99 |
if self.is_paused:
|
| 100 |
continue
|