NOTE:-
CODE:
using System;
using System.Speech.Synthesis;
using System.Windows.Forms;
namespace TTS_Text2Speech_WF
{
public partial class Form1 : Form
{
// Provides access to the functionality of an installed speech synthesis engine.
public Form1()
{
InitializeComponent();
}
SpeechSynthesizer speechEngine = new SpeechSynthesizer();
private void SpeedTrackBar_Scroll(object sender, EventArgs e)
{
speechEngine.Rate = SpeedTrackBar.Value;
}
private void VolumeTrackBar_Scroll(object sender, EventArgs e)
{
speechEngine.Volume = VolumeTrackBar.Value;
}
private void SpeakButton_Click(object sender, EventArgs e)
{
speechEngine.SelectVoiceByHints(VoiceGender.Female);
speechEngine.Volume = VolumeTrackBar.Value;
speechEngine.Rate = SpeedTrackBar.Value;
string textToSpeak = NoteTextBox.Text;
speechEngine.Speak(textToSpeak);
}
}
}
No comments:
Post a Comment