0
点赞
收藏
分享

微信扫一扫

Python文本转语音并播放

月白色的大狒 2024-06-18 阅读 22

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


举报

相关推荐

0 条评论