This is a small utility wriiten in vb.net that does text to speech conversion.
This sample code shows how to read text from a file and speak it!
You must add a reference to the Microsoft Speech Object Library to convert the text to voice.
Imports SpeechLib
Public Class Form1 Dim voice As New SpVoice
Private Subbtn_Read_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try voice.Speak(Me.TextBox1.Text) Catch ex As Exception End Try End Sub
Private Sub btn_Read_From_File_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Me.OpenFileDialog1.ShowDialog() Try Dim fs As New System.IO.FileStream(Me.OpenFileDialog1.FileName, IO.FileMode.Open, IO.FileAccess.Read) Dim fr As New System.IO.StreamReader(fs)
Me.TextBox1.Text = fr.ReadToEnd Catch ex As Exception End Try End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.TextBox1.Select() End Sub End Class
|
| Author: Kapil Dhawan 17 Jun 2008 | Member Level: Gold Points : 2 |
Hello Nice piece of code Thanks for sharing your knowledge with us. I hope to see more good code from your side This code will help lots of guys Thanks to you Regards, Kapil
|
| Author: Satyanarayan SushilKumar Bajoria 30 Jun 2008 | Member Level: Diamond Points : 2 |
Hi,
Nice piece of code.
This code will be helpful to all of us.
Thanks for sharing your knowledge.
Keep posting.
Thanks and Regards S.S.Bajoria
|