System.Speech.Synthesis.SpeechSynthesizer - 如何自定义语音?

Sas*_*nyi 4 c# text-to-speech

SpeechSynthesizer允许通过使用SelectVoiceByHints(VoiceGender, VoiceAge)函数来峰化不同的声音(据我所知 ).但是,如果我改变性别和语音年龄,就不会进行定制.

你能解释一下原因吗?如果我做错了什么,这样做的正确方法是什么?

谢谢.

Han*_*ant 13

这是一个小型测试程序,可用于发现安装的声音:

using System;
using System.Speech.Synthesis;  // Add reference to System.Speech

class Program {
    static void Main(string[] args) {
        var synth = new SpeechSynthesizer();
        foreach (var voice in synth.GetInstalledVoices()) {
            Console.WriteLine(voice.VoiceInfo.Description);
        }
        Console.ReadLine();
    }
}
Run Code Online (Sandbox Code Playgroud)

在我的机器上输出:Microsoft Anna - 英语(美国)

这是Windows附带的唯一默认语音.这当然可以解释为什么改变性别和年龄对您的机器没有影响.

  • 是否有可能获得更多声音(西班牙语,...)? (2认同)