Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Text to Speech
Started by Michael W. Sep 15 2015 02:43 PM

314 replies to this topic
release android ios
[TOPIC CONTROLS]
Page 3 of 13 1 2 3 4 5 »
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#51

Lerg

[GLOBAL: userInfoPane.html]
Lerg
  • Contributor

  • 537 posts
  • Corona Staff

On Android pitch and rate should work as intendent (1 - normal, 0.5 - slow, 2 - fast). But on iOS it's trickier. I'll see how I can improve it.

Also I've been working on the Android version and it now has callback and other features. It's not yet published, but you can preview the new API here http://spiralcodestudio.com/plugin-texttospeech/
I'll publish when I update iOS version. Keep in mind that it is a breaking change - you must now call texttospeech.init() before calling anything else.



[TOPIC: post.html]
#52

Kevin H

[GLOBAL: userInfoPane.html]
Kevin H
  • Contributor

  • 131 posts
  • Corona SDK

Thanks Lerg! Callback news just what I'd been hoping to hear - and the addition of voices will also be extremely useful. Will that be available on iOS?



[TOPIC: post.html]
#53

Lerg

[GLOBAL: userInfoPane.html]
Lerg
  • Contributor

  • 537 posts
  • Corona Staff

Thanks Lerg! Callback news just what I'd been hoping to hear - and the addition of voices will also be extremely useful. Will that be available on iOS?

Yes! The workflow will be a little different on iOS and Android, but I try to make it similar.



[TOPIC: post.html]
#54

Lerg

[GLOBAL: userInfoPane.html]
Lerg
  • Contributor

  • 537 posts
  • Corona Staff

Just uploaded a new version of the plugin. To use it you have to have Corona version 2830 or later.

 

What's new:

texttospeech.init(callback) to prepare the system. Breaking change.

texttospeech.getLanguagesAndVoices() to get available languages and voices.

texttospeech.setEngine(engine) to set a different engine on Android.

texttospeech.isSpeaking() returns true if speaking.

 

New options for texttospeech.speak()

options.voice - specify voice

option.id - just a tag value
options.onComplete(id) - called when speech has ended
 
Changed options.rate behavior on iOS (breaking change). Apparently it's a complete mess on iOS, so I decided not to make any adjustments of the value and directly submit your value into the guts of the speech engine. On Android it stays the same.
If nothing is submitted, default is default by OS.
 
So you have to find optimal rate values for different iOS versions and for Android.

 

Please see the updated docs:
http://spiralcodestudio.com/plugin-texttospeech/

And updated sample:
https://github.com/Lerg/plugins-sample-texttospeech



[TOPIC: post.html]
#55

Kevin H

[GLOBAL: userInfoPane.html]
Kevin H
  • Contributor

  • 131 posts
  • Corona SDK

Not sure how plugin updates work. Does the new plugin load automatically, or do we grab it again from the store?



[TOPIC: post.html]
#56

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,925 posts
  • Enterprise

Its automatic. Just build your app. It should pick up the latest. If you don't see the latest, give it a couple of hours to clear any caching involved.

 

Rob



[TOPIC: post.html]
#57

juliusbangert

[GLOBAL: userInfoPane.html]
juliusbangert
  • Contributor

  • 157 posts
  • Corona SDK

Excellent work Lerg!

This is a great development in the plugin, I will update my code to integrate the new functionalities.
Thanks for making the onComplete callback, it will be very useful for a lot of people.

I have no idea how the native C and Java APIs differ but did you say there's no possibility for predicting speech time for use in a progress bar?



[TOPIC: post.html]
#58

runewinse

[GLOBAL: userInfoPane.html]
runewinse
  • Contributor

  • 485 posts
  • Corona SDK

I don't have any use for the changes made lately (the only thing I've not got a grasp on is the iOS rate), but still applaud the work being continued on this project  :)



[TOPIC: post.html]
#59

Lerg

[GLOBAL: userInfoPane.html]
Lerg
  • Contributor

  • 537 posts
  • Corona Staff

Excellent work Lerg!

This is a great development in the plugin, I will update my code to integrate the new functionalities.
Thanks for making the onComplete callback, it will be very useful for a lot of people.

I have no idea how the native C and Java APIs differ but did you say there's no possibility for predicting speech time for use in a progress bar?

Thanks!

No, there is no way of getting the length of the speech. You can only measure it yourself and put in the code the durations.



[TOPIC: post.html]
#60

Lerg

[GLOBAL: userInfoPane.html]
Lerg
  • Contributor

  • 537 posts
  • Corona Staff

I don't have any use for the changes made lately (the only thing I've not got a grasp on is the iOS rate), but still applaud the work being continued on this project  :)

Thanks!

@everyone, when somebody get's the rates values across iOS versions/devices, please share. Also please test the Alex voice, my iPad doesn't have it.



[TOPIC: post.html]
#61

juliusbangert

[GLOBAL: userInfoPane.html]
juliusbangert
  • Contributor

  • 157 posts
  • Corona SDK

Thanks!

No, there is no way of getting the length of the speech. You can only measure it yourself and put in the code the durations.

Yea, I thought of timing the speech of phrases using the new onComplete callback and storing them to a table for future reference and also calculating average length per syllable etc from that... But because there is sometimes a delay at the start of the texttospeech.speak() function call it would need an onStart callback as well.  Doesn't really give a solid solution to predicting time of speech anyway so I'll forget about it.
The iOS rate problem is really the thing now.



[TOPIC: post.html]
#62

Lerg

[GLOBAL: userInfoPane.html]
Lerg
  • Contributor

  • 537 posts
  • Corona Staff

Hm. I can add onStart.



[TOPIC: post.html]
#63

juliusbangert

[GLOBAL: userInfoPane.html]
juliusbangert
  • Contributor

  • 157 posts
  • Corona SDK

onStart would be really useful too.
In my case it could be used for starting the speech progress view and disabling some UI during speech.



[TOPIC: post.html]
#64

Lerg

[GLOBAL: userInfoPane.html]
Lerg
  • Contributor

  • 537 posts
  • Corona Staff

Ok, wait for it. Probably next weekend.



[TOPIC: post.html]
#65

Kevin H

[GLOBAL: userInfoPane.html]
Kevin H
  • Contributor

  • 131 posts
  • Corona SDK

Extreme awesomeness. Callback works like a charm on iOS. Fantastic work!



[TOPIC: post.html]
#66

juliusbangert

[GLOBAL: userInfoPane.html]
juliusbangert
  • Contributor

  • 157 posts
  • Corona SDK

Hi Lerg.
The rate for iOS 7 is really messed up since this update. It used to be ok and I didn't mind that the default needed to be set to 0.8 rather than 1.0. But now even putting the rate right down to the minimum ( 0.5 ) is really too fast. Is there any suggestions about getting this working again because at the moment the speech can't be understood it's so fast. Should I be going lower than 0.5 ?

 



[TOPIC: post.html]
#67

juliusbangert

[GLOBAL: userInfoPane.html]
juliusbangert
  • Contributor

  • 157 posts
  • Corona SDK

Also... Calling texttospeech.getLanguagesAndVoices() crashes my app straight away on iOS 7. 



[TOPIC: post.html]
#68

Lerg

[GLOBAL: userInfoPane.html]
Lerg
  • Contributor

  • 537 posts
  • Corona Staff

Hi Lerg.
The rate for iOS 7 is really messed up since this update. It used to be ok and I didn't mind that the default needed to be set to 0.8 rather than 1.0. But now even putting the rate right down to the minimum ( 0.5 ) is really too fast. Is there any suggestions about getting this working again because at the moment the speech can't be understood it's so fast. Should I be going lower than 0.5 ?

Yes, I *think* allowed values here are from 0.0 to 1.0. You can send any value and see if it works.

Please post a crash report here so I can figure out what's wrong.



[TOPIC: post.html]
#69

juliusbangert

[GLOBAL: userInfoPane.html]
juliusbangert
  • Contributor

  • 157 posts
  • Corona SDK

Ok, I'll give that a go with values lower than 0.5.
So in your documentation where it says : options.rate - float, adjust speaking speed, Android value from 0.5 to 2.0, default is 1.0.
Is that incorrect? And is the range for pitch also incorrect?

The device's syslog in the Corona simulator shows nothing when it crashes but it mentions TextToSpeechPluginLibrary::getLanguagesAndVoices in the crash report from xCode. I've attached the crash report in a txt file.

 

Attached Files



[TOPIC: post.html]
#70

Lerg

[GLOBAL: userInfoPane.html]
Lerg
  • Contributor

  • 537 posts
  • Corona Staff

Ok, I'll give that a go with values lower than 0.5.
So in your documentation where it says : options.rate - float, adjust speaking speed, Android value from 0.5 to 2.0, default is 1.0.
Is that incorrect?

This is correct, this is for Android. For iOS docs say - no idea.

 

And is the range for pitch also incorrect?

Pitch is correct, it's the same on Android and iOS (at least should be).

 



[TOPIC: post.html]
#71

Lerg

[GLOBAL: userInfoPane.html]
Lerg
  • Contributor

  • 537 posts
  • Corona Staff

Updated the plugin.
 

New options for texttospeech.speak()

options.onStart(id) - called on start.
options.onProgress(id, start, count) - iOS only, called to indicate what portion of the text is being spoken. Values are for UTF-8 string.

See updated docs and sample.


[TOPIC: post.html]
#72

Lerg

[GLOBAL: userInfoPane.html]
Lerg
  • Contributor

  • 537 posts
  • Corona Staff

@juliusbangert, possibly fixed the crash.



[TOPIC: post.html]
#73

juliusbangert

[GLOBAL: userInfoPane.html]
juliusbangert
  • Contributor

  • 157 posts
  • Corona SDK

This is great news Lerg. But how can I test it? Do we have to wait for the next daily build? The latest one ( 2843 ) was pushed up on Thursday.



[TOPIC: post.html]
#74

Lerg

[GLOBAL: userInfoPane.html]
Lerg
  • Contributor

  • 537 posts
  • Corona Staff

This is great news Lerg. But how can I test it? Do we have to wait for the next daily build? The latest one ( 2843 ) was pushed up on Thursday.

All plugin updates are decoupled from daily builds, because they are downloaded separately. So just use any recent version and you should be having the latest version of the plugin.



[TOPIC: post.html]
#75

juliusbangert

[GLOBAL: userInfoPane.html]
juliusbangert
  • Contributor

  • 157 posts
  • Corona SDK

Thanks for the ongoing great work Lerg.
The bug with texttospeech.getLanguagesAndVoices() seems to be fixed. 

I'm having an issue with onStart now though, it seems to not get called if texttospeech.speak() is called with the same text more than once. It's strange but I've been trying to trace this bug for hours and it seems to point to that.




[topic_controls]
Page 3 of 13 1 2 3 4 5 »
 
[/topic_controls]

Also tagged with one or more of these keywords: release, android, ios