SEARCH :

Custom Search

Friday, September 5, 2008

Text to Speech with VB .NET

Now Technology is very awesome and wonderfull.. Computer can do a some thing with our command, not just like that now computer can read text that we type and translate it into voice or Text to Speech.. Yesterday i try to make a little code with VB .NET to implement this text to Speech function to make an alarm. This alarm with alert us when this is time to lunch, dinner, or time to sleep. This aplication will also give a welcome message while the aplication loaded and good bye message if the aplication closed. All message will alert us with voice..

Bellow is the simple function to make texts that user input will be read with computer and translate it into voice.

Private Sub talk(ByVal str As String)
Dim oVoice As New SpeechLib.SpVoice
Dim cpFileStream As New SpeechLib.SpFileStream

'Set the voice type male or female and etc
oVoice.Voice = oVoice.GetVoices.Item(cmbVoices.SelectedIndex)

'Set the voice volume
oVoice.Volume = trVolume.Value

'Set the text that will be read by computer
oVoice.Speak(str, SpeechLib.SpeechVoiceSpeakFlags.SVSFDefault)
oVoice = Nothing
End Sub

To use this simple function, just insert the text that we want to be readed into function parameter

Example : talk("Hello World") ' This Function will make computer talk "Hello World"


For demo Aplication
Click here to download file

For Source Code Click here to download file

If you find an interesting things please share with me..^^

1 comment:

Anonymous said...

Keren Neh!

Thnx Bro ..

Salam