import Sapi5, time, os
av = Sapi5.Create()
Mike = Sapi5.Create( {"name":"Mike", "pitch":1, "rate":1})
Mary = Sapi5.Create( {"name":"Mary", "pitch":1, "rate":-1})
SYNC = av._sync
ASYNC = av._async
PURGE = av._purge
ISFILE = av._is_filename
XML = av._xml
NOT_XML = av._not_xml
PERSIST = av._persist_xml
PUNC = av._punc
WAIT = av._wait
av.Speak("Hello!")
av.Speak( "I am speaking in the default voice!")
av.Speak( "Number of voices is: %d" % av.getVoiceCount())
av.read_Voices()
Mike.Speak( "Hello! Now saying the punctuation in this sentence.", PUNC)
time.sleep(.5)
Mary.Speak( "Mary and Mike are saving a wav file!")
time.sleep(.5)
av.SpeakToWav( 'spain.wav', 'Mary says, The rain in Spain falls mainly on the plain.', 'Mary')
av.SpeakFromWav( 'spain.wav', ASYNC)
av.SpeakToWav( "test.wav", "Mike says, Hello To The World!", "Mike")
av.SpeakFromWav( "test.wav", SYNC)
time.sleep(.5)
av.setVoiceByName( "Mary")
Mike.setPitch(5)
Mike.setVolume( 100)
Mike.Speak( " The Volume Is Set At Speaker Volume!")
av.setRate( 5)
av.setPitch(5)
av.Speak( "Rate At 75%, and Pitch 5 or 75% of maximum pitch!")
time.sleep(1)
av.setPitch(0)
av.setRate(0)
av.Speak( "The rate and pitch are now set for normal!")
#av.setVoiceByName( "eSpeak-EN+M2")
#av.Speak("Hello! I am a eSpeak man!")
av.Speaking( "Spell This! Spell This! ", XML)
time.sleep(1)
av.setVoiceByName( "Mary")
av.Speak( "Hit enter key to stop speaking!")
Mike.Speak( "Hey! Hit enter key!")
av.setPitch(10)
av.Speak("Pitch 100%", ASYNC)
av.setPitch(5)
av.Speak("Pitch 75%", ASYNC)
av.setPitch(0)
av.Speak("Pitch 50%", ASYNC)
av.setPitch( -5)
av.Speak("Pitch 25%", ASYNC)
av.setPitch( -10)
av.Speak("Pitch 0%", ASYNC)
av.setPitch(0)
Mike.Speak( "Hit enter key!", ASYNC)
hit = raw_input("Hit enter key >")
av.Speak(" Mary Says, Now Good bye", ASYNC, PURGE)
Mike.Speak(" Mike Says, Hey! Good bye", ASYNC, PERSIST)
av.setVoiceByName( "Sam")
av.Speak( " Sam says goodbye")
Mike.Speak( " goodbye")
Mary.Speak( " goodbye")
Mary.terminate()
Mike.terminate()
av.terminate()