import pyTTS
import time
tts = pyTTS.Create()
tts.Rate = 1
print "Speech rate =", tts.Rate
tts.Volume = 90
print "Speech volume =", tts.Volume
print "List of voices =", tts.GetVoiceNames()
tts.SetVoiceByName('MSMary')
print "Voice is set ot MSMary"
print
timeStr = "The date and time is " + time.asctime()
print timeStr
tts.Speak(timeStr)
print
str1 =
print str1
tts.Speak(str1)
tts.Speak('Haah haa haah haa')
print
str2 =
print str2
print
print "The spoken text above has been written to a wave file (.wav)"
tts.SpeakToWave('Finagle4.wav', str2)
print "The wave file is loaded back and spoken ..."
tts.SpeakFromWave('Finagle4.wav')
print
print "Substitute a hard to pronounce word like Ctrl key ..."
p = pyTTS.Pronounce()
p.AddMisspelled('Ctrl', 'Control')
str3 = p.Correct('Please press the Ctrl key!')
tts.Speak(str3)
print
print "2 * 3 = 6"
tts.Speak('2 * 3 = 6')
print
tts.Speak("sounds goofy, let's replace * with times")
print "Substitute * with times"
p.AddMisspelled(' * ', 'times')
str4 = p.Correct('2 * 3 = 6')
tts.Speak(str4)
print
print "Say that real fast a few times!"
str5 = "The sinking steamer sunk!"
tts.Rate = 3
for k in range(7):
print str5
tts.Speak(str5)
time.sleep(0.3)
tts.Rate = 0
tts.Speak("Wow, not one mispronounced word!")