@@ -136,15 +136,13 @@ APP_CONFIG = {
|
||||
|
||||
### Q:唤醒词一直没有反应?
|
||||
|
||||
由于小爱音箱远场拾音音量较小,有时可能会识别不清,你可以调大 `config.py` 配置文件里的 `boost` 参数,然后重启应用 / Docker 试试看。
|
||||
如果唤醒词还是不敏感,可以先调低 `vad.threshold`,然后重启应用 / Docker 试试看。
|
||||
|
||||
```py
|
||||
APP_CONFIG = {
|
||||
"vad": {
|
||||
# 小爱音箱录音音量较小,需要后期放大一下
|
||||
"boost": 100,
|
||||
# boost 调大后,语音检测阈值可能也需要一起调大些
|
||||
"threshold": 0.50,
|
||||
# 语音检测阈值(0-1,越小越灵敏)
|
||||
"threshold": 0.05,
|
||||
},
|
||||
# ... 其他配置
|
||||
}
|
||||
|
||||
@@ -53,8 +53,6 @@ APP_CONFIG = {
|
||||
"after_wakeup": after_wakeup,
|
||||
},
|
||||
"vad": {
|
||||
# 录音音量增强倍数(小爱音箱录音音量较小,需要后期放大一下)
|
||||
"boost": 10,
|
||||
# 语音检测阈值(0-1,越小越灵敏)
|
||||
"threshold": 0.10,
|
||||
# 最小语音时长(ms)
|
||||
|
||||
@@ -9,10 +9,10 @@ class _SherpaOnnx:
|
||||
self.keyword_spotter = sherpa_onnx.KeywordSpotter(
|
||||
provider="cpu",
|
||||
num_threads=1,
|
||||
max_active_paths=4,
|
||||
max_active_paths=8,
|
||||
keywords_score=2.0,
|
||||
keywords_threshold=0.2,
|
||||
num_trailing_blanks=1,
|
||||
num_trailing_blanks=0,
|
||||
keywords_file=get_model_file_path("keywords.txt"),
|
||||
tokens=get_model_file_path("tokens.txt"),
|
||||
encoder=get_model_file_path("encoder.onnx"),
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
import uuid
|
||||
from typing import Any, Callable, ClassVar, Optional
|
||||
|
||||
import numpy as np
|
||||
|
||||
from config import APP_CONFIG
|
||||
from xiaozhi.ref import get_xiaoai
|
||||
|
||||
|
||||
@@ -88,10 +85,7 @@ class MyStream:
|
||||
return
|
||||
|
||||
if len(data) > 0:
|
||||
samples = np.frombuffer(data, dtype=np.int16)
|
||||
# 小爱音箱录音音量较小,需要后期放大一下
|
||||
samples = samples * APP_CONFIG["vad"]["boost"]
|
||||
self.input_bytes.extend(samples.tobytes())
|
||||
self.input_bytes.extend(data)
|
||||
|
||||
def read(self, num_frames=None, exception_on_overflow=False) -> bytes:
|
||||
if num_frames is None:
|
||||
|
||||
Reference in New Issue
Block a user