Use these namespaces:-
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using SpeechLib;
Follow the step to add library reference:-
Add Reference----->
COM---> MicrosoftSpeechObjectLibrary (Add this reference).
Write down this code on button click:-
private void btnClick_Click(object sender, EventArgs e)
{
SpVoice voice = new SpVoice();//Where SpVoice is the Speakers Voice.
voice.Speak(textBox1.Text,SpeechVoiceSpeakFlags.SVSFDefault);
}
No comments:
Post a Comment