Hello,
since I do not know so much about the Windows-world, may I ask:
- where available voices are stored (i.e. the path), in order to show them in a list?
- since, as far as I know, Xojo-speak-functionality does not allow to set a particular voice (something like: speak using xxx voice), is there a way to set in code a particular voice as the default one?
No plugins, please.
Thank you.
You may want to look into the MBS Win Plugin from us:
http://www.monkeybreadsoftware.net/pluginpart-winspeech.shtml
We have a couple of classes there for Voices and Speech. So you can query list of voices and select one.
Christian, at present I’m asking for no-plugin suggestions.
Sorry. Missed that, but anyone else may want to try it.
Xojo is great because it makes things simpler. Try the following code which will say “Hello World”
//Text to Speech
Dim MyVoice as New OLEObject("SAPI.SPVoice")
MyVoice.Speak("Hello World")
Sorry, I missed a few of the options that you wanted. Add this code in a pushbutton. There are two voices on my machine:
0) Microsoft David Desktop - English (United States)
- Microsoft Zira Desktop - English (United States)
[code] //Text to Speech
Dim MyVoice as New OLEObject(“SAPI.SPVoice”)
Dim MyVoiceToken as New OLEObject(“SAPI.SPObjectToken”)
//0=David, 1=Zira on my machine
MyVoice.Voice = MyVoice.GetVoices.Item(0) //assign a voice
MyVoice.Volume=100 //1-100%
MyVoice.Rate = 0 //0 (normal) - 10 (fast)
MyVoice.Speak(“Hello World”) //text to speak
MyVoiceToken = MyVoice.GetVoices.Item(0) //Get token information
MsgBox MyVoiceToken.GetDescription //Show this voice info
[/code]
Edit: Changed Names for male =David and female = Zira
Well, well, well! Instead of “Hello world!”, let me say: “Hello list!” + endofline + “You are great!”.
Thank you, Michel, for the references; and thank you, Eugene, for the code that covers all my needs.
And putting Eugene’s last two lines in a loop, one gets a list of available voices:
for i as integer = 0 to MyVoice.GetVoices.count-1
MyVoiceToken = MyVoice.GetVoices.Item(i) //Get token information
MsgBox MyVoiceToken.GetDescription
next
Thanks again.
Hello,
my next step has been to install some other FOREIGN voice besides the default David and Zira.
Following instruction from Microsoft (Add Language etc.), I downloaded and installed the Italian, Greek and Hebrew packages, but then I found that they do not contain voices.
So googling for Italian voices I found lhttsiti.exe (http://www.zero2000.com/free-text-to-speech-natural-voices.html); but after installing it and rebooting, no Italian voice appeared next to David and Zira, in the text-to-speech menu. I guess the reason is that the voice is a SAPI4 voice, while --another guess-- windows 10 may be expecting SAPI5.
I noticed that the fonts shown in a Goggle search, in order to work, usually expect a supporting engine to be installed; and this does not make me feel comfortable, also because I do not have experience with the Windows world.
Has anybody been successful installing extra foreign (free) voices for Windows 10 without extra engines?
I’d appreciate some input. Thank you.
Hello Carlo,
Here is the way that I installed Microsoft Elsa Desktop - Italian (Italy) on Windows 10:
1) go to Settings>Time & Language>Region and Language>+ Add a language
2) Choose a language (I chose Italian)
3) Click on the Itanliano (Italia) Language Pack and select Options
4) Select Speech (Download) Note: Not all languages have a speech voice addon. Windows will say something like 'we are adding a new feature'
5) Wait for the program to download and install (about 2 minutes on my machine)
6) Go to Settings>Speech and select 'Microsoft Elsa Desktop - Italian (Italy)' and press 'Preview Voice'
7) Run the Xojo program and it should be listed with the for-next loop you created
Some languages, such as Russian, require Windows to be restarted to install the language.
This worked for me, let me know if it works for you
Edit: Added reboot option
Hello Eugene,
I do not know what happened yesterday: it’s true I had a sudden cold and flue, and may be that impaired my brain. Yet, I remember I followed the same route you have suggested above, but getting no voice.
This morning, following the same route, in a couple of minutes I got Elsa installed. And running YOUR Xojo program, Elsa found her rightful place in the for-next loop.
Time to retire and spend my time gardening?
Anyway, I thank you again, for your kindness and availability, + double smileys!