JaviLG JaviLG - 6 months ago 26
Vb.net Question

How to set the Pitch in Visual Basic?

I can change the Rate and Volume, but the tone is no way .....
There any way to change it?

This is the code:

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;
}
}


Thank you very much for your help!

Answer

Not sure about pitch, but if you are using Microsoft System.Speech.Synthesis, you have a VoiceAge property that takes an enum of Adult or Teen, which affects the sound.

synth.VoiceAge(Adult);