Text to speech

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Chris

    Text to speech

    Hi,

    I am running VB6 under windows XP Professional.. I added the 'Microsoft
    Direct Text-To-Speech' component, named it spkSpeak and added the following
    code in Form(Load): spkSpeak.Speak "You have selected Microsoft Sam.".

    The weird thing is that when I run the program nothing happens.
    Microsoft Sam is automatically installed when windows is installed, there
    must be some way to use this function. Does anyone here knows how it can be
    used in a VB application? (preferably without installing other programs)

    Thanks,

    Chris


  • mayayana

    #2
    Re: Text to speech

    I don't know what component you're talking about. Maybe it's
    an OCX in XP because of SAPI5 being built in. But if you're
    using SAPI 5 you just need a reference to SAPI.DLL:
    "Microsoft Speech Object Library"

    I'd be inclined to connect it with a button rather than form load,
    just to rule out other unforseen problems - since you probably don't
    want your program talking while it's loading anyway.

    Also, you'll find samples in the SAPI SDK. (Big download. You'll
    need to have or borrow a high speed connection.)

    Note that support for SAPI5 is only in XP. The minimum shipping
    support size for other systems is 6-10 MB worth of DLLs, etc. and it's
    rigged not to run on Win95.

    '-- The Enums:

    Enum SpeechVoiceSpea kFlags
    SVSFDefault = 0
    SVSFlagsAsync = 1 '--speak asynchronously.
    SVSFPurgeBefore Speak = 2 '--purge pending speech.
    SVSFIsFilename = 4
    SVSFIsXML = 8
    SVSFIsNotXML = 16
    SVSFPersistXML = 32
    SVSFNLPSpeakPun c = 64 '--speak punctuation as word: "blah blah period"
    '-- Masks
    SVSFNLPMask = 64
    SVSFVoiceMask = 127
    SVSFUnusedFlags = -128
    End Enum

    '-- This flag may not be what you want but it's a sanmple.
    '-- It will make TTS keep up with events rather than finish speaking it's
    '-- buffer before moving on. For instance, if you set it to speak 500
    '-- names and then tell it halfway through to speak 500 numbers instead,
    '-- ASync will cause it to stop reading names and switch to numbers.
    '-- Not-Async will cause it to finish with the names first.

    Const SPEAK_FLAGS_1 = SVSFlagsAsync Or SVSFPurgeBefore Speak Or SVSFIsNotXML

    Public SpkVoice As SpVoice

    '-- Public sub that can be called to speak provided string:

    Public Sub SpeakIt(sText As String)
    On Error Resume Next
    If (Len(sText) = 0) Then Exit Sub
    SpkVoice.Speak sText, SPEAK_FLAGS_1
    End Sub


    --
    --
    Chris <c987web@hotmai l.com> wrote in message
    news:f3cbc$4077 ef98$d5498bb6$1 7587@news.multi kabel.nl...[color=blue]
    > Hi,
    >
    > I am running VB6 under windows XP Professional.. I added the 'Microsoft
    > Direct Text-To-Speech' component, named it spkSpeak and added the[/color]
    following[color=blue]
    > code in Form(Load): spkSpeak.Speak "You have selected Microsoft Sam.".
    >
    > The weird thing is that when I run the program nothing happens.
    > Microsoft Sam is automatically installed when windows is installed, there
    > must be some way to use this function. Does anyone here knows how it can[/color]
    be[color=blue]
    > used in a VB application? (preferably without installing other programs)
    >
    > Thanks,
    >
    > Chris
    >
    >[/color]


    Comment

    • Eternal Blues

      #3
      Re: Text to speech

      (300MB? It's nice being a network administrator with a T1 at work...)

      Anyone know how to add voices to the SAPI 5.1 system? I need Japanese
      language support, and all I can seem to find is the speech recognition
      component. I need a voice capable of Japanese TTS.

      Any help is greatly appreciated! Thanks!!


      "mayayana" <mayaXXyaYYna1a @mindZZspring.c om> wrote in message
      news:o3Udc.2754 $l75.2441@newsr ead2.news.atl.e arthlink.net...[color=blue]
      > I don't know what component you're talking about. Maybe it's
      > an OCX in XP because of SAPI5 being built in. But if you're
      > using SAPI 5 you just need a reference to SAPI.DLL:
      > "Microsoft Speech Object Library"
      >
      > I'd be inclined to connect it with a button rather than form load,
      > just to rule out other unforseen problems - since you probably don't
      > want your program talking while it's loading anyway.
      >
      > Also, you'll find samples in the SAPI SDK. (Big download. You'll
      > need to have or borrow a high speed connection.)
      >
      > Note that support for SAPI5 is only in XP. The minimum shipping
      > support size for other systems is 6-10 MB worth of DLLs, etc. and it's
      > rigged not to run on Win95.
      >
      > '-- The Enums:
      >
      > Enum SpeechVoiceSpea kFlags
      > SVSFDefault = 0
      > SVSFlagsAsync = 1 '--speak asynchronously.
      > SVSFPurgeBefore Speak = 2 '--purge pending speech.
      > SVSFIsFilename = 4
      > SVSFIsXML = 8
      > SVSFIsNotXML = 16
      > SVSFPersistXML = 32
      > SVSFNLPSpeakPun c = 64 '--speak punctuation as word: "blah blah[/color]
      period"[color=blue]
      > '-- Masks
      > SVSFNLPMask = 64
      > SVSFVoiceMask = 127
      > SVSFUnusedFlags = -128
      > End Enum
      >
      > '-- This flag may not be what you want but it's a sanmple.
      > '-- It will make TTS keep up with events rather than finish speaking it's
      > '-- buffer before moving on. For instance, if you set it to speak 500
      > '-- names and then tell it halfway through to speak 500 numbers instead,
      > '-- ASync will cause it to stop reading names and switch to numbers.
      > '-- Not-Async will cause it to finish with the names first.
      >
      > Const SPEAK_FLAGS_1 = SVSFlagsAsync Or SVSFPurgeBefore Speak Or[/color]
      SVSFIsNotXML[color=blue]
      >
      > Public SpkVoice As SpVoice
      >
      > '-- Public sub that can be called to speak provided string:
      >
      > Public Sub SpeakIt(sText As String)
      > On Error Resume Next
      > If (Len(sText) = 0) Then Exit Sub
      > SpkVoice.Speak sText, SPEAK_FLAGS_1
      > End Sub
      >
      >
      > --
      > --
      > Chris <c987web@hotmai l.com> wrote in message
      > news:f3cbc$4077 ef98$d5498bb6$1 7587@news.multi kabel.nl...[color=green]
      > > Hi,
      > >
      > > I am running VB6 under windows XP Professional.. I added the 'Microsoft
      > > Direct Text-To-Speech' component, named it spkSpeak and added the[/color]
      > following[color=green]
      > > code in Form(Load): spkSpeak.Speak "You have selected Microsoft Sam.".
      > >
      > > The weird thing is that when I run the program nothing happens.
      > > Microsoft Sam is automatically installed when windows is installed,[/color][/color]
      there[color=blue][color=green]
      > > must be some way to use this function. Does anyone here knows how it can[/color]
      > be[color=green]
      > > used in a VB application? (preferably without installing other programs)
      > >
      > > Thanks,
      > >
      > > Chris
      > >
      > >[/color]
      >
      >[/color]

      Comment

      Working...