By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,771 Members | 1,669 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,771 IT Pros & Developers. It's quick & easy.

Text to speech

P: n/a
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
Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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 SpeechVoiceSpeakFlags
SVSFDefault = 0
SVSFlagsAsync = 1 '--speak asynchronously.
SVSFPurgeBeforeSpeak = 2 '--purge pending speech.
SVSFIsFilename = 4
SVSFIsXML = 8
SVSFIsNotXML = 16
SVSFPersistXML = 32
SVSFNLPSpeakPunc = 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 SVSFPurgeBeforeSpeak 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 <c9*****@hotmail.com> wrote in message
news:f3***************************@news.multikabel .nl...
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

Jul 17 '05 #2

P: n/a
(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" <ma************@mindZZspring.com> wrote in message
news:o3*****************@newsread2.news.atl.earthl ink.net...
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 SpeechVoiceSpeakFlags
SVSFDefault = 0
SVSFlagsAsync = 1 '--speak asynchronously.
SVSFPurgeBeforeSpeak = 2 '--purge pending speech.
SVSFIsFilename = 4
SVSFIsXML = 8
SVSFIsNotXML = 16
SVSFPersistXML = 32
SVSFNLPSpeakPunc = 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 SVSFPurgeBeforeSpeak 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 <c9*****@hotmail.com> wrote in message
news:f3***************************@news.multikabel .nl...
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



Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.