|
楼主 |
发表于 2020-5-22 14:44
|
显示全部楼层
[mw_shl_code=python,true]#MicroPython动手做(25)——语音合成与语音识别
#测试文字转语音
from mpython import *
import network
import ntptime
from xunfei import *
import audio
my_wifi = wifi()
my_wifi.connectWiFi("zh", "zy1567")
while True:
try:
ntptime.settime(8, "time.windows.com")
break
except:
pass
Text = "掌控板TTS文字转语音以及语音识别"
Audio = "tts.pcm"
speech_tts = Xunfei_speech("5ec66b", "5d32b259f15b2902d81b9efd22926", "3aace39c0ecea76ef46a200300826", mode=MODE_TTS, AudioFile=Audio, Text=Text)
print("Processing, please wait....")
speech_tts.tts()
audio.player_init()
audio.set_volume(100)
audio.play(Audio)[/mw_shl_code]
|
|