mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-27 09:33:55 +08:00
@@ -232,6 +232,9 @@ ASR:
|
|||||||
appid: 你的火山引擎语音合成服务appid
|
appid: 你的火山引擎语音合成服务appid
|
||||||
access_token: 你的火山引擎语音合成服务access_token
|
access_token: 你的火山引擎语音合成服务access_token
|
||||||
cluster: volcengine_input_common
|
cluster: volcengine_input_common
|
||||||
|
# 热词、替换词使用流程:https://www.volcengine.com/docs/6561/155738
|
||||||
|
boosting_table_name: (选填)你的热词文件名称
|
||||||
|
correct_table_name: (选填)你的替换词文件名称
|
||||||
output_dir: tmp/
|
output_dir: tmp/
|
||||||
TencentASR:
|
TencentASR:
|
||||||
# token申请地址:https://console.cloud.tencent.com/cam/capi
|
# token申请地址:https://console.cloud.tencent.com/cam/capi
|
||||||
|
|||||||
@@ -88,6 +88,8 @@ class ASRProvider(ASRProviderBase):
|
|||||||
self.appid = config.get("appid")
|
self.appid = config.get("appid")
|
||||||
self.cluster = config.get("cluster")
|
self.cluster = config.get("cluster")
|
||||||
self.access_token = config.get("access_token")
|
self.access_token = config.get("access_token")
|
||||||
|
self.boosting_table_name = config.get("boosting_table_name")
|
||||||
|
self.correct_table_name = config.get("correct_table_name")
|
||||||
self.output_dir = config.get("output_dir")
|
self.output_dir = config.get("output_dir")
|
||||||
self.delete_audio_file = delete_audio_file
|
self.delete_audio_file = delete_audio_file
|
||||||
|
|
||||||
@@ -136,7 +138,13 @@ class ASRProvider(ASRProviderBase):
|
|||||||
"user": {
|
"user": {
|
||||||
"uid": str(uuid.uuid4()),
|
"uid": str(uuid.uuid4()),
|
||||||
},
|
},
|
||||||
"request": {"reqid": reqid, "show_utterances": False, "sequence": 1},
|
"request": {
|
||||||
|
"reqid": reqid,
|
||||||
|
"show_utterances": False,
|
||||||
|
"sequence": 1,
|
||||||
|
"boosting_table_name": self.boosting_table_name,
|
||||||
|
"correct_table_name": self.correct_table_name,
|
||||||
|
},
|
||||||
"audio": {
|
"audio": {
|
||||||
"format": "raw",
|
"format": "raw",
|
||||||
"rate": 16000,
|
"rate": 16000,
|
||||||
@@ -232,14 +240,6 @@ class ASRProvider(ASRProviderBase):
|
|||||||
|
|
||||||
return pcm_data
|
return pcm_data
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def read_wav_info(data: io.BytesIO = None) -> (int, int, int, int, int):
|
|
||||||
with io.BytesIO(data) as _f:
|
|
||||||
wave_fp = wave.open(_f, "rb")
|
|
||||||
nchannels, sampwidth, framerate, nframes = wave_fp.getparams()[:4]
|
|
||||||
wave_bytes = wave_fp.readframes(nframes)
|
|
||||||
return nchannels, sampwidth, framerate, nframes, len(wave_bytes)
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def slice_data(data: bytes, chunk_size: int) -> (list, bool):
|
def slice_data(data: bytes, chunk_size: int) -> (list, bool):
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user