print("AI_VC_start3")
self.VC_state = VC_State_None
- if self.AI_TTS_str == "":#没有tts要播放的时候才开始录音
+ if self.AI_TTS_str == "" and self.AI_new_voice_url == "":#没有tts要播放的时候才开始录音 并音频路径为空
#开始asr录音
self.VC_Speech_Start()#开启线程获取录音数据
self.VC_state = VC_State_SpeechStart
- #开始未读语音消息
- def AI_client_VC_send_speech(self,url):
- json_data = \
- {
- "event": "audio.convert",
- "payload": {
- "audio_convert_request": {
- "audio_url": url,
- "bit_depth": 16,
- "channels": 1,
- "sample_rate": 16000,
- "target_format": "pcm"
- }
- }
- }
- self.websocket_deconnect_VC()
- self.AI_audio_queue_thread_close()
- self.AI_VC_start()
- self.AI_client_VC_send(ujson.dumps(json_data))
#结束上传语音
def AI_client_VC_end_speech(self):
json_data = \
url = str(data["url"])
# url = "http://qipaiai-oss1.tos-cn-beijing.volces.com/qi_pai_ringtone/2025_08_11/742659759219544064test.mp3"
self.play_new_voice_state = 1
- EventMesh.publish("play_new_voice",[url,0])
+ EventMesh.publish("play_new_voice",[url,1])
break
pass
if "data" in msg:
play_tts_text = msg["data"]
try:
- EventMesh.publish("play_tts",[play_tts_text,0])
+ EventMesh.publish("play_tts",[play_tts_text,1])
recv_state = 1
except Exception as e:
print("下发文字留言出错了")