Library tutorials & articles
Text-To-Speech
By Alex , published on 24 Feb 2002
Page 3 of 3
- Introduction
- The Code
- How it works
How it works
This is how it works, when the button is clicked it says, "You clicked button number" and then it says the caption of the button. It then runs a program depending on which button you clicked. Also, when you type something in the text box it reads the text and speaks it out. Your form should look something like this:
If you run the program it should speak the caption of the button you clicked and run a program and if you type something in the text box it should speak what you typed.
Related articles
Related discussion
-
Run-time error '91'
by crazyidane (0 replies)
-
Problem handling Redirects with MSXML2.XMLHTTP
by brandoncampbell (2 replies)
-
vbinputbox pauses code while it waits on response. How can I reproduce that?
by brandoncampbell (1 replies)
-
Sending SMS in VB 6
by sirobnole (6 replies)
-
Comboxbox listindex in ActiveX Control
by brandoncampbell (1 replies)
I ran the program OK. When I create .exe and run on other computers, I get an error. What files are necessary to be installed on the other computers?
thanx for all the info u guys gave this helped me to learn how to use the text-to-speech component
the only thin i wanted to know was that how to make the lips move cause i had seen those lips move in my frinends pc.
hi,
I would like to ask if it is possible to convert the text to spoken voice and save it inside a audio file such as .wav
Thanks in advance
HI there you need install the text to speech engine and the Microsoft Reader.
Text -to-Speech Engine installer and Microsoft Reader.
Nolan F. Sunico
Zamboanga City, Philippines
I have installed all prerequisites, added the speech Active X control to the project and installed the voice feature. The updated VB.NET 2003 is available at:
http://cybereshop.lmhost2.com/frmSpeak.vb
(the only difference from this file and the one above is that I have deleted all of the other buttons. )
Please reply with the corrected code or what I should do. Thank you.
I am using using the VB project available at:
http://www.developerfusion.co.uk/show/1910/1/redir/
I downloaded the Visual Studio File and run the file from Visual Studio.NET 2003 (it upgrades automatically). After that I built the solution, type text in the text box and press the button- I don't hear the voice reading the text. The other buttons just start an application; it suppose to speak what application is being launched.
What I have done:
I have installed Microsoft Speech program and I see the program in my control panel as the icon Speech. I have tested the application from the control panel and I am able to hear words spoken. Also, I have installed all prerequisites. I also have the speech Active X control enabled as well in Visual Studio.NET components.
Please advise what I should do. Thank you.
hi there
i am working on this direct text to speech
i have developed some code it working on some machines
but on other machines i am not able to hear anything
it was working my machine also but all of sudden i am not able to hear any thing
can anyone telll me what could possibly be the reasson....
it's very urgent
please help me out...
i really want it,plz help me!!
my email is ka_boom80@hotmail.com
im on xp tho
just silencee
Thank you for writing the code and thank you dragon flame for steering me in the right direction for the downloads required to make the code work. You all better be watching me now, this is what i needed to take over the world!
Hehe that tutorials fits me good =) my name is Alex to ( or my whole name is Alexander but everyone calls me Alex ;D ) hehe.. thats cool...i just had to post it =)
you can get the enfine from here.incase you are still searching for it.
">http://www.microsoft.com/products/msagent/downloads.htm#sr
among the topics was text to speech.
so i look about the internet searching for some tutorials but find out that the school here doesnt have the microsoft direct text to speech control
and i was just wondering where i could find it weather it be on the VB installation CD or somewhere on the microsoft website.
thanks for your time
well here's my email and you can send me one too... thanks!
juwave@hotmail.com
The code works just fine for me. I'm running Win2000 and VB6.0. Since I'm retiring towards the end of the year, I made a little form which shows me days, hours, minutes and seconds to go. When the happy face is clicked, you get the same info in speech.
To many people seem to have a problem with this code.
But there is nothing wrong with the code, it's to do with the drivers you downloaded.
To fix this go to The Microsoft Download Page and download the text - to - speach engines and the SAPI 4.0 runtime support and then it should work.
Hope this helps.
Please comment if it worked and if you don't understand or need help.
The Visual Basic version should not matter. I have the Developing for MS Agent book. It gives examples for Text-to-speech in VB, C++, even HTML. Some of the problem may be that Agent isnt loaded. Do you see it in the notification area on the taskbar?
try @
http://msdn.microsoft.com/downloads/default.asp?url=/downloads/sample.asp?url=/msdn-files/027/000/781/msdncompositedoc.xml
Do you get any errors or just silence?
I am working on Win '98 and Visual Basic 6.0 ...with the suggested download components but the speech part is not workin.I have even downloaded the code with the tutorial but still it does not work.Can you plz suggest something that i can do to make the code work.
My email add is mehul@gtemail.net
Mehul
PS:RASAP
i have downloaded the component for text to speech.i installed it but i am not getting the output or error.the application just works.the component is xvoice.dll and vb application is text to speech.vbp.
can anyone tell me what is wrong
thisi verry nice programm.But problem is i am not getting that compnent
Microsoft direct text to speech controll in vb.
plaease give inforamtion.
I guess you all have the wrong version of Visual Basic.
When i was downloading the text-to-speech control from the Microsoft Speech website i sa this:
Software Requirements:
Microsoft Visual BasicĀ® 6.0 is needed to write applications incorporating SAPI automation, or for compiling the Visual Basic sample code. Since SAPI supports COM automation, other languages and...bla bla bla..
Maybe that is the problem?
Jackal salutes you..
It will not really work in Windows 95 as it is clearly defined on SAPI home page that Windows 95 and below is not supported.
Dear James,
I have been solve this problem already! The Control didn't work because the matter of sound card and the configuration of the windows. Thank you for your responding.
I have another question! how do i change the voice of this control from the man voice to woman voice????
Regards,
Mun Yoong
well you have to download all the stuff that was at the begenning of the TUT, then add those lips to your form lol.
heres what i use for code... it looks like this
spkSpeak.speak "Hello how are you"
spkSpeak.speak = txtSayit.text
stuff like that
umm if you have msn msg me at zith321@hotmail.com
Hmmm.... I suggest you take a look at the Microsoft web site. As no error occurs, our code seems to be working fine; the Microsoft text-to-speech control just isn't saying anything.
Please describe the problem you are having....
If having problems with TTS (text to speech), make sure you have the speech engine properly registered and that your hardware specifications are appropriate. Check the proper setup in the Control Panel if you are running Windows 2000. Hope this helps a bit.
You say you can hear the speech, but i cannot? is it have any configure in the property or you have your own way to control this control. Please reply me. If can please share your code with me.
Dear DeveloperFusion.com,
The Text to speech totally can work at all!!!
I follow all the step that you give but no any speech or sound appear is it the property need to configure
When I click the buttons the program loads but there is no speech. Here is the code, if there is anything wrong with it please tell me.
Const Notepad = "c:\windows\notepad.exe"
Const Wordpad = "C:\Program Files\Windows NT\Accessories\wordpad.exe"
Const Paint = "C:\WINDOWS\system32\mspaint.exe"
Const Calculator = "c:\windows\system32\Calc.exe"
Const Volume = "c:\windows\system32\Sndvol32.exe"
Const InternetExplorer = "C:\Program Files\Internet Explorer\IEXPLORE.EXE"
Const SoundRecorder = "c:\windows\system32\Sndrec32.exe"
Const Clipboard = "c:\windows\system32\Clipbrd.exe"
Const OutlookExpress = "C:\Program Files\Outlook Express\msimn.exe"
Const Solitaire = "c:\windows\Sol.exe"
Private Sub BtnNumbers_Click(Index As Integer)
spkSpeak.Speak "You clicked button number " & BtnNumbers(Index).Caption & "."
Select Case Index + 1
Case Is = 1
Shell Notepad, vbNormalNoFocus
Case Is = 2
Shell Wordpad, vbNormalNoFocus
Case Is = 3
Shell Paint, vbNormalNoFocus
Case Is = 4
Shell Calculator, vbNormalNoFocus
Case Is = 5
Shell Volume, vbNormalNoFocus
Case Is = 6
Shell InternetExplorer, vbNormalNoFocus
Case Is = 7
Shell SoundRecorder, vbNormalNoFocus
Case Is = 8
Shell Clipboard, vbNormalNoFocus
Case Is = 9
Shell OutlookExpress, vbNormalNoFocus
Case Is = 10
Shell Solitaire, vbNormalNoFocus
End Select
End Sub
Private Sub BtnSpeak_Click()
spkSpeak.Speak txtText.Text
End Sub
Thanks
Is there any way to make it speak in a disserent language than English?
I tried the text to speech control.But its not working.Any suggestions on possible reasons for the failure???????
U can mail me at vimal_666@yahoo.com.Plzzz include text to speech as the subject line.(plzzzzzzzz)
that was simply great, i can easily say that, very comprehensive. AND VERY TO THE POINT. I give my cheers to the author, for that, maybe im being melodramitic? well, that was great., i understood everything first time around, and in the text box, i wrote the lyrics to sum 41 "fat lip" song . one thing, how do i change that crappy voice??? can you email me or reply to this message when you get around to it?
Zith321@hotmail.com
well here's my email and you can send me one too... thanks!
shanesegui@yahoo.com
I can e-mail you the project too but i'll need your e-mail adrress.
Alex
I typed in the text to speech tutorial but can not to get any speech. The applications run when clicking the numbered buttons but no speech. The text in the text box is not spoken either when clicking the Speak command button. I added a Beep to the click events to test the sound card, volume etc. and it works fine. I compiled it and it worked fine on Windows2000. Any suggestions as to why it does not work on Windows 95 would be helpful.
Yeah please send it to me too! This could be a really cool project. I could even freak out my VB teacher.
Oh yeah, an email address might help too. Email me at thats_right2@yahoo.com. Thanks
Alex, can you send me an example, my e-mail address is: njtermite@yahoo.com
thanks
mark
no worrrys
thanks for the tip,
bill
hey,
i just stumbled apon your query about the text-to-speech thing. I dont know much about your problem but if I can help you out of a little problem you may have later on if you distribute your application/code. Always deter from using C:\Windows or C:\Program Files\ when linking/shelling applications. Why? Well firstly not all Windows OS's are the same and its because NT and 9x are different.
Lets take a look at C:\Windows first.... in Windows NT(4/2000) its not that but rather C:\WinNT which will mean that your program will not be 'NT Compatible' so I recommend you using API to workout the important Windwos Directories to get the common folders. I ahve attaced below some code which I use regularly on my work.
'// Start
Option Explicit ' DIE TYPO's DIE
Private Declare Function GetWindowsDirectoryB Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Private Declare Function GetSystemDirectoryB Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal Path As String, ByVal cbBytes As Long) As Long
Private Declare Function GetTempPath Lib "kernel32" Alias "GetTempPathA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
Private Const MAXLENGTH = 512
Public Function GetWindowsSystemDirectory() As String
Dim s As String
Dim c As Long
s = String$(MAXLENGTH, 0)
c = GetSystemDirectoryB(s, MAXLENGTH)
If c > 0 Then
If c > Len(s) Then
s = Space$(c + 1)
c = GetSystemDirectoryB(s, MAXLENGTH)
End If
End If
GetWindowsSystemDirectory = IIf(c > 0, Left$(s, c), "")
End Function
Public Function GetWindowsDirectory() As String
Dim s As String
Dim c As Long
s = String$(MAXLENGTH, 0)
c = GetWindowsDirectoryB(s, MAXLENGTH)
If c > 0 Then
If c > Len(s) Then
s = Space$(c + 1)
c = GetWindowsDirectoryB(s, MAXLENGTH)
End If
End If
GetWindowsDirectory = IIf(c > 0, Left$(s, c), "")
End Function
Public Function GetTempDirectory() As String
Dim s As String
Dim c As Long
s = Space$(MAXLENGTH)
c = GetTempPath(MAXLENGTH, s)
If c > 0 Then
If c > Len(s) Then
s = Space$(c + 1)
c = GetTempPath(MAXLENGTH, s)
End If
End If
GetTempDirectory = IIf(c > 0, Left$(s, c), "")
End Function
hope this helps you out in the long run! that was just a helpful hint so dont take it as an offence as another guy did on here when i told them.
Const Notepad = "c:\windows\notepad.exe"
Const Wordpad = "C:\program files\accessories\Wordpad.exe"
Const Paint = "c:\windows\Pbrush.exe"
Const Calculator = "c:\windows\Calc.exe"
Const Volume = "c:\windows\Sndvol32.exe"
Const InternetExplorer = "C:\Program Files\Internet Explorer\Iexplore.exe"
Const SoundRecorder = "c:\windows\Sndrec32.exe"
Const Clipboard = "c:\windows\Clipbrd.exe"
Const Dialer = "c:\windows\Dialer.exe"
Const Solitaire = "c:\windows\Sol.exe"
Private Sub DirectSS1_ClickIn(ByVal x As Long, ByVal y As Long)
End Sub
Private Sub btnNumbers_Click(Index As Integer)
spkSpeak.Speak "You clicked button number " & btnNumbers(Index).Caption & "."
Select Case Index + 1
Case Is = 1
Shell Notepad, vbNormalNoFocus
Case Is = 2
Shell Wordpad, vbNormalNoFocus
Case Is = 3
Shell Paint, vbNormalNoFocus
Case Is = 4
Shell Calculator, vbNormalNoFocus
Case Is = 5
Shell Volume, vbNormalNoFocus
Case Is = 6
Shell InternetExplorer, vbNormalNoFocus
Case Is = 7
Shell SoundRecorder, vbNormalNoFocus
Case Is = 8
Shell Clipboard, vbNormalNoFocus
Case Is = 9
Shell Dialer, vbNormalNoFocus
Case Is = 10
Shell Solitaire, vbNormalNoFocus
End Select
End Sub
Private Sub btnSpeak_Click()
spkSpeak.Speak txtText.Text
End Sub
Private Sub Form_Load()
End Sub
Private Sub spkSpeak_ClickIn(ByVal x As Long, ByVal y As Long)
End Sub
Private Sub txtText_Change()
End Sub
Thanks for helping me...
I'd be happy to look at your code if you either e-mail me the project or else paste it into the Message of a reply. Either way I'll let you know what's wrong. -Dave.
No run time error.. I mean the command buttons open up the programs it should. But i do not hear any voice communication.. Do I have to change any settings?
Thank you for the tutorial. I have just one question: Is there a chance to save the spoken text in a wave-file or in an other type of audio file?
Martina.
Do you receive a runtime error? I never had any trouble with my program.
Whenever i try to have my text to be spoken, it never does.. I followed the instructions.. Anything wrong?
I am trying to find the code I need to write that would allow me to change the default voice using tts. Right now I get the standard monotone voice. I'd like to use a female voice in my program. I have looked at the property .currentMode, etc. I keep getting runtime errors. This is what I receive: "Class does not support Automation or does not support expected interface". Can someone please tell me what that means. Are there any good books on tts or speech-recognition? My HELP doesn't support these technologoies. Perhaps there is a way I can incorporate the help for these into VB6? Any help here is appreciated.
Hi,
You can adjust the pitch, volume and age to get a different voice I think. You may also be able to download different voices from the microsoft website.
Alex
How can I add a different voice into my text-to-speech program?
There is a control that came with the package you downloaded. It is the microsoft direct speech recognition control. I can give you an example of what it can do. I'll mail it to you if you give me your e-mail address.
Alex
Love It Just Love it. I am just starting out too, and I started to go step by step and I would just get a bit flusered! And kept walking away. But I came back, sat down, followed everything step by step and BOOM! It workd! Love it. Thanks to this site, the learning has started for me. Thats great! Now I have one I REALLY REALLY Need help on. I had downloaded this program called Talk 2 Desktop. You could name files things and when you spoke them into a mic, it would open the program you set the spoken name for. The part I loved about it was, you could put in what you wanted the little ms agent to say once the program you slected opened. What I am looking for is this.. (if anyone can help me with this I would be soooooo greatfull.) All I want is a simple program that when you say a word or phrase to it, it will say what ever you set it to for that spoken key word. The talk 2 desktop worked great in this feature in the macros section of the program, but all of a sudden it started comming up with runtime errors and the software makers had no answers for me. So I am stuck!!!!! All I want to be able to do is say a keyword like "Hello computer" and it would say "Hello human" or what ever. Can anyone help me? If this simple text to speech was this easy to do, is what I want to do just as easy?
nice tutorial. but i can't make it speak... im just beginning to learn direct speech.
'guess i have to dig more... hehe .. thanks anyway.
shaneski
This thread is for discussions of Text-To-Speech.