How to Create a Text-To-Speech Application in VB.NET

This is my another tutorial in VB.NET that converts an inputted text into a speech or voice. We will just only call the Speech API namespace for this program and with the use of Spvoice object. The SpVoice object brings the text-to-speech (TTS) engine capabilities to applications using SAPI automation. An application can create numerous SpVoice objects, each independent of and capable of interacting with the others. A SpVoice object usually referred to simply as a voice, is created with default property settings so that it is ready to speak immediately.

So, now let's start this tutorial!
  1. Let's start with creating a Windows Form Application for this tutorial by following the following steps in Microsoft Visual Studio: Go to File, click New Project, and choose Windows Application.
  2. Next, add one TextBox named TextBox1 for inputting a text to become a speech, and add one button named Button1 to convert the inputted text into speech. Design your layout like this one below:
  3. Put this code to your Button1_Click. This will trigger to speak your inputted text.
    1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    2. Dim tts = CreateObject("SAPI.spvoice")
    3. tts.speak(TextBox1.Text)
    4. End Sub


We have initialized a tts variable to create an object of SAPI.spvoice. A SAPI.spvoice is created with its audio output set to the system default audio output. It also determines what other outputs are available to the voice, and use another property to set its audio output to one of them.

The Speak method here places a text stream in the TTS engine's input queue of our inputted text in TextBox1 and returns a stream number. It can be called synchronously or asynchronously. When called synchronously, the Speak method returns immediately, and the voice speaks as a background process.


Click the button to speak the inputted text.


You can also download the source code below and try it! :)

For more inquiries and need programmer for your thesis systems in any kind of programming languages, just contact my number below.

Best Regards,

Engr. Lyndon R. Bermoy
IT Instructor/System Developer/Android Developer
Mobile: 09079373999
Telephone: 826-9296
E-mail:[email protected]

Visit and like my page on Facebook at: Bermz ISware Solutions

Subscribe at my YouTube Channel at: SerBermz

Visit my website at: CampCodes


Submitted byChayaphol Roib… (not verified)on Sat, 04/16/2022 - 12:27

This Is A Bug As System.EventArgs) Handles Button1.Click Bug: Syntax Error.
Submitted byChayaphol Roib… (not verified)on Sat, 04/16/2022 - 12:36

<! Copyright (c) 2022 Chayaphol Roibang All Right Reserved. > <! author: Chayaphol Roibang > <! date: 16/04/2022 > <! time: GMT+7 (Bangkok, Hanoi, Jarkata) >

This Is A Bug

As System.EventArgs) Handles Button1.Click

Bug: Syntax Error.


Chayaphol Roibang

Submitted byrex trayn (not verified)on Sun, 07/31/2022 - 08:59

This is a simple "Button click" event handler, generated by Visual Studio. It does NOT throw a syntax error, in VS2017. Maybe you are missing some code, or you put some white space in your code. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click ' Zoe the Robot' uses many "button click event handlers" End Sub
Submitted byWindows 11 and… (not verified)on Thu, 01/26/2023 - 18:22

Error message "Speak is not a mamber of SPvoice" This is an issue that many suggestions fail on Target framework 6.0 as vs 2022 and windows 11 forced me to change parameters of my application. Simply cannot ger sound to work as axWMPlib.dll in earlier incarnations not available now. and throws errors

Add new comment