Intro to the Text to Speech Project

Text to Speech: For C# and VB NET Students


In this walkthrough, you'll write a Text to Speech program in either C# or Visual Basic .NET (or both, if you're feeling adventurous!). It will look like this:

A Windows Form for a Text to Speech program

This lesson shows how to check for installed voices on your computer. But here's a list of what you'll be doing in this project:

  • How to get a list of inbuilt Voices on your Windows computer
  • Select a Voice from a dropdown list
  • Use the Speech Synthesizer in C# and VB Net
  • Adjust the speed and volume of the chosen Voice
  • How to use Sliders (TrackBars) in C# and VB
  • Read out Word files, PDF documents and text files
  • How to use the NuGet Package Manager in Visual Basic
  • Highlight a word or phrase and have that pronounced
  • Read out text grabbed from a webpage

(Note: This program was written using the Windows 10 operating system. I haven't tested it on Windows 7 or 8. Might still work, and you can skip this section, if you don't have Windows 10. Also, you don't need to add the Word feature, if you don't have Microsoft Word.)

Before we get to anything else, let's see what voices you have on your computer.

In the search box at the bottom of Windows 10, type Control Panel.

searching for the Control Panel in Windows 10

Launch the Control Panel window and select the Ease of Access item:

The Ease of Access item highlighted in the Windows 10 Control Panel

From the Ease of Access screen, select the Speech Recognition item:

The Ease of Access panel showing the Speech Recognition item highlighted

From the Speech Recognition screen, select Text to Speech on the left:

The Speech Recognition panel showing the Text to Speech item highlighted

When you select Text to Speech, you should see this dialog box appear:

The Speech Properties dialog box in Windows 10

Click the dropdown box at the top under Voice Selection to see what voices you have:

The Voice Selection dropdown list on the Speech Properties dialog box

In the image above, you can see that we have three voices: Hazel, David and Zira.

If you don't see any voices, or only one, you can add voices through the Settings screen.

Close down the speech dialog box and the Control Panel. In the Windows 10 search box, type Settings then launch the Settings screen. Click on the Time and Language item:

The Windows 10 Settings page showing the Time & Language option selected

On the Time & Language page, select the Region & Language option on the left (not the Speech item):

The Time & Language page showing the Region & Langugae item selected

On the Region & Language page, click on Add a Language:

The Time & Language page showing the Add a Language item highlighted

When you click on Add a Language, you'll see this dialog box:

Choosing a language to install

Select a language from the list. It's better to select a language with all four symbols, the ones indicated at the bottom. A lot of languages on the list won't have the speech components installed, so won't show up on the list of Voices you saw earlier.

Click Next to install the language:

Options for a language prior to installion

Deselect the option at the top, Set as my Windows display language, otherwise you'll end up with all your Windows dialog boxes, and even your keyboard settings, in a different language. Notice that in the image above, it has options for Speech and Handwriting. You only need the Speech one. But click Install and you'll have added another Voice to that dropdown list from earlier. You may need to restart your computer, however, to see it. Even then, there's no guarantee that an installed language will appear on the list. It's very hit and miss!

OK, back to our Speech Program. Let's design the form. We'll do that in the next lesson below.

Designing the Form >>

Back to the C# NET Contents Page

Back to the VB NET Contents Page