Speech Synthesis Program Text to Voice

Text to Voice Speech Synthesis Program

Speech Synthesis Program in C Sharp Console application is what you write it would speak.

It’s a text to the voice conversion basic program.

Step No, 01:  Create a new project in visual studio by pressing (ctrl + shift + N) Or follow

Go to File à New à Project… then click.

Speech synthesis program c sharp step 1

Choose the project type here you should choose Console.

  1. Select Visual C#
  2. Click on Console Application because we want to do basic practice on console then we will move on windows forms or UWP or WPF.
  3. Provide the name of what you want.
  4. Then click OK.

First of all, before writing the speech program, we need to add the Speech Synthesizer reference in our project.

Right click on you references in solution explorer windows of the project.

Speech synthesis program c sharp step 2

Then a window popup and

Speech synthesis program c sharp step 1

  1. Because we are using. NET framework and it provides many built-in libraries, and we just want to add. So click on Framework or You can search in search for Speech
  2. Now add the Class reference Speech
  3. Click OK.

We have added the Reference, but we don’t specify in our Program.cs namespace

So add the following.

Now it’s time to complete our basic program, but in this tutorial, we also write the entire loop based and user based program to wait unit user want to exit the program.

Speech synthesis program c sharp step 3

  1. Create the object of SpeechSynthesizer type
  2. Prompt to the user to input something. .Speak() method will take that string entered by the user and return the audio of that string.

The output of the above program.

Speech synthesis program c sharp step 4

In the above, I enter the string that Hi! Junaid Ahmed welcome to our speech program. And then press enter the program return the audio sound of the above string.

Now expand the program for many time input until the user wants to exit.

The Complete Code of Speech Synthesis Program

When I execute the program by pressing F5 the program’s output screen popup and wait to input the string so in my case I give the Hi! My name is Junaid Ahmed then press enter the program speak that line of code. Then it prompts that do you want to continue. I press y then program continue so until I press n program will continue to execute.

Leave a Reply

Your email address will not be published. Required fields are marked *

Protected by WP Anti Spam