TexttoSpeech for iOS

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Aduro91
Posts: 36
Joined: Sat Jul 22, 2023 8:49 pm

TexttoSpeech for iOS

Post by Aduro91 » Fri Aug 18, 2023 9:51 pm

Hi all,

I've downloaded and installed the LiveCode-Extension-iOS-SpeechSynthetizer and enabled for my project properly (I think). See here https://github.com/SwissEduHack/LiveCod ... ynthetizer

However, I'm not sure how to work the 'EdHSpeak' command as it doesn't seem to be working. Does anyone know how I would go about using this extension?

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: TexttoSpeech for iOS

Post by jmburnod » Fri Aug 18, 2023 11:06 pm

Hi,
SpeechSynthetizer was created before LiveCode speech library for iOS.
Disadvantage of SpeechSynthetizer is it doesn’t work on IDE and you have to make an iOS standalone to test it.
That is not the case with the LiveCode speech library for iOS.
On other side SpeechSynthetizer knows Pause/Resume but not LiveCode speech library for iOS.

EdHSpeak is a function.
You have to define value for rate, pitch, volume, voice
Rate between 0 and 1
Pitch between 0.5 and 2
Volume between 0 and 1
Voice (one of the voices in the list returned by getVoices() or language and locale like "fr-FR")

Code: Select all

…
put 0.4 into tRate
put 0.88 into tPitch
put 1 into tPitch
put Thomas into tVoice
put EdHSpeak( tRate, tPitch,tVol, tVoice, theText) into tToSay
...
Best regards
Jean-Marc
https://alternatic.ch

Aduro91
Posts: 36
Joined: Sat Jul 22, 2023 8:49 pm

Re: TexttoSpeech for iOS

Post by Aduro91 » Sat Aug 19, 2023 12:19 pm

jmburnod wrote:
Fri Aug 18, 2023 11:06 pm
Hi,
SpeechSynthetizer was created before LiveCode speech library for iOS.
Disadvantage of SpeechSynthetizer is it doesn’t work on IDE and you have to make an iOS standalone to test it.
That is not the case with the LiveCode speech library for iOS.
On other side SpeechSynthetizer knows Pause/Resume but not LiveCode speech library for iOS.

EdHSpeak is a function.
You have to define value for rate, pitch, volume, voice
Rate between 0 and 1
Pitch between 0.5 and 2
Volume between 0 and 1
Voice (one of the voices in the list returned by getVoices() or language and locale like "fr-FR")

Code: Select all

…
put 0.4 into tRate
put 0.88 into tPitch
put 1 into tPitch
put Thomas into tVoice
put EdHSpeak( tRate, tPitch,tVol, tVoice, theText) into tToSay
...
Best regards
Jean-Marc
Thanks very much Jean-Marc.

This particular line will be helpful I think 'put EdHSpeak( tRate, tPitch,tVol, tVoice, theText) into tToSay' because I was having some issues using the version of this function from the Read Me. I'm sure it was my own beginner-level confusion though.

I will look into speech library as that might be all I need.

Thanks again!

Aduro91
Posts: 36
Joined: Sat Jul 22, 2023 8:49 pm

Re: TexttoSpeech for iOS

Post by Aduro91 » Sat Aug 19, 2023 3:42 pm

jmburnod wrote:
Fri Aug 18, 2023 11:06 pm
Hi,
SpeechSynthetizer was created before LiveCode speech library for iOS.
Disadvantage of SpeechSynthetizer is it doesn’t work on IDE and you have to make an iOS standalone to test it.
That is not the case with the LiveCode speech library for iOS.
On other side SpeechSynthetizer knows Pause/Resume but not LiveCode speech library for iOS.

EdHSpeak is a function.
You have to define value for rate, pitch, volume, voice
Rate between 0 and 1
Pitch between 0.5 and 2
Volume between 0 and 1
Voice (one of the voices in the list returned by getVoices() or language and locale like "fr-FR")

Code: Select all

…
put 0.4 into tRate
put 0.88 into tPitch
put 1 into tPitch
put Thomas into tVoice
put EdHSpeak( tRate, tPitch,tVol, tVoice, theText) into tToSay
...
Best regards
Jean-Marc
I have another question if you might perhaps be able to answer.

With speech library, are you aware of any way to input phonetics rather than whole words? I found the following thread https://forums.livecode.com/viewtopic.php?t=31113 on this question which uses an example referring to the old RevSpeak command:

Revspeak "[[inpt PHON]]"&"1pAA_k>IXIX_"

I've tried this for the speechSpeakUtterance context but it doesn't seem to work.

Cheers!

Post Reply

Return to “Talking LiveCode”