Testing WIN10 System.Speech

Started by stanl, February 16, 2019, 10:43:59 AM

Previous topic - Next topic

stanl

Code (WINBATCH) Select


;Winbatch 2018B - Win10 Voices
;==================================================================
ObjectClrOption("useany","System.Speech")
oSpeech = ObjectClrNew( "System.Speech.Synthesis.SpeechSynthesizer")
oVoices=oSpeech.GetInstalledVoices()


voices="Name,Gender,Age,Culture,Description,ID":@CRLF
isVoice=0
ForEach v in oVoices
   oV=v.VoiceInfo
   n=oV.Name
If StrIndex(n,"David",0,@FWDSCAN)>0 ;or pick your own
   n1=n
   isVoice=1
Endif
   g=oV.Gender
a=OV.Age
c=OV.Culture
d=oV.Description
i=oV.Id
voices = voices:n:",":g:",":a:",":c:",":d:",":i:",":@CRLF
Next
Message("Voices",voices)


If isVoice
   oSpeech.SelectVoice(n1)
talk="I want my MTV!":n1
oSpeech.Speak(talk)
Endif
oVoices=0
oSpeech=0
Exit
;==================================================================