JGuizard
6/26/2016 - 10:19 AM

Text to speech (TTS) in python with os library

Text to speech (TTS) in python with os library

import os
os.system('say "Beer time."')

/*FESTIVAL*/
system("festival " + arg)


/*ESPEAK/*
import os 
import datetime 
def tts(text): 
return os.system("espeak -s 155 -a 200 "+text+" " ) 
m = datetime.datetime.now().strftime("%I %M %S") 
tts("'Sir the time is"+str(int(m[0:2]))+" "+str(int(m[3:5]))+" : ' ") 

/*PYTTSX*/
$ sudo apt-get install sphinx2-bin libsphinx2-dev
 # enter your password when prompted 
$ python -i 
>>> import pyttsx 
>>> engine=pyttsx.init() 
>>> engine.say('Sally sells seashells by the seashore.') 
>>> engine.runAndWait()