+
Sample Program: Text to Voice

Sample Program: Text to Voice

Rating:
Rating
(0)
Author: Lilian Dyer
Description:

To learn the anatomy of a C# program. To learn about the files the IDE creates to run a program. To study some sample code to produce voice from text.

You will use Microsoft Visual C# Express 2010 to write this program. This Windows Forms Application sample code actually runs. It uses the new namespace System.Speech.Synthesis to produce voice from text. You will create a form or GUI to interact with the user where the user will enter any text and when pressing the "Speak to me!!" button the user will hear the phrase or sentence she entered.

(more)
See More
Try a College Course Free

Sophia’s self-paced online courses are a great way to save time and money as you earn credits eligible for transfer to over 2,000 colleges and universities.*

Begin Free Trial
No credit card required

25 Sophia partners guarantee credit transfer.

221 Institutions have accepted or given pre-approval for credit transfer.

* The American Council on Education's College Credit Recommendation Service (ACE Credit®) has evaluated and recommended college credit for 20 of Sophia’s online courses. More than 2,000 colleges and universities consider ACE CREDIT recommendations in determining the applicability to their course and degree programs.

Tutorial

A note on Methods

What is the difference between parameters and arguments? They are called parameters when they are defined as values that can be passed to a method.  They are called arguments when a method is called and you pass values to it.

Example of Method definition:

public static int BlahBlahBlah(string thingToSay, int numberOfTimes)

{

   //  statements go here...

  return value

}

 

Example of calling this same method:

int size = BlahBlahBlah("Hello World!", 3);

This method is passing two arguments: 1) The first argument is "Hello World!" of type string; 2) The second argument is a number 3 of type int.

MessageBox.Show("This is an argument");

When you call a method the arguments must be the same type as the types of the parameters. The number of arguments depends on the number of parameters. So a method could have any number of parameters or no parameters at all.

How to Add the System.Speech

  • Go to the Solution Explorer window
  • Right Click on References
  • Choose Add Reference...
  • Choose the tab .NET
  • Scroll down until you find System.Speech
  • Click OK

The Anatomy of a C# Program

Talker

This is the program running...