The voice of a robot
Python
from num2words import num2words
from subprocess import call
import time
text = input("Enter the Text: ")
cmd_beg= 'espeak '
cmd_end= ' | aplay /home/pi/Desktop/Texti.wav 2>/dev/null' # To play back the stored .wav file and to dump the std errors to /dev/null
cmd_out= '--stdout > /home/pi/Desktop/Texti.wav ' # To store the voice file
print(text)
#Replacing ' ' with '_' to identify words in the text entered
text = text.replace(' ', '_')
#Calls the Espeak TTS Engine to read aloud a Text
call([cmd_beg+cmd_out+text+cmd_end], shell=True)
import subprocess
subprocess.call(['aplay -fdat /home/pi/Desktop/Texti.wav'], shell=True)