locked
Text To Speech RRS feed

  • Question

  • I just need a simple Text to Speech String. Basicly I want to setup a mouse hover that will trigger the text to speech string. Here is what I found but I dont fully follow what they are saying nor do I know how to convert this to work with a string instead of what ever they have it trying to work with which appears to be some kind of object.

     

    If TextToSpeech = True Then
                Dim SAPI
                SAPI = CreateObject("SAPI.spvoice")
                SAPI.Speak(tsb_NewPaper.Text)
            End If
    

    Thanks in advance

    Sunday, December 4, 2011 5:27 AM

Answers

  • Add a reference to System.Speech, create a form with a button.

    Public Class Form1
        Dim TheSpeaker As New Speech.Synthesis.SpeechSynthesizer()
    
        Sub Say(ByRef t As String)
            TheSpeaker.SelectVoiceByHints(Speech.Synthesis.VoiceGender.Female, Speech.Synthesis.VoiceAge.Adult)
            TheSpeaker.Speak(t)
        End Sub
    
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Say("This is a test, most zoologists are fearful about the future of Lions and Tigers")
        End Sub
    End Class
    
    

     

    • Marked as answer by mholmes_3038 Sunday, December 4, 2011 11:46 PM
    Sunday, December 4, 2011 6:41 AM

All replies

  • Add a reference to System.Speech, create a form with a button.

    Public Class Form1
        Dim TheSpeaker As New Speech.Synthesis.SpeechSynthesizer()
    
        Sub Say(ByRef t As String)
            TheSpeaker.SelectVoiceByHints(Speech.Synthesis.VoiceGender.Female, Speech.Synthesis.VoiceAge.Adult)
            TheSpeaker.Speak(t)
        End Sub
    
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Say("This is a test, most zoologists are fearful about the future of Lions and Tigers")
        End Sub
    End Class
    
    

     

    • Marked as answer by mholmes_3038 Sunday, December 4, 2011 11:46 PM
    Sunday, December 4, 2011 6:41 AM
  • Thank you, worked perfectly.
    Sunday, December 4, 2011 6:21 PM
  • If you mark the thread as answered, then others possibly can get a similar question answered without posting the same or similar question again.

     

    Sunday, December 4, 2011 10:11 PM