更新自强 支持TTS播报

This commit is contained in:
dahanzimin
2025-12-04 16:32:26 +08:00
parent cba45d0e2e
commit 9ee32c3c7e
5 changed files with 35 additions and 1 deletions

View File

@@ -0,0 +1,31 @@
"""
SANT-TTS
MicroPython library for the SANT-TTS(暂行)
=======================================================
@dahanzimin From the Mixly Team
"""
import gc
from esp_tts import TTS
from machine import Pin
from pwm_audio import PWMAudio
from mixgo_sant import onboard_bot
audio = PWMAudio(Pin(46))
tts = TTS()
def paly(text, speed=3):
try:
onboard_bot.spk_en(1, 100)
if tts.parse_chinese(text):
audio.start()
while True:
data = tts.stream_play(speed)
if not data:
break
else:
audio.write(data)
finally:
onboard_bot.spk_en(0)
audio.stop()
gc.collect()

View File

@@ -118,7 +118,7 @@
"type": "command",
"portSelect": "all",
"micropython:esp32s3:mixgo_sant": {
"command": "\"{esptool}\" --chip esp32s3 --port {com} --baud {baudrate} --after hard_reset write_flash -e 0x0 \"{indexPath}/build/Mixgo_Sant_lib_DL-v1.25.0.bin\" 0xF00000 \"{indexPath}/../micropython/build/HZK16_GBK.bin\""
"command": "\"{esptool}\" --chip esp32s3 --port {com} --baud {baudrate} --after hard_reset write_flash -e 0x0 \"{indexPath}/build/Mixgo_Sant_lib_DL-v1.25.0.bin\" 0xF00000 \"{indexPath}/../micropython/build/HZK16_GBK.bin\" 0xC00000 \"{indexPath}/../micropython/build/esp_tts_voice_data_xiaole.dat\""
},
"micropython:esp32s3:mixgo_nova": {
"command": "\"{esptool}\" --chip esp32s3 --port {com} --baud {baudrate} --after hard_reset write_flash -e 0x0 \"{indexPath}/build/Mixgo_Nova_lib-v1.21.0.bin\" 0x700000 \"{indexPath}/../micropython/build/HZK12.bin\""
@@ -186,6 +186,9 @@
}, {
"offset": "0xF00000",
"path": "../micropython/build/HZK16_GBK.bin"
}, {
"offset": "0xC00000",
"path": "../micropython/build/esp_tts_voice_data_xiaole.dat"
}
]
},