mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-28 01:53:53 +08:00
update:流式优化暂不稳定,先回滚到早期代码
This commit is contained in:
@@ -33,7 +33,7 @@ class VADProvider(VADProviderBase):
|
||||
int(min_silence_duration_ms) if min_silence_duration_ms else 1000
|
||||
)
|
||||
|
||||
# 至少要多少帧才算有语音,增加灵敏度
|
||||
# 至少要多少帧才算有语音
|
||||
self.frame_window_threshold = 1
|
||||
|
||||
def is_vad(self, conn, opus_packet):
|
||||
@@ -70,7 +70,9 @@ class VADProvider(VADProviderBase):
|
||||
|
||||
# 更新滑动窗口
|
||||
conn.client_voice_window.append(is_voice)
|
||||
client_have_voice = (conn.client_voice_window.count(True) >= self.frame_window_threshold)
|
||||
client_have_voice = (
|
||||
conn.client_voice_window.count(True) >= self.frame_window_threshold
|
||||
)
|
||||
|
||||
# 如果之前有声音,但本次没有声音,且与上次有声音的时间差已经超过了静默阈值,则认为已经说完一句话
|
||||
if conn.client_have_voice and not client_have_voice:
|
||||
|
||||
Reference in New Issue
Block a user