Python文本转语音并播放
async def text_audio(text, audio_name): tts = edge_tts.Communicate( text=text, voice="zh-CN-XiaoxiaoNeural") await tts.save(audio_name)
audio_name = "xxx.mp3" pygame.mixer.Sound.play(audio_name) while pygame.mixer.get_busy(): pygame.time.Clock().tick()
edge_tts: 文本转语音
pygame:播放
https://github.com/rany2/edge-tts
本文来自博客园,作者:一石数字欠我15w!!!,转载请注明原文链接:https://www.cnblogs.com/52-qq/p/18245579