GjdGr8
GjdGr8

Reputation: 171

How to make the computer speak in python?

I tried to use gtts:

from gtts import gTTs
import os

tts = gTTS(text='Good morning', lang='en')
tts.save("good.mp3")
os.system("mpg321 good.mp3")

But I got this error:

'mpg321' is not recognized as an internal or external command operable program or batch file.

Why does this happen? I even have portaudio but do not know how to do it.

Upvotes: 0

Views: 728

Answers (1)

GjdGr8
GjdGr8

Reputation: 171

mpg is a complex way to make the computer speak

tried to use playsound its easy to install via pip and isn't so complicated. all you have to do is type in

playsound("good.mp3")

Upvotes: 1

Related Questions