Discussion:
Text to Voice
(too old to reply)
StanWeiss
2024-07-28 15:39:25 UTC
Permalink
Thank you ObiWan

Sorry for the late reply.

I do now have a rudimentary program that uses SAPI and works. Now come
the next step of trying to integrating this into my software.

Stan
--
This email has been checked for viruses by Avast antivirus software.
www.avast.com
ObiWan
2024-07-30 08:02:26 UTC
Permalink
:: On Sun, 28 Jul 2024 11:39:25 -0400
:: (microsoft.public.vb.general.discussion)
Post by StanWeiss
I do now have a rudimentary program that uses SAPI and works. Now
come the next step of trying to integrating this into my software.
Start by enclosing the SAPI "glue code" inside a class module exposing
the desired properties and method and encapsulating all the SAPI call
details, then just create a global instance of the class, initialize it
setting the various properties as desired (e.g. from some "preferences"
saved in a config file) and then use the class method throughout your
application code

The point is... what do you need it for ? If it's for some kind of
"screen reader" for vision impaired users, then there are other windows
APIs to integrate such functions, those will use the SAPI "under the
hood" to "read the text" but will then offer additional hooks and APIs
to ease integration, for a start, see here

https://learn.microsoft.com/en-us/windows/apps/design/accessibility/accessibility-overview
ObiWan
2024-07-30 10:36:19 UTC
Permalink
Post by ObiWan
Start by enclosing the SAPI "glue code" inside a class module exposing
the desired properties and method and encapsulating all the SAPI call
Just to be more clear, your SAPI class module may wrap code to
enumerate the various available voices and languages and to select the
various parameters like pitch, speed and so on
StanWeiss
2024-07-30 13:57:35 UTC
Permalink
Post by ObiWan
Post by ObiWan
Start by enclosing the SAPI "glue code" inside a class module exposing
the desired properties and method and encapsulating all the SAPI call
Just to be more clear, your SAPI class module may wrap code to
enumerate the various available voices and languages and to select the
various parameters like pitch, speed and so on
Like I said only very rudimentary at this time. The one problem is even
at 100% volume the voice is not very loud. I know that there are
soneother voices that I can download and try, but I have had some other
things to work on and so this got moved to the back burner for now.

Private Sub Form_Load()     'Start Up code
Me.Left = (Screen.Width - Me.Width) / 2     'Center form on screen
Me.Top = (Screen.Height - Me.Height) / 2
'
sMsg = "Hello World, this is S.A.P.I. that is, Speech API"
Set objSAPI = CreateObject("SAPI.SPVoice")
'
' My Windows 7 Computer only has 1 Voice
'
Debug.Print "Voice Count = "; objSAPI.GetVoices.Count
Set objSAPI.Voice = objSAPI.GetVoices.Item(0)
'
' The default rate for a voice is set through Speech properties in
Control Panel.
' Values for the Rate property range from -10 to 10, which represent the
slowest
' and the fastest speaking rates, respectively.
'
objSAPI.Rate = -5
objSAPI.Volume = 100
End Sub

Stan
--
This email has been checked for viruses by Avast antivirus software.
www.avast.com
ObiWan
2024-07-30 14:56:03 UTC
Permalink
The one problem is even at 100% volume the voice is not very loud.
The volume is relative to the volume set for the audio card, say that
the system volume (audio) is set to 50%, then setting objSAPI.Volume
to 100 will result in an output at 50%, hope you understood it
StanWeiss
2024-07-30 17:37:25 UTC
Permalink
Post by ObiWan
The one problem is even at 100% volume the voice is not very loud.
The volume is relative to the volume set for the audio card, say that
the system volume (audio) is set to 50%, then setting objSAPI.Volume
to 100 will result in an output at 50%, hope you understood it
I do understand that. The system volume is set to 100%. Other things,
like when I play a wav file or You Tube video are louder. That is way I
was thinking maybe downloading a different voice might sound better. I
am testing on a laptop using the built in speakers.

Stan
--
This email has been checked for viruses by Avast antivirus software.
www.avast.com
ObiWan
2024-07-31 07:09:35 UTC
Permalink
Post by StanWeiss
I do understand that. The system volume is set to 100%. Other things,
like when I play a wav file or You Tube video are louder. That is way
I was thinking maybe downloading a different voice might sound
better. I am testing on a laptop using the built in speakers.
Hm... strange, tested it here, clicked on the volume icon in tray and
set it to 50%, then ran some code which set the SAPI volume to 100%,
the "global volume" (tray control) remained at 50% as expected, then,
raising the "global" to 100% gave me full volume, so I'm not sure what
is causing your "low volume" issue

Just curious, what are you going to use the SAPI "speech" for in your
application ?
ObiWan
2024-07-31 07:30:44 UTC
Permalink
Post by ObiWan
Hm... strange, tested it here, clicked on the volume icon in tray and
set it to 50%, then ran some code which set the SAPI volume to 100%,
the "global volume" (tray control) remained at 50% as expected, then,
raising the "global" to 100% gave me full volume, so I'm not sure what
is causing your "low volume" issue
also, right click the audio tray icon and select "open mixer" and check
the various levels and then also check the audio settings, maybe one of
the levels is set very low or in any case lower than the master volume
StanWeiss
2024-07-31 15:40:38 UTC
Permalink
Post by ObiWan
Post by ObiWan
Hm... strange, tested it here, clicked on the volume icon in tray and
set it to 50%, then ran some code which set the SAPI volume to 100%,
the "global volume" (tray control) remained at 50% as expected, then,
raising the "global" to 100% gave me full volume, so I'm not sure what
is causing your "low volume" issue
also, right click the audio tray icon and select "open mixer" and check
the various levels and then also check the audio settings, maybe one of
the levels is set very low or in any case lower than the master volume
I already did that and they were all set to max.

Stan
--
This email has been checked for viruses by Avast antivirus software.
www.avast.com
StanWeiss
2024-07-31 15:38:54 UTC
Permalink
Post by ObiWan
Post by StanWeiss
I do understand that. The system volume is set to 100%. Other things,
like when I play a wav file or You Tube video are louder. That is way
I was thinking maybe downloading a different voice might sound
better. I am testing on a laptop using the built in speakers.
Hm... strange, tested it here, clicked on the volume icon in tray and
set it to 50%, then ran some code which set the SAPI volume to 100%,
the "global volume" (tray control) remained at 50% as expected, then,
raising the "global" to 100% gave me full volume, so I'm not sure what
is causing your "low volume" issue
Just curious, what are you going to use the SAPI "speech" for in your
application ?
I have built in help and was looking at have the program speak / read
the help to the user.

Stan
--
This email has been checked for viruses by Avast antivirus software.
www.avast.com
ObiWan
2024-07-31 15:49:25 UTC
Permalink
Post by StanWeiss
I have built in help and was looking at have the program speak / read
the help to the user.
If you have the help source you should be able to do that w/o having to
use the "screen reader" functions
StanWeiss
2024-07-31 22:12:26 UTC
Permalink
Post by ObiWan
Post by StanWeiss
I have built in help and was looking at have the program speak / read
the help to the user.
If you have the help source you should be able to do that w/o having to
use the "screen reader" functions
I don't know what you mean by "screen reader" function. 25 years ago I
taught myself VB. I didn't know any better and wrote my own help with
mouse_over and opening a text box with help. What I want to do is if the
User has checked an option to have the program speak the text string it
now displays.

Stan
--
This email has been checked for viruses by Avast antivirus software.
www.avast.com
ObiWan
2024-08-01 07:45:52 UTC
Permalink
Post by StanWeiss
I don't know what you mean by "screen reader" function. 25 years ago
I taught myself VB. I didn't know any better and wrote my own help
with mouse_over and opening a text box with help. What I want to do
is if the User has checked an option to have the program speak the
text string it now displays.
Ok, I thought it was a "classic help" file, if it's as described above
then it shouldn't be difficult to add to the dialog showing the help a
function which, if speech is enabled, will feed the SAPI with the text
appearing in the help dialog, an idea may be splitting the text in
lines and then feeding the lines one after the other to SAPI, you may
optionally add a "settings" dialog which, if speech is selected, will
allow to select the rate and volume and the desired voice (if more than
one is present)

Loading...