So I am trying to write a python program to speak out a sentence . For this purpose I am trying to use the "gTTS" Python library . It works fine in my Laptop (windows 10) and the sound plays well . However , when I run the same code in Raspberry Pi 2 , the audio file is not played . I have used omxplayer as well as mplayer , but the result remains the same . I have tried using other mp3 files , directly downloaded from the internet , and they work fine . But the files saved through the python program (see below) , do not work .
from gtts import gTTS
import os
print("Converting your text to sound . . .")
tts = gTTS(text="hello world I am doing fine", lang='en')
tts.save("voice.mp3")
print("Starting audio. . .")
os.system("omxplayer voice.mp3")
print("Thank You !!")
The omxplayer just shows the following message and exits .
Please help .