31 lines
1.2 KiB
Plaintext
31 lines
1.2 KiB
Plaintext
|
1、ASR
|
|||
|
D:\dsWork\QingLong\XiaoZhi\xiaozhi-esp32-server\main\xiaozhi-server\core\handle\receiveAudioHandle.py
|
|||
|
|
|||
|
在第12行,大约这个位置下断点,可以跟踪到流程
|
|||
|
async def handleAudioMessage(conn, audio):
|
|||
|
if not conn.asr_server_receive:
|
|||
|
|
|||
|
某些场景下,在38行下断点可以拦截到内容
|
|||
|
if conn.client_voice_stop:
|
|||
|
conn.client_abort = False
|
|||
|
conn.asr_server_receive = False
|
|||
|
# 音频太短了,无法识别
|
|||
|
if len(conn.asr_audio) < 15:
|
|||
|
conn.asr_server_receive = True
|
|||
|
else:
|
|||
|
text, file_path = await conn.asr.speech_to_text(
|
|||
|
conn.asr_audio, conn.session_id
|
|||
|
)
|
|||
|
|
|||
|
跟踪进入
|
|||
|
D:\dsWork\QingLong\XiaoZhi\xiaozhi-esp32-server\main\xiaozhi-server\core\providers\asr\fun_local.py
|
|||
|
76行
|
|||
|
async def speech_to_text(self, opus_data: List[bytes], session_id: str) -> Tuple[Optional[str], Optional[str]]:
|
|||
|
"""语音转文本主处理逻辑"""
|
|||
|
file_path = None
|
|||
|
try:
|
|||
|
|
|||
|
准备在第97行嵌入代码:
|
|||
|
#【黄海注释】准备在这里进行嵌入代码,把文字+声音的关系记录下来,让用户选择是哪个人进行声纹匹配
|
|||
|
|
|||
|
return text, file_path
|