I am trying to alter the voice in a DirectSS Text to speech control.
I am able to make the control speak.

"DirectSS1.speak (Label1.caption) 'This reads the words from a text box"

Going on the above how do I change the voice. The other properties I am playing with as I go along.

Recommended Answers

All 3 Replies

This is my code with Microsoft Speech Object Library as my reference

Dim Voice As SpVoice

Set Voice = New SpVoice

'* This will display available voice in VB6 Immediate Window from your computer
Debug.Print Voice.GetVoices().Count

'* This will change the voice
Set Voice.Voice = Voice.GetVoices().Item(0) '* Index 0 = Voice Count

Voice.Speak Text1.Text, SVSFlagsAsync

I only have Microsoft Sam installed on my computer, so Voice Count is just 1.

Hope this Helps

I also found something on the net where you can download Text-to-Speech Voices that you can install on your computer.

Haven't tried it, but I hope the link will work.

Click Here

For anyone trying to access VB SPEECH to TEXT still please know that there are THREE ways to do it.  There are two different OCX controls.  The first two you get by checking the boxes to add those fancier OCX controls. 

First, Microsoft DirectTextTosSpeech or  Second, Microsoft Voice Text.  You get there by going into Project - Components or CTRL-T  If you plan to port your program using the above you need a different DLL file for each.  - Xvoice.DLL and VText.DLL or something quite similar. - If you plan to port it you need to install their respective DLLs or your entire program will not install. 

The THIRD way to change TEXT to SPEECH is the BEST-most up-to-date method works with code noted above. But there's no OCX control.  You have to had  add a REFERENCE. 
Project - References.  There's no keyboard shortcut  Then find way down there the
Microsoft Speech Object Library.    Once checked it pops nicely to the top. I'm posting this hoping you will find that 

more easily than I.   I've never had cause to look in there.    That done you only to declare the voice object as noted in the code above.  You can download the entire Developer's kit at this link.

MS-Text-to-Speech 5.1 Soft Dev Kit & files

To port this to other computers you need the redistribute files, all 30 megs or so of them, which is a lot more than a DLL file but it does work. I can now chane the voice to MS Mike, Mary, or Sam Note:  the TTL voice doesn't work that way.  

When or *IF* I figure out how to change the speed and pitch easily I will keep you... uh... posted.  
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.