Results 1 to 8 of 8

Thread: [RESOLVED] Speech

  1. #1

    Thread Starter
    Lively Member Amerigo's Avatar
    Join Date
    Dec 2008
    Location
    PSR B1620-26 c-1
    Posts
    126

    Resolved [RESOLVED] Speech

    I have SAPI 5.1 installed. I'm using VB 2005.
    I can't get this to work.
    Code:
    Dim spkr As New SpeechLib.SpVoice
    The error is "type speechlib.spvoice is not defined."
    How do I need to do to get speech to work?
    Anyone who does not wonder, is either omnipotent or a fool.
    Amerigoware <<<My Projects

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,344

    Re: Speech

    Just like any type, you must first reference the library that it's declared in. You must then either import the namespace it's a member of or else qualify it fully in code.

    That said, there is a managed, i.e. .NET, speech API for Vista and later. It would be preferable to use that if you can.

  3. #3
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,479

    Re: Speech

    you need to add a reference to System.Speech, then you can use this:

    vb Code:
    1. Dim voice As New System.Speech.Synthesis.SpeechSynthesizer
    2. voice.Speak("words to speak")

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,344

    Re: Speech

    Quote Originally Posted by .paul. View Post
    you need to add a reference to System.Speech, then you can use this:

    vb Code:
    1. Dim voice As New System.Speech.Synthesis.SpeechSynthesizer
    2. voice.Speak("words to speak")
    System.Speech is part of .NET 3.0 and the OP is using VS 2005, so that may not be an option. You don't "need" to reference System.Speech to use SAPI 5.1.

  5. #5

    Thread Starter
    Lively Member Amerigo's Avatar
    Join Date
    Dec 2008
    Location
    PSR B1620-26 c-1
    Posts
    126

    Re: Speech

    I am using Windows XP. What I'm trying to find out it how to "reference the library".
    Anyone who does not wonder, is either omnipotent or a fool.
    Amerigoware <<<My Projects

  6. #6
    Lively Member
    Join Date
    Jul 2009
    Location
    Amsterdam, NY
    Posts
    85

    Re: Speech

    not sure if its the same in 2005 as it is in 2010, but just incase:

    Project --> Add Reference
    CodeBank Posts: Base Converter

  7. #7

    Thread Starter
    Lively Member Amerigo's Avatar
    Join Date
    Dec 2008
    Location
    PSR B1620-26 c-1
    Posts
    126

    Resolved... Re: Speech

    Thanks. I found it finally. I just added everything that had 'speech' in it and now have no errors.
    Anyone who does not wonder, is either omnipotent or a fool.
    Amerigoware <<<My Projects

  8. #8
    Frenzied Member obi1kenobi's Avatar
    Join Date
    Aug 2007
    Posts
    1,091

    Re: Speech

    Mark the thread resolved if you don't require further assistance.
    Please rate helpful ppl's posts. It's the best 'thank you' you can give

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width