如何在VB.NET中更改语音合成器的性别和年龄?

时间:2016-03-28 20:02:41

标签: c# vb.net speech c#-to-vb.net speech-synthesis

我是编程新手。我想改变系统声音的性别和年龄。在VB.NET中的演讲。喜欢这个问题 How I can change the voice synthesizer gender and age in C#
所以,我很困惑如何将此代码声明为VB.NET

foreach (var v in synthesizer.GetInstalledVoices().Select(v => v.VoiceInfo))
    {
        Console.WriteLine("Name:{0}, Gender:{1}, Age:{2}",
          v.Description, v.Gender, v.Age);
    }

感谢提前

1 个答案:

答案 0 :(得分:0)

For Each v As var In synthesizer.GetInstalledVoices().[Select](Function(v) v.VoiceInfo)
    Console.WriteLine("Name:{0}, Gender:{1}, Age:{2}", v.Description, v.Gender, v.Age)
Next

但是这段代码只能获得已安装语音的列表。要为syntesizer设置语音,您需要进行以下操作:

synthesizer.SelectVoiceByHints(VoiceGender.Female, VoiceAge.Adult);

这里有关于此的详细信息(包括VB.NET):https://msdn.microsoft.com/en-us/library/ms586877 以下是VB上的简单代码示例:http://www.phon.ucl.ac.uk/courses/spsci/compmeth/speech/synthesis.html