Click here to Skip to main content
13,149,756 members (82,070 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as

Stats

25.2K views
457 downloads
24 bookmarked
Posted 12 Nov 2014

Computer Talker with C#

, 12 Nov 2014
Rate this:
Please Sign up or sign in to vote.
Write a program to make your computer talk for you.

Introduction

Write a simple program to make your computer talk for you.

Using the Code

  1. Add a textbox named 'txtWords' to a form.
  2. Add a button named 'btnSpeak' to a form.
  3. Add a reference to System.Speech.
  4. In the form's code-behind, add:
    using System.Windows.Forms;
    using System.Speech.Synthesis;
    
    namespace Sample
    {
     public partial Class Form1: Form
     {
      public SpeechSynthesizer _synthesizer;
      private void btnSpeak_Click(object sender, EventArgs e)
      {
       _synthesizer = new SpeechSynthesizer();
       var words = txtWords.Text;
       _synthesizer.Speak(Words);
      }
      public Form1()
      {
       InitializeComponent();
      }
     }
    }
  5. Run. Text entered into the textbox will be spoken by the computer.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

The Operator
Oproot Research
United States United States
+


Oproot Research
Research, Development
Science Experiments
Photography, Reading

You may also be interested in...

Comments and Discussions

 
GeneralMy vote of 5 Pin
WeaselWes15-Nov-14 5:16
memberWeaselWes15-Nov-14 5:16 
QuestionShort, Sweet and to the Point Pin
StevieLee14-Nov-14 4:12
memberStevieLee14-Nov-14 4:12 
AnswerRe: Short, Sweet and to the Point Pin
The Operator14-Nov-14 5:36
memberThe Operator14-Nov-14 5:36 
AnswerRe: Short, Sweet and to the Point Pin
Bruno Sprecher15-Nov-14 0:38
memberBruno Sprecher15-Nov-14 0:38 
QuestionWhy the class level SpeechSynthesizer variable? Pin
spencepk13-Nov-14 9:53
memberspencepk13-Nov-14 9:53 
AnswerRe: Why the class level SpeechSynthesizer variable? Pin
The Operator13-Nov-14 11:12
memberThe Operator13-Nov-14 11:12 
GeneralMy vote of 2 Pin
Tammam Koujan12-Nov-14 21:32
professionalTammam Koujan12-Nov-14 21:32 
GeneralRe: My vote of 2 Pin
aeastham13-Nov-14 2:23
memberaeastham13-Nov-14 2:23 
GeneralRe: My vote of 2 Pin
Tammam Koujan13-Nov-14 3:22
professionalTammam Koujan13-Nov-14 3:22 
GeneralRe: My vote of 2 Pin
The Operator13-Nov-14 7:41
memberThe Operator13-Nov-14 7:41 
GeneralMy vote of 5 Pin
Humayun Kabir Mamun12-Nov-14 17:39
memberHumayun Kabir Mamun12-Nov-14 17:39 
GeneralMy vote of 1 Pin
emrea12-Nov-14 8:56
memberemrea12-Nov-14 8:56 
GeneralMy vote of 5 Pin
Mahsa Hassankashi12-Nov-14 8:38
memberMahsa Hassankashi12-Nov-14 8:38 
GeneralMy vote of 5 Pin
Bruno Sprecher12-Nov-14 8:15
memberBruno Sprecher12-Nov-14 8:15 
GeneralRe: My vote of 5 Pin
The Operator12-Nov-14 8:26
memberThe Operator12-Nov-14 8:26 
GeneralMy vote of 4 Pin
newton.saber12-Nov-14 7:48
membernewton.saber12-Nov-14 7:48 
GeneralRe: My vote of 4 Pin
The Operator12-Nov-14 8:27
memberThe Operator12-Nov-14 8:27 
SuggestionNice tip! Pin
Afzaal Ahmad Zeeshan12-Nov-14 7:46
professionalAfzaal Ahmad Zeeshan12-Nov-14 7:46 
GeneralMy vote of 2 Pin
Mladen Borojevic19-Mar-14 23:02
memberMladen Borojevic19-Mar-14 23:02 
QuestionJust basic stuff :) Pin
Masked Dev19-Mar-14 6:20
memberMasked Dev19-Mar-14 6:20 
AnswerRe: Just basic stuff :) Pin
The Operator12-Nov-14 7:36
memberThe Operator12-Nov-14 7:36 
GeneralMy vote of 2 Pin
Sacha Barber19-Mar-14 2:56
mvpSacha Barber19-Mar-14 2:56 
GeneralRe: My vote of 2 Pin
Bruno Sprecher12-Nov-14 6:38
memberBruno Sprecher12-Nov-14 6:38 
QuestionAlso see... Pin
Ravi Bhavnani18-Mar-14 19:21
professionalRavi Bhavnani18-Mar-14 19:21 
AnswerRe: Also see... Pin
The Operator12-Nov-14 7:34
memberThe Operator12-Nov-14 7:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170924.2 | Last Updated 12 Nov 2014
Article Copyright 2014 by The Operator
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid