I tried using gTTS module in python for text to speech. However, when I run the code, I am not able to hear anything. I referred to https://pypi.org/project/gTTS/ for the installation and documentation.
(I am using Ubuntu)
My code:
from gtts import gTTS
tts = gTTS('hello')
tts.save('hello.mp3')
I am not getting any errors. However, I am not able to hear anything.
gTTS only converts your text to speech and saves it. You have to use another module like playsound or use an audio player to play your audio file. For example:
from gtts import gTTS
import playsound
tts = gTTS(text='hello', lang='en')
tts.save("hello.mp3")
playsound.playsound("hello.mp3")