修改翻译bug
authorazao <821478748@qq.com>
Wed, 31 Dec 2025 01:15:33 +0000 (09:15 +0800)
committerazao <821478748@qq.com>
Wed, 31 Dec 2025 01:15:33 +0000 (09:15 +0800)
添加具体语速设置

2.sdk/project/7PIN_1_5/sdk/services/microPython/ports/quectel/core/ai_VC.py
2.sdk/project/7PIN_1_5/sdk/services/microPython/ports/quectel/core/protocol.py
2.sdk/project/7PIN_1_5/sdk/services/microPython/ports/quectel/core/voice_record.py

index 24c81fe..d62b618 100644 (file)
@@ -1174,18 +1174,17 @@ class AI_dev(Abstract):
         return self.usb_status
     
     def set_speech_rate(self,event,msg):
-        #msg的取值是0.5,1.0,1.5,2.0
+        #msg的取值是0.5~2.0
         #而语速初始值是0,范围是-50~50
-        print("已进入设置速率")
         rate = 0
         if msg == 0.5:
             rate = -50
-        elif msg == 1.0:
-            rate = 0
-        elif msg == 1.5:
-            rate = 25
-        elif msg == 2.0:
-            rate = 50
+        elif msg < 1:
+            rate = (msg - 1)* 100
+        elif msg >= 1:
+            rate = (msg - 1)* 50
+        rate = round(rate)
+        print("速率已经设置为:{}".format(rate))
         EventMesh.publish("rate_change",rate)
         return rate
     def btnInfo_queue_thread(self):
@@ -3074,7 +3073,7 @@ class AI_VC(Abstract):
         print("查询语速处理:原始数据为:{}".format(self.speech_rate))
         y = 1
         if self.speech_rate >= -50 and self.speech_rate < 0:#负数
-            y = 0.01 * self.speech_rate 
+            y = 1 - (-0.01 * self.speech_rate) 
         elif self.speech_rate <= 50 and self.speech_rate >= 0:#正数
             y = 0.02 * self.speech_rate + 1.0
         print("处理后数据为{}".format(y))
index 83e99b6..0ba3af3 100644 (file)
@@ -2730,11 +2730,8 @@ def ai_cmd_handle(cmd):
         voice_start_index = cmd.index("语速倍速设置为:") + len("语速倍速设置为:")#动态判断截取部分
         find = cmd[voice_start_index:]#查询截取
         print("find = {}".format(find))
-        if find == "0.5" or find == "1.0" or find == "1.5" or find == "2.0":
-            EventMesh.publish("SET_SPEECH_RATE",float(find))
-            tts_play_str = "语速已经改为" + find
-        else:
-            tts_play_str = "这个不支持哦,请换一个"
+        EventMesh.publish("SET_SPEECH_RATE",float(find))
+        tts_play_str = "语速已经改为" + find
         EventMesh.publish("play_tts",[tts_play_str,0])
     elif "聆听" in cmd:#聆听快/慢一些
         if "快" in cmd:
index dc4ff2f..428b12a 100644 (file)
@@ -218,7 +218,7 @@ class VOICE_RECORD(Abstract): #静默录音
                                 EventMesh.publish("stop_voice_record")
                                 EventMesh.publish("SEND_TRANSAUDIO_TO_IOT",[read_buf,self.msgid_int,0])
                                 break
-                            EventMesh.publish("SEND_MEETAUDIO_TO_IOT",[read_buf,self.msgid_int,self.start_voice_record_flag])
+                            EventMesh.publish("SEND_TRANSAUDIO_TO_IOT",[read_buf,self.msgid_int,self.start_voice_record_flag])
                         if self.start_voice_record_flag == 0:
                             break
                     except Exception as e: