使用下面的代码,我可以列出Windows中安装的所有声音(或者我是这么认为的):
Imports System.Speech.Synthesis..。
Dim sp As New SpeechSynthesizer
Each InstalledVoice As InstalledVoice In sp.GetInstalledVoices()
ListOfInstalledVoices.Add(InstalledVoice)
Next
sp.Dispose()问题是,在我的机器上,它只列出了两种声音(Microsoft David Desktop和Microsoft Zira Desktop),但当我进入Windows Text-To-Speech设置时,它列出了五种声音(David、Linda、Zira、Marc和Richard)。
最初,我认为这可能与32位和64位(这里引用:SpeechSynthesizer doesn't get all installed voices)有关,但事实并非如此(我尝试用x86和x64编译,没有区别)。
我还认为,Marc可能是具有不同年龄设置的David,但无法区分,因为我无法更改David的age属性(它是只读的)。
任何帮助都将不胜感激。
编辑
有人建议我使用speech sdk11 /sdk11运行时--然而,尝试使用SDK11/运行时会让事情变得更糟。我删除了对System.Speech及其相关导入的引用,下载并安装了微软Speech Platform -软件开发工具包(版本11) microsoft.com/en-us/download/details.aspx?id=27226添加了相关的动态链接库(64位)作为引用,并添加了“imports System.Speech.Synthel”,此后,当我编译为x64、x86或AnyCPU时,没有设备报告。然后我尝试了同样的方法,只下载了sdk11运行时并包含了它附带的动态链接库。没有爱。回到原来的状态,让我回到了原来的问题。
发布于 2018-06-19 23:06:44
这将通过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我最初为C# here找到了这个。希望这能有所帮助!
https://stackoverflow.com/questions/49848857
复制相似问题