Reputation: 3863
With the following code I can list all the voices installed in Windows (or so I thought):
Imports System.Speech.Synthesis
...
Dim sp As New SpeechSynthesizer
Each InstalledVoice As InstalledVoice In sp.GetInstalledVoices()
ListOfInstalledVoices.Add(InstalledVoice)
Next
sp.Dispose()
The problem is that on my machine it only lists two voices (Microsoft David Desktop and Microsoft Zira Desktop) but when I go into the Windows Text-To-Speech settings there are five voices listed (David, Linda, Zira, Marc, and Richard).
Originally I thought it my have to do with 32bit vs 64bit (as referenced here: SpeechSynthesizer doesn't get all installed voices), but it does not (I tried compiling with x86 and x64 and there was no difference).
I also thought perhaps, Marc might be David with a different age setting, but could not tell because I can't change the age attribute on David (it is read only).
Any help would be appreciated.
Edit
It was suggested I use the speech sdk 11 / sdk11 runtime - However, trying to use sdk 11 / runtime made matters worse. I removed the reference to System.Speech and its associated imports, downloaded and installed Microsoft Speech Platform - Software Development Kit (SDK) (Version 11) microsoft.com/en-us/download/details.aspx?id=27226 added the associated dll (64 bit) as a reference and added the 'Imports System.Speech.Synthesis', After this, there were no devices reported when I compiled as x64, x86 or AnyCPU. I then tried the same by downloading just the sdk11 runtime and including the dll that came with it. No love. Reverting back to the original reverted me back to my original problem.
Upvotes: 0
Views: 504
Reputation: 157
This will output a list of the text-to-speech voices via VB:
Imports System.Speech.Synthesis
Module Module1
Sub Main()
Dim synth As SpeechSynthesizer = New SpeechSynthesizer()
For Each voice In synth.GetInstalledVoices()
Console.WriteLine(voice.VoiceInfo.Name)
Next
Console.ReadLine()
End Sub
End Module
I originally found this for C# here. Hopefully that helps!
Upvotes: 0