feat: optimize vad

This commit is contained in:
Harold 2025-12-08 18:16:30 +08:00
parent 425ad7dd09
commit e5ef658191
2 changed files with 3 additions and 4 deletions

View file

@ -103,8 +103,7 @@ class VADProvider(VADProviderBase):
conn._latency_voice_start_time = time.time() * 1000
logger.bind(tag=TAG).info(f"🎤 [延迟追踪] 用户开始说话")
# 如果之前有声音,但本次没有声音,且尚未触发voice_stop,检查是否说完
if conn.client_have_voice and not client_have_voice and not conn.client_voice_stop:
if conn.client_have_voice and not client_have_voice:
stop_duration = time.time() * 1000 - conn.last_activity_time
if stop_duration >= self.silence_threshold_ms:
if conn.client_listen_mode != "manual":

View file

@ -477,8 +477,8 @@ VAD:
SileroVAD:
type: silero
model_dir: models/snakers4_silero-vad
threshold: 0.5 # high threshold to confirm voice
threshold_low: 0.3 # low threshold to confirm silence
threshold: 0.6 # high threshold to confirm voice
threshold_low: 0.4 # low threshold to confirm silence
min_silence_duration_ms: 200 # silence detection duration (ms)
frame_window_threshold: 3 # sliding window threshold