How to save the output of PyTTSx to wav file

后端 未结 3 1199
迷失自我
迷失自我 2021-01-22 09:13

I\'m trying to find a solution why my code doesn\'t work properly. I used solution from Recording synthesized text-to-speech to a file in Python, and it kinda didnt worked out f

3条回答
  •  执笔经年
    2021-01-22 10:04

    from gtts import gTTS
    import os
    tts = gTTS(text='hi how r u', lang='en')
    tts.save("good.wav")
    os.system("mpg321 good.wav")
    

    this code will output will be saved in ur python folder where u installed. for various audio format just change extension file.

提交回复
热议问题