articles

Home / DeveloperSection / Articles / Text to Speech in CSharp .NET

Text to Speech in CSharp .NET

Uttam Misra7540 28-Jul-2010

Here I’m about to explain Text to Speech feature of C#. This simple example will demonstrate how to use Text to Speech feature of C#.

Example

Text to Speech in CSharp .NET

               Form Design
Code
Namespace for voice
using SpeechLib;
 
namespace TextTospeech
{
    publicpartialclassForm1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
 
        privatevoid btnSpeak_Click(object sender, EventArgs e)
        {
//creating instance of voice
            SpVoice v = newSpVoice();
//Setting Rate of voice
            v.Rate = 2;
//calling speak() method of SpVoice class.
            v.Speak(rtxtSpeech.Text, SpeechVoiceSpeakFlags.SVSFPurgeBeforeSpeak);
        }
    }
}

Updated 05-Jun-2020
More than 18 years of working experience in IT sector. We are here to serve you best.

Leave Comment

Comments

Liked By