1
from gtts import gTTS
import winsound

Text = "Hello world"

Audio = gTTS(text=Text,lang="en",slow=False)
Audio.save("T.wav")

winsound.PlaySound("T.wav", winsound.SND_FILENAME)

When the code is run there are no errors but a default windows alert sound is played instead of the test.wav file.

  • 1
    A quick look at the docs indicates that `gtts` only produces audio in MP3 format. Saving the file with a '.wav' extension doesn't magically change the format. And `winsound` only supports WAV. – jasonharper Oct 30 '19 at 19:28

0 Answers0