Text To Speech Application in Visual Basic.Net
Posted by Samath
Last Updated: December 23, 2014

Ever wondered how to create a simple application that speak the word you type? Here is how to create a simple text to speech application using visual basic.net. first open visual studio and create a empty windows form application. next drag a button, label and a textbox control to the form provided. set the properties of the controls to whatever you like for example change the name, color or size of the controls etc. A screenshot is provided below on how my application looks. yours may look different.  

 

After dragging the controls to the form, double click on the button and write the following code in the button's click event. 

Eg. Code:

    Private Sub SpeakButton_Click(sender As Object, e As EventArgs) Handles SpeakButton.Click
        Dim SAPI
        SAPI = CreateObject("SAPI.spvoice")
        SAPI.Speak(TextBox.Text)
    End Sub

The SpVoice object brings the text-to-speech (TTS) engine capabilities to applications using SAPI automation. SAPI is Microsoft Speech API, the native API for Windows. Only english voice is installed by default but, you can install other language of your choice if you want the computer speak your native language. There are other properties of the SpVoice object such as the rate and volume property.There is also the Voice property, which can be thought of as the person of the voice.examples of Voices are "Microsoft Mary" and "Microsoft Mike."

This application may be trivial but, it can be transformed into something bigger for example a application that read a e-book or content from a website. 

Related Content