diff --git a/boards/default_src/micropython_esp32c5/origin/build/Mixgo_Sowl_lib-v1.27.0.bin b/boards/default_src/micropython_esp32c5/origin/build/Mixgo_Sowl_lib-v1.27.0.bin index 0186f982..bd57d8dc 100644 Binary files a/boards/default_src/micropython_esp32c5/origin/build/Mixgo_Sowl_lib-v1.27.0.bin and b/boards/default_src/micropython_esp32c5/origin/build/Mixgo_Sowl_lib-v1.27.0.bin differ diff --git a/boards/default_src/micropython_esp32c5/origin/build/lib/sowl_tts.py b/boards/default_src/micropython_esp32c5/origin/build/lib/sowl_tts.py new file mode 100644 index 00000000..66dcf41c --- /dev/null +++ b/boards/default_src/micropython_esp32c5/origin/build/lib/sowl_tts.py @@ -0,0 +1,32 @@ +""" +SOWL-TTS + +MicroPython library for the SOWL-TTS(暂行) +======================================================= +@dahanzimin From the Mixly Team +""" +import gc,time +from esp_tts import TTS +from machine import Pin +from pdm_i2s import PDMTX +from mixgo_sowl import onboard_asr + +audio = PDMTX(dout_pin=Pin(0), sample_rate=16000, buffer_size=1024) +tts = TTS() + +def play(text, speed=3): + try: + onboard_asr.pa_ctrl(1, 100) + if tts.parse_chinese(text): + audio.start() + while True: + data = tts.stream_play(speed) + if not data: + break + else: + xx= audio.write(data) + #time.sleep(0.2) + finally: + onboard_asr.pa_ctrl(0) + audio.stop() + gc.collect() diff --git a/boards/default_src/micropython_esp32c5/origin/config.json b/boards/default_src/micropython_esp32c5/origin/config.json index f50a21fd..30947f9f 100644 --- a/boards/default_src/micropython_esp32c5/origin/config.json +++ b/boards/default_src/micropython_esp32c5/origin/config.json @@ -62,7 +62,7 @@ "type": "command", "portSelect": "all", "micropython:esp32c5:mixgo_sowl": { - "command": "\"{esptool}\" --chip esp32c5 --port {com} --baud {baudrate} --after hard_reset write_flash -e 0x2000 \"{indexPath}/build/Mixgo_Sowl_lib-v1.27.0.bin\" 0x700000 \"{indexPath}/../micropython/build/HZK12.bin\"" + "command": "\"{esptool}\" --chip esp32c5 --port {com} --baud {baudrate} --after hard_reset write_flash -e 0x2000 \"{indexPath}/build/Mixgo_Sowl_lib-v1.27.0.bin\" 0x700000 \"{indexPath}/../micropython/build/HZK12.bin\" 0x400000 \"{indexPath}/../micropython/build/esp_tts_voice_data_xiaole.dat\"" }, "micropython:esp32c5:generic": { "command": "\"{esptool}\" --chip esp32c5 --port {com} --baud {baudrate} --after=no_reset write_flash -e 0x2000 \"{indexPath}/build/Generic_C5_lib-v1.27.0.bin\" 0x3A0000 \"{indexPath}/../micropython/build/HZK12.bin\""