Skip to main content

How to Convert Text Input to Speech Output

How to convert text input to speech output

The usage of text to speech is been increasing day by day, one of the main applications are automatic birthday wish speaker. VB.NET provides simple steps to convert text to speech, they are

1) Import the text to speech library
2) Create a SpeechSynthesizer instance
3) Use speak method.


1) Import the text to speech library

.net framework provides few classes to support text to speech functionalities in the assembly called System.Speech.Synthesis. to import this library, just go to project->add reference. Under the add reference dialog, choose the .NET tab and add the System.Speech assembly.

Once it is done, just import the assembly like,
Imports System.Speech.Synthesis

2) Create a SpeechSynthesizer instance

SpeechSynthesizer is a class which is ment for converting the text into voice. So lets create an instance of the class SpeechSynthesizer.
Dim a As New SpeechSynthesizer

3) Use Speak method

a.speak(“your text”)

How to speak in background?
When you use the speak() methid, you will notice that the application hangs until the speech is over. To eliminate this, there is one more method called SpeakAsync() which speaks in background. This method is much useful when the text is very long, and there are lots of parallel activities that needs to be done.
a.SpeakAsync (“your text”)

How to change volume of the speech?
There is an attribute called as Volume, this is used to set the volume of the speech.

NOTE: Volume must always be between 0 to 100.

How to change the rate of speech?
Sometimes it is necessary to increase/decrease the speed of speech. This can be done by rate attribute.
NOTE: rate must always between -10 to 10.

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.


1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

Add new comment

This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.