Users Pricing

articles

Home Articles Text to Speech in CSharp .NET – MindStick

Text to Speech in CSharp .NET

Uttam Misra 8347 28 Jul 2010 Updated 05 Jun 2020

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
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
 
        private void btnSpeak_Click(object sender, EventArgs e)
        {
//creating instance of voice
            SpVoice v = new SpVoice();
//Setting Rate of voice
            v.Rate = 2;
//calling speak() method of SpVoice class.
            v.Speak(rtxtSpeech.Text, SpeechVoiceSpeakFlags.SVSFPurgeBeforeSpeak);
        }
    }
}

Uttam Misra

Information Technology

More than 18 years of working experience in IT sector. We are here to serve you best.


Markdown for AI

A clean, structured version of this page for AI assistants and LLMs.

Open .md