如何在Visual Basic中设置音高?

时间:2016-05-13 10:39:37

标签: wpf vb.net visual-studio

我可以改变速率和音量,但音调是不可能的..... 有什么方法可以改变吗?

这是代码:

private void ButtonSpeak_Click(object sender, RoutedEventArgs e)
{
    if (comboVoice.SelectedItem != null)
    synthesizer.SelectVoice(comboVoice.SelectedItem.ToString());
    synthesizer.Volume = Convert.ToInt32(sliderVolume.Value);
    synthesizer.Rate = Convert.ToInt32(sliderRate.Value);
    switch (synthesizer.State)
    {
            //if synthesizer is ready
        case SynthesizerState.Ready:
            synthesizer.SpeakAsync(ConvertRichTextBoxContentsToString());
            ButtonSpeak.Content = "Pause";
            break;
            //if synthesizer is paused
        case SynthesizerState.Paused:
            synthesizer.Resume();
            ButtonSpeak.Content = "Pause";
            break;
            //if synthesizer is speaking
        case SynthesizerState.Speaking:
            synthesizer.Pause();
            ButtonSpeak.Content = "Resume";
            break;
    }
}

非常感谢你的帮助!

1 个答案:

答案 0 :(得分:0)

不确定音高,但是如果您使用的是Microsoft System.Speech.Synthesis,则会有一个VoiceAge属性,其中包含成人或青少年的枚举,这会影响声音。

synth.VoiceAge(Adult);