locked
Text to Speech RRS feed

  • Question

  • I looked at a Text to Speech
    example, here.  It creates a dialog,
    with a default text, "[Welcome to Text to Speech World]";
    it the text box, and the user clicks the button "[Speak]".
    I am sorry I can't remember the exact program,
    I tried using Visual Basic Express on a slower computer,
    and was very frustrated and deleted it.

    Question: I couldn't figure out how to modify the code with
    the objective of having an invisable window, (not even shown
    on the task bar), for random strings to be spoken.

    Is there any code out there, (I have used search engines),
    that shows how to speak text on program start-up?

    Thursday, March 23, 2006 12:51 PM

Answers

  • Hi,

    I found this article on how to use text-to-speech engine http://msdn.microsoft.com/coding4fun/inthebox/TTS-HW/default.aspx. You can follow these steps to add a reference to the SAPI into your project: "open the project in Visual Studio. Select the Project menu and click Add Reference. Select the COM tab, select "Microsoft Speech Object Library" in the list, and click OK. These steps add this reference to your project and create an Interop.SpeechLib.dll in the same folder as your executable. This interop DLL must always be in the same folder as your .exe to work correctly. "

    After that, to speak text on program start-up, you can either use these code in your main form's Load event or in the application StartUp event (see http://msdn2.microsoft.com/en-us/library/f2bys999(VS.80).aspx for how to code application event).

    Dim voice As New SpeechLib.SpVoice
    voice.Speak(
    "Hello world")

    Best regards,

    Thursday, March 23, 2006 5:26 PM