|
-
Apr 2nd, 2013, 06:59 AM
#1
Thread Starter
Junior Member
Text to Speech on Windows 7?
Ok, so I just remember one of the 'old' days program, a two line one, which was fascinating when I was younger. The code is
Code:
Private Sub Command1_Click()
Set TtS = CreateObject("SAPI.spVoice")
TtS.speak Text1
End Sub
Pretty simple, worked fine on XP (my friend, to whom I mailed it, claims to) but throws just abrupt silence on my Windows 7. I know that this is because I am missing Speech Libraries or the required Control. I have been searching from morning and all I could get to was, "Microsoft Direct Text-To-Speech control" is what I need. And the hunt for it has come to nothing upto now, I couldn't just locate that 'part' of the download. I go to Microsoft speech sdk, there is 5.1 which has about 5 download, one of which weighs 300+ and the rest are under 100. Are these what I should be downloading? OR should I get SDK 11? Which is within 5 all together? I am totally clueless, or do I need 5.1 + 11 to get it working on Windows 7? Or is there an alternative to this?
Could anyone help me with this? Thanks in advance.
-
Apr 2nd, 2013, 05:54 PM
#2
Re: Text to Speech on Windows 7?
You probably won't need to download anything to get the Microsoft Speech API to work on your Windows 7 system. Just set a reference to the "Microsoft Speech Object Library" in your project. Here are the documentations for the SpVoice object, the Speak method and the Volume property.
On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)
-
Apr 4th, 2013, 09:56 AM
#3
Thread Starter
Junior Member
Re: Text to Speech on Windows 7?
Thank you Bonnie. 
My program works fine on my Laptop, which also runs on Windows 7, but doesn't on PC. Will check out those links now.
-
Apr 5th, 2013, 12:32 PM
#4
Thread Starter
Junior Member
Re: Text to Speech on Windows 7?
I set the Reference to it, hope it is the one from Project -> References, but that doesn't work either.
I get the delay, I mean the buttons aren't working and text box cannot be edited for a little while, say 1 second, in other words, form behaves as is it IS reading, but it isn't. I don't hear any vocal output. What could be wrong?
-
Apr 5th, 2013, 01:02 PM
#5
Re: Text to Speech on Windows 7?
 Originally Posted by Immanuel
I set the Reference to it, hope it is the one from Project -> References, but that doesn't work either. 
Can you post a screenshot of your References dialog box?
 Originally Posted by Immanuel
I get the delay, I mean the buttons aren't working and text box cannot be edited for a little while, say 1 second, in other words, form behaves as is it IS reading, but it isn't. I don't hear any vocal output. What could be wrong?
Have you set the Volume property to max before invoking the Speak method? Can you also post the code you're using?
On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)
-
Apr 5th, 2013, 01:12 PM
#6
Thread Starter
Junior Member
Re: Text to Speech on Windows 7?
Code:
Private Sub btn1_Click()
Set TtS = CreateObject("SAPI.spVoice")
'TtS.Volume = 100
TtS.speak Text1
End Sub
Private Sub Form_Load()
Text1.Text = ""
End Sub
That is all, nothing fancy, I just want to see if it can read the Text. Doesn't throw error. Neither does it read, I tried that volume control, the one you gave link to was for SAPI5.4, it has the object from SpeechLib.Spvoice, I doubt that it is the same as SAPI5.spvoice, either way, trying Volume paramter on the object didn't seem to work.
BTW, the code, without Volume (commented above) works fine on my friend's Windows 8 Laptop too. :/
-
Apr 5th, 2013, 01:34 PM
#7
Re: Text to Speech on Windows 7?
There are many kinds of programs that cannot be developed using XP any more.
In the post-XP era lots of things have changed. The audio subsystem in Windows is quite different for example. So to develop SAPI programs for post-XP systems you may need a newer version of the SDK and develop on Vista or later.
Microsoft Speech Platform - Software Development Kit (SDK) (Version 11) has the required downloads for modern versions of Windows.
See Microsoft Speech Platform Software Development Kit (SDK) version 11.0 – Release Notes which says:
Windows XP support for SDK tools. The Grammar Development Tools (with the exception of PrepareGrammar.exe) are now supported on computers running Windows XP, but only for some providers. Using the "local" provider is not supported on Windows XP. See Speech Recognition Engine Configuration File Settings for more information.
and:
In addition, Windows XP service Pack 3, has limited support under the following conditions:
- x86 only
- The SDK tools on Windows XP will only work when configured against a hosted (non-local) recognizer
- Note: In addition, SAPI is not supported on Windows XP
While the Version 11 SDK only provides limited support for XP SP3 (and none at all for SAPI) it may be possible that a SAPI program written and compiled for XP on XP might still work on Windows 7 as long as you deploy the modern versions of the redistributable libraries.
Microsoft Speech Platform - Runtime (Version 11)
Note that both the SDK and the Runtime come in x86 and x64 variations. I don't think that VB6 can work with the x64 variety at all, and have not tested whether the x86 variety will install into a 64-bit Windows system.
-
Apr 6th, 2013, 01:05 AM
#8
Re: Text to Speech on Windows 7?
 Originally Posted by Immanuel
That is all, nothing fancy, I just want to see if it can read the Text. Doesn't throw error. Neither does it read, I tried that volume control, the one you gave link to was for SAPI5.4, it has the object from SpeechLib.Spvoice, I doubt that it is the same as SAPI5.spvoice, either way, trying Volume paramter on the object didn't seem to work.
BTW, the code, without Volume (commented above) works fine on my friend's Windows 8 Laptop too. :/
This works fine for me on Windows 7.
vb Code:
Option Explicit Dim Tts As SpVoice Private Sub btn1_Click() Set Tts = CreateObject("SAPI.spVoice") 'TtS.Volume = 100 Tts.speak Text1.Text End Sub Private Sub Form_Load() Text1.Text = "" End Sub
Stupid question but are you actually putting text in the textbox before you click the button?
Edit:
The above code was tested with Microsoft Speech SDK 5.1.
Last edited by Nightwalker83; Apr 6th, 2013 at 01:15 AM.
Reason: Adding more!
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
https://get.cryptobrowser.site/30/4111672
-
Apr 6th, 2013, 01:20 AM
#9
Thread Starter
Junior Member
Re: Text to Speech on Windows 7?
Yeah, I enter the text into the TextBox, say "Hello" and the click button, the form is unresponsive for a particular time interval as if its reading it, but no vocal output.
Just out of curiosity, I downloaded Microsoft Talk It, I think it'd work on the same principle, it does EXACTLY the same, unresponsive unless I press Stop Talking, behaves as if it is talking. I am pretty sure that it should throw error if there is no Speech Library files (SAPI5) right? Or would that be the problem that I face?
I just now turned on narrator from Ease of Access / Accessibility and it also maintains a pin drop silence. :/ As I mentioned in OP, I know that this isn't code related (atleast I feel that way) but what EXACT module/SDK should I be downloading? The redistributables come as ".MSM" files, Googling said that it requires some Installer to be made and stuff, so what should I venture into next?
-
Apr 6th, 2013, 02:16 AM
#10
Re: Text to Speech on Windows 7?
-
Apr 6th, 2013, 02:20 AM
#11
Re: Text to Speech on Windows 7?
Merge modues (MSMs) are used for including dependencies in a Windows Installer package (.MSI) for people to use to install your program.
The newer versions (for post-XP Windows versions) also come as a standalone installer (MSI) so you don't have to build your own, but the ancient version 5.x stuff for XP seems to only come as MSMs.
You'd need Visual Studio 6.0 Installer 1.1 which used to be a free download for VS6/VB6 licensees, but the downloads are no longer available from Microsoft (two files).
Last edited by dilettante; Apr 6th, 2013 at 02:31 AM.
-
Apr 6th, 2013, 02:30 AM
#12
Re: Text to Speech on Windows 7?
If you need the Speech Runtime for a Windows 7 machine look at the second link in post #7 above.
-
Apr 6th, 2013, 05:33 AM
#13
Thread Starter
Junior Member
Re: Text to Speech on Windows 7?
I got the Speech Runtime files, upon Install, it asked to repair, which means I already had it. So I uninstalled it and then reinstalled it, still doesn't work. Your sample project loads up fine, does the same though, Mary and Mike throw up errors "Cannot create object" then other two, Sample TTS and Anna "seem" to work, but no vocal output. :/ This is more and more developing into a chase after the wind.
Edit:
I downloaded another Free TTS from internet "Ultra Hal" it also does the same, shows progress bar as though its reading, but still I don't hear any output.
BTW I hope that the Vocal output would get cancelled out on 5.1 Surround Sound System. My desktop has it, the vocal should be on Central Speaker IIRC, and the voice of other games (5.1 supported) and such works fine.
-
Apr 6th, 2013, 06:13 AM
#14
Re: Text to Speech on Windows 7?
Not sure if this video will be of any help or not?
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
https://get.cryptobrowser.site/30/4111672
-
Apr 6th, 2013, 06:52 AM
#15
Thread Starter
Junior Member
Re: Text to Speech on Windows 7?
Thanks for the help, but that is just another TtS, with CFS having pulled out of Speakonia, I had to get it from CNET, the Speakonia itself doesn't work, just like the other TTS I mentioned, and this also didn't add the voice or speech functionality to this simple code in my system yet.
-
Apr 6th, 2013, 07:13 AM
#16
Re: Text to Speech on Windows 7?
 Originally Posted by Immanuel
BTW I hope that the Vocal output would get cancelled out on 5.1 Surround Sound System. My desktop has it, the vocal should be on Central Speaker IIRC, and the voice of other games (5.1 supported) and such works fine.
Not sure about this, but if your system has another audio output device, then you could try selecting that via the AudioOutput property.
On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|