mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-28 04:59:52 +01:00
feat: optimize vad
This commit is contained in:
parent
425ad7dd09
commit
e5ef658191
2 changed files with 3 additions and 4 deletions
|
|
@ -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":
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue