更新自强 支持TTS播报
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -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()
|
||||||
@@ -118,7 +118,7 @@
|
|||||||
"type": "command",
|
"type": "command",
|
||||||
"portSelect": "all",
|
"portSelect": "all",
|
||||||
"micropython:esp32s3:mixgo_sant": {
|
"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": {
|
"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\""
|
"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",
|
"offset": "0xF00000",
|
||||||
"path": "../micropython/build/HZK16_GBK.bin"
|
"path": "../micropython/build/HZK16_GBK.bin"
|
||||||
|
}, {
|
||||||
|
"offset": "0xC00000",
|
||||||
|
"path": "../micropython/build/esp_tts_voice_data_xiaole.dat"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user