WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Speech

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

More on Text to Speech

Keywords: 	 text to speech	Sapi.SpVoice

;Open the SP voice object
v = ObjectOpen("Sapi.SpVoice")

;set a few variables
vol50tag = '<volume level="50">'  ;enclosed in single quotes as string has double quotes in it
vol100tag = '<volume level="100">'  
endvoltag = "</volume>"

;build strings and speak them
speaktext = "This is an example of using XML to control speech."
v.speak(speaktext)

speaktext = StrCat(vol50tag, "This text is spoken at volume level fifty.", endvoltag )
v.speak(speaktext, 8) ; provide the second parameter 8 to specify SVSFIsXML

speaktext = StrCat(vol100tag, "This text is spoken at volume level one hundred.", endvoltag )
V.Speak(speaktext, 8)

speaktext = '<pitch middle="10">This text is spoken at pitch ten.<pitch middle="-10">This text is spoken at pitch zero.</pitch></pitch>'
V.Speak(speaktext, 8)

speaktext = `Homer Simpson, Jack O'Neil, & Bill Meek often say, <rate speed="3"><emph> "Doh" </emph></rate>`
V.Speak(speaktext, 8)

;build todays date in the format of day/month/year
cdt=TimeYmdHms()
year = ItemExtract(1, cdt, ":")
month = ItemExtract(2, cdt, ":") 
day = ItemExtract(3, cdt, ":")
cd = StrCat(day, "/", month, "/", year)

;Show the date format being misunderstood
speaktext = "The test date is said as 01/02/2002 with the format of day, month, year."
V.Speak(speaktext, 8)

;use the context id to correctly speak the date
speaktext = 'Using the context <spell>ID</spell>, the test date is correctly stated as <context id="date_dmy">01/02/2002</context>.'
V.Speak(speaktext, 8)

speaktext = StrCat('Todays date is <context id="date_dmy"> ', cd, ' </context>.')
V.Speak(speaktext, 8)

ObjectClose(v)
Exit

Article ID:   W15710
File Created: 2003:05:28:10:23:14
Last Updated: 2003:05:28:10:23:14