Text to speech Male Female voice


#1

We build text to speech converter and its work perfectly, but we want voice selection like male and female. by default it takes male voice but we want female voice also. we try this vb.net code but it gives error like “voice gender is not declare”
synth.SelectVoiceByHints(VoiceGender.Male)
synth.SelectVoiceByHints(VoiceGender.Female)


Text to speech problem
#2

Hi @abhay
do check the sample below i have attached to test female Voice
Voice_test.xaml (6.2 KB)

For Each  Item1 As System.Speech.Synthesis.InstalledVoice  In reader.GetInstalledVoices
		System.Windows.MessageBox.Show(Item1.VoiceInfo.Name)
		Console.WriteLine(Item1.VoiceInfo.Name)
		Next

the above loop is to check how many voice does the System is Configured of in my case i have the following

  1. Microsoft David Desktop:-Male
  2. Microsoft Zira Desktop:-Female

:slight_smile:
Regards
Sanjay Shankhla


#3

thanks @sanjay21051990
error

But when i open your file in UiPath its give me error


#4

hi @Abhay,
which version are you using? the code runs on the ui path 2017.1.6522


#5

@sanjay21051990 18.2.3.0


#6

hi use the below code
Try
Dim reader As System.Speech.Synthesis.SpeechSynthesizer=Nothing
reader=New System.Speech.Synthesis.SpeechSynthesizer()
reader.Dispose()
reader=New System.Speech.Synthesis.SpeechSynthesizer()
reader.SelectVoice(“Microsoft Zira Desktop”)
reader.SetOutputToDefaultAudioDevice
reader.Speak(“HELLO”)
For Each Item1 As System.Speech.Synthesis.InstalledVoice In reader.GetInstalledVoices
System.Windows.MessageBox.Show(Item1.VoiceInfo.Name)
Console.WriteLine(Item1.VoiceInfo.Name)
Next

Catch es As System.Exception
System.Windows.MessageBox.Show(es.Message)
End Try


#7

@sanjay21051990
Main.xaml (8.4 KB)

How can i implement your code in my project, please check if condition


#8

hi @abhay Do you have any invoke Code Activity in you version…just paste the code and run…
that would be more efficient way


#9

@sanjay21051990 in my project i am not using any invoke activity


#10

hi @abhay, then may be you can go for it


#11

thanks @sanjay21051990 i’ll try this


#12

Main.xaml (8.4 KB)

Please check the above project.Its not working,we want robot to read selected file in female voice.


#13

hi,
@abhay,
Is this wat you looking for
Main (3).xaml (12.7 KB)

Tested working :+1:


#14

@sanjay21051990 thank you sir its working properly as i want.