how to use Speech / Parole feature on osX Lion ?

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

fpierron
Posts: 56
Joined: Thu Dec 16, 2010 11:12 am
Contact:

how to use Speech / Parole feature on osX Lion ?

Post by fpierron »

Hi,
As you may have seen, osx Lion offers now speech in many languages (not only english but fr, de, sp, etc...).

How to use it in LiveCode ?

1/ Enable new voices if the user didn't do that : you have to donwload them.
2/ Select the right voice
3/ modify the speed
4/ send strings to voices

I can't find function related to that.

Best,

Frédéric
Klaus
Posts: 14324
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: how to use Speech / Parole feature on osX Lion ?

Post by Klaus »

Bonjour Frédéric,
1/ Enable new voices if the user didn't do that : you have to donwload them.
Since this is a feature built into the OS, I doubt that you can do this via LiveCode.
2/ Select the right voice
3/ modify the speed
Check "revSpeech" in the dictionary!
But I am not sure if they work correct with the new voices in Lion!

EDIT!
Just checked, they do work!
4/ send strings to voices
See above but can also us SHELL to do so:
...
put "Bonjour Frédéric, ça va bien?" into tString
get shell("say" && tString)
...
Works great with the new german voices! :D


Best

Klaus
jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2734
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: how to use Speech / Parole feature on osX Lion ?

Post by jmburnod »

Bonjour Frédéric,
Check also "revstopSpeech" in the dictionary

Klaus said :
See above but can also us SHELL to do so:
put "Bonjour Frédéric, ça va bien?" into tString
get shell("say" && tString)
Is there an equivalent of "revstopSpeech" with the shell command ?

Best

Jean-Marc
https://alternatic.ch
Klaus
Posts: 14324
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: how to use Speech / Parole feature on osX Lion ?

Post by Klaus »

Hi Jean-Marc,

sorry, no idea.

You can check the man pages for SAY, enter this into the TERMINAL:
man say


Best

Klaus
Klaus
Posts: 14324
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: how to use Speech / Parole feature on osX Lion ?

Post by Klaus »

Hm, since SHELL calls are blocking in LiveCode, this doesn't matter at all :(
But REVSPEAK should work!
fpierron
Posts: 56
Joined: Thu Dec 16, 2010 11:12 am
Contact:

Re: how to use Speech / Parole feature on osX Lion ?

Post by fpierron »

Tanks a lot.
I Will mâle some try.
Do you think it possible to record The VoiceOver generated by The synthetiser ?

Best,

Frédéric
Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: how to use Speech / Parole feature on osX Lion ?

Post by Mark »

Hi Frédéric,

eSpeak isn't as beautiful as Lion's speech feaures, but it is cross-platform (inlcuding Mac) and available in quite a few languages. It can also be used to create sound files.

Regarding Lion's speech, you can use the revSetSpeechVoice command to change voices. I'd expect to be able to select a voice in a different language. Use the revSpeechVoices function to see a list of all voices available to LiveCode.

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
fpierron
Posts: 56
Joined: Thu Dec 16, 2010 11:12 am
Contact:

Re: how to use Speech / Parole feature on osX Lion ?

Post by fpierron »

Thanks for the information but I need something that do not need to be downloaded apart from my app.

Frédéric
bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4219
Joined: Sun Jan 07, 2007 9:12 pm

Re: how to use Speech / Parole feature on osX Lion ?

Post by bn »

Hi Frédéric,

here is a little stack that lets you type/paste text into a field. This text is then put into an AppleScript and send off. It will create a sound file (.aif) on the desktop with the text spoken with the current voice.

Works only on a Mac due to Applescript.

I did not test on Lion but it works on Snow Leopard. Should work on Lion also.

Kind regards

Bernd
Attachments
textToSpeechToRecording.livecode.zip
(1.84 KiB) Downloaded 423 times
Klaus
Posts: 14324
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: how to use Speech / Parole feature on osX Lion ?

Post by Klaus »

Bonjour Frédéric,
fpierron wrote:Do you think it possible to record The VoiceOver generated by The synthetiser ?
yes, check the example of Bernd that uses AppleScript, but this can also be done via SHELL, if you like this better :D

Open the terminal and type:
man say
Hit enter and see all possible options for this shell command.


Best

Klaus
jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2734
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: how to use Speech / Parole feature on osX Lion ?

Post by jmburnod »

Hi Bernd,
Should work on Lion also.
Yes. I tested it

Best from Geneva

Jean-Marc
https://alternatic.ch
bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4219
Joined: Sun Jan 07, 2007 9:12 pm

Re: how to use Speech / Parole feature on osX Lion ?

Post by bn »

Hi Jean-Marc,

thanks for testing. I am still not on Lion yet.

I gather that you are into compiling externals. Wow. Xcode / C, objective C scare me to death.

Kind regards

Bernd
jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2734
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: how to use Speech / Parole feature on osX Lion ?

Post by jmburnod »

Hi Bernd,
Wow. Xcode / C, objective C scare me to death.
Me too.
I'm not the author, i just have found a way to use it for iPad

Kind regards

Jean-marc
https://alternatic.ch
jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2734
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: how to use Speech / Parole feature on osX Lion ?

Post by jmburnod »

Hi All,

It seem Applescript is the only one way to speak a language with diacritical chars and apostrophe

• RevSpeak don't speak a string with diacritical chars
• Shell don't speak a string with an apostrophe

The best way should be LiveCode fix the revspeak.
Someone know something about this in LC 5.5 ?

Best regards

Jean-Marc
https://alternatic.ch
Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: how to use Speech / Parole feature on osX Lion ?

Post by Mark »

Hi Jean-Marc,

You can use apostrophs in the shell if you put the entire string inside quotes or if you escape the apostrophe with a preceding backslash.

The shell understands UTF8, which means you can use any character if you convert it to UTF8 first. I'm not sure that you can call the shell using UTF8 from LiveCode, but you can write a simple shell script to disk, change the permissions and use the shell to run it:
put "say" && quote & "Je suis à l'école" & quote into url "binfile:talk.sh"
get shell("chmod 755 talk.sh")
get shell("talk.sh")
Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Post Reply