Merge pull request #29 from Plaud-AI/feat/demo

feat: optimize vad
This commit is contained in:
Harold-Guo 2025-12-08 18:17:34 +08:00 committed by GitHub
commit 737e031e30
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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 conn._latency_voice_start_time = time.time() * 1000
logger.bind(tag=TAG).info(f"🎤 [延迟追踪] 用户开始说话") logger.bind(tag=TAG).info(f"🎤 [延迟追踪] 用户开始说话")
# 如果之前有声音,但本次没有声音,且尚未触发voice_stop,检查是否说完 if conn.client_have_voice and not client_have_voice:
if conn.client_have_voice and not client_have_voice and not conn.client_voice_stop:
stop_duration = time.time() * 1000 - conn.last_activity_time stop_duration = time.time() * 1000 - conn.last_activity_time
if stop_duration >= self.silence_threshold_ms: if stop_duration >= self.silence_threshold_ms:
if conn.client_listen_mode != "manual": if conn.client_listen_mode != "manual":

View file

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