Text to Speech

Cheers for that.

Yeah I suppose it can’t work like that, wouldn’t make sense for the person listening. Same if you try and use Google translate for app descriptions, it doesn’t read well.

EDIT -

Another 2 questions.

Does your locale match system.getPreference( “locale”, “identifier” ) ?

So I could set the language of the plugin from using this Corona function (iOS only)?

Is the default language always english or the default language of the device?

Dave

I’ve used this plugin for a while now and I have to say, it’s working very well!

One thing though - is there some kind of return value / error number that can be used? I’ve been trying to use “no-NO” as the lanugage string (Norwegian). It’s on your list, but it doesn’t seem to work. What’s happening is that the previous language seems to be used instead of Norwegian.

Is there any way to find out what happens in this case? 

I’m running on Android by the way.

Guys,

in iOS9 speak rate is changed. For iOS 7/8 value rate = 0.6 was enough but now you should aim for rate = 1

It’s possible, I’ll try to implement it the meantime.

Good to know, thanks!

local lang = system.getPreference( "locale", "language" ) .. '-' .. system.getPreference( "locale", "country" )

Default language is always English. Simply ‘en-US’ value.

BTW I dont know you should fix it (speak rate on iOS 9) cuz it can change in next iOS subversion :slight_smile: Just put something like this to documantation:

[lua]

if system.getInfo(“environment”) == “device” then

local checkIOS = system.getInfo(“platformVersion”)

local a,b=checkIOS:match"([^.]*).(.*)"

if tonumber(a) < 9 then

myApp.speakRate = 0.6

end

end
[/lua]

Hi,

  Thank you for the excellent work.

  Just want to send a report to you. I test it on ASUS_T00G phone. Android 4.4.2.

  Speak in English is OK, but Speak Russian and Chinese (zh-TW) failed.

Bob

Thank you, this is an excellent plugin…
A few quick questions :

• Is there anyway to save a speech snippet to an audio file and store on the device?
• Is there a way to use an onComplete callback when the speech has finished playing?
• Is there a way to return a predicted speech time in milliseconds?

Bob, thanks, looks like some devices don’t have all speech engines preinstalled.

juliusbangert, iOS and Android speech API differ significantly and I had to use the common remainder. So no save to file, onComplete might be possible to make, but it would take a while. And no predicted time.

Sorry for the dumb question, but what is the plugin string needed for build.settings? I wish those were put in the store listing. Just so happens Spiral Code Studio documentation page is down right now.

[lua]settings = {

   plugins = {

      [‘plugin.texttospeech’] = { publisherId = ‘com.spiralcodestudio’ },

    },

}[/lua]

Thank you! I wish all store plugins had that information on the page.

Sorry, my mistake. Please check the above post again.

I’ll reach out to Lerg and ask what’s up with his site.

Thank you, Lerg, great module. I also am using it for an education app, a test-practice app (and maybe a test-taking app), particularly for students who aren’t fast good readers. I am looking forward to onComplete functionality, it will make the flow a lot better (I don’t show the answers until the question has been read, helping with focus). Thanks again, great stuff.

Hi Lerg.
Any news on a possible onComplete callback function? This would be so so good. :slight_smile:
Also, I realise that save audio to file functionality would be very difficult to implement but do you happen to know of any way in Corona to live record what’s playing in the system audio as another (dirty) way to capture the speech?

onComplete is relatively easy to implement on Android, but on iOS it requires a significant refactoring. Maybe next weekend I’ll do it.

The dirtiest hack would be to use the microphone. On iOS it’s not possible to record speech to a file.

Thanks Lerg. Recording the speech through microphone would be super dirty indeed, not too keen to go down that route, I think I’d rather use an API like google TTS or just do without that feature in my app…
onComplete would be super though, at the moment I’m calculating each words number of syllables and estimating speech time by the rate set ( which is dirty and inaccurate ).

Awesome work, fit right into a project I’m currently building. Just want to put in a vote for a callback, sure would be useful!