"""
Convert text into audio file.
"""
# pip install playsound
from playsound import playsound
# pip install gtts
from gtts import gTTS
audio_file = "speech.mp3"
text_to_convert = "Sample text to convert"
language = "en"
speech = gTTS(text=text_to_convert, lang=language, slow=False)
speech.save(audio_file)
playsound(audio_file)
#pip3 install pyttsx3
#apt-get install alsa-utils
import pyttsx3, time
engine = pyttsx3.init()
engine.say("Hi, I am text to speach")
engine.runAndWait()
import pyttsx3
s = pyttsx3.init()
data = "Sample Text"
s.say(data)
s.runAndWait()
import pyttsx3.
# initialize Text-to-speech engine.
engine = pyttsx3.init()
# convert this text to speech.
text = "Python is a great programming language"
engine.say(text)
# play the speech.
engine.runAndWait()