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

System_Speech

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

Speak

 Keywords:  Speech Speak System.Speech System.Speech.Synthesis.SpeechSynthesizer Voice Text to Speech Microsoft Anna GetInstalledVoices


;***************************************************************************
;** Playing Around with CLR speech  [default voice]
;**
;** Reference: 
;**       REQUIRES WinBatch 2013A or newer & CLR version 3.0 
;**
;** Stan LittleField, Deana Falk June 29,2013
;*************************************************************************** 
If Version( )< '2013A' 
   Pause('Notice', 'Need 2013A or Newer Version of WinBatch')
   Exit 
EndIf
ObjectClrOption("use","System.Speech, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")
oSpeech = ObjectClrNew('System.Speech.Synthesis.SpeechSynthesizer')
;this is just the default voice, on Win7 it is Microsoft Anna
cVoice = ""
cName=oSpeech.Voice.Name
cVoice=cVoice:"Name: ":cName:@CRLF
cVoice=cVoice:"Culture: ":oSpeech.Voice.Culture:@CRLF
cVoice=cVoice:"Age: ":oSpeech.Voice.Age:@CRLF
cVoice=cVoice:"Gender: ":oSpeech.Voice.Gender:@CRLF
cVoice=cVoice:"Description: ":oSpeech.Voice.Description:@CRLF
cVoice=cVoice:"ID: ":oSpeech.Voice.Id:@CRLF 
;this will obtain an object, you can iterate with a ForEach
;If oSpeech.Voice.SupportedAudioFormats.Count != 0 Then cVoice=cVoice:"Audio Formats: ":oSpeech.Voice.SupportedAudioFormats:@CRLF
oSpeech.SelectVoice(cName)
oSpeech.Speak("This is a Test")
oSpeech.Dispose()
oSpeech=0
Message("",cVoice)
Exit


;***************************************************************************
;** Playing Around with CLR speech
;**
;** Reference: 
;**       REQUIRES WinBatch 2013A or newer & CLR version 3.0 
;**
;** Stan LittleField, Deana Falk  June 29,2013
;*************************************************************************** 
If Version( )< '2013A' 
   Pause('Notice', 'Need 2013A or Newer Version of WinBatch')
   Exit 
EndIf
ObjectClrOption("use","System.Speech, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")
;create an object for the class that controls speech
oSpeech = ObjectClrNew('System.Speech.Synthesis.SpeechSynthesizer')
cVoices = ""
ForEach v In oSpeech.GetInstalledVoices()
   info = v.VoiceInfo 
   cVoices=cVoices:info.Name:@TAB
Next
n=ItemCount(cVoices,@TAB)-1
Message(n,cVoices)                  
For i=1 To n
   oSpeech.SelectVoice(ItemExtract(i,cVoices,@TAB))
   oSpeech.Speak("This is a Test")
   TimeDelay(1)
Next
oSpeech.Dispose()
oSpeech=0
Exit

Article ID:   W17842
Filename:   Speak.txt
File Created: 2013:07:01:08:41:44
Last Updated: 2013:07:01:08:41:44