vilicvane / cordova-plugin-tts

Cordova Text-to-Speech Plugin (Maintainer WANTED!)
177 stars 137 forks source link

Now very slow rate on iOS 11 #62

Open jlchereau opened 6 years ago

jlchereau commented 6 years ago

I used to have a rate value of 1.5 on iOS and 1 on other platforms. Rate values of 0.75, 1 and 1.5 now make no difference on iOS 11: speech rate is very slow.

myrsk commented 6 years ago

Same thing with me, any fixes?

myrsk commented 6 years ago

this.tts.speak({ text: this.answer, rate: 1.5 }) .then(() => console.log('Success')) .catch((reason: any) => console.log(reason));

This seems to work fine now ...

jlchereau commented 6 years ago

@vilic, are you planning a new release on npm soon? Still v0.2.3 out there and it is not working. Thx. https://www.npmjs.com/package/cordova-plugin-tts

baca0 commented 6 years ago

I have the same issue, and I waiting for the update. Please @vilic

andersborgabiro commented 6 years ago

1.5 works on iOS, but sometimes it speaks with a very high speed, despite the same setting every time.

jlchereau commented 6 years ago

v0.2.3 is old and unreliable and since the speed formula changes without notice, you cannot simply specify https://github.com/vilic/cordova-plugin-tts to benefit from the latest improvements. You have to designate a commit number in config.xml and stick to it.

The following works fine for me:

<plugin name="cordova-plugin-tts" spec="https://github.com/vilic/cordova-plugin-tts#b25e7ac" />

with

rate: RX_IOS.test(window.navigator.userAgent) && !window.MSStream ? 0.7 : 2

For previous commits, I had:

// With https://github.com/vilic/cordova-plugin-tts#0.2.3
// rate: RX_IOS.test(window.navigator.userAgent) && !window.MSStream ? 1.5 : 1

// With https://github.com/vilic/cordova-plugin-tts#deecc11
// rate: RX_IOS.test(window.navigator.userAgent) && !window.MSStream ? 1.1 : 1.2

Versioning is the way to go otherwise you are constantly wondering what is going wrong as voice rates change with new commits, requiring constant adjustments for iOS and Android.

andersborgabiro commented 6 years ago

It sounds reasonably that 1 should always be a certain tried out "normal speaking rate".

Any TTS plugin that's more trusted / more up-to-date?

jlchereau commented 6 years ago

The only other one I know is https://github.com/macdonst/SpeechSynthesisPlugin. My app was started before this plugin got released, so I have not tried it but @macdonst is an active member of teh Phonegap community with a track record of excellent plugins. Please report your experience here especially if you decide migrating away from this plugin.

andersborgabiro commented 6 years ago

Only Android though. My problem with speed-ups is with iOS.

The Nuance TTS is great, and I've used it for native Android. Maybe it makes the app huge though. Will test.

andersborgabiro commented 6 years ago

With cordova-plugin-tts#b25e7ac I get too slow speech on Android and incomprehensibly fast on iOS (the same speed as when 0.2.3 freaks out). Both use rate set to 1. Did you do any scaling of rate?

I also noticed that "then()" doesn't work with either 0.2.3 or b25e7ac. Only "options, success, error" does.

If I don't set rate at all I don't get fast speech on iOS, but rather it's generally a bit too slow. Android has a reasonable rate.

@vilic A fresh take on this plugin would be appreciated.

jlchereau commented 6 years ago

@andersborgabiro, please read https://github.com/vilic/cordova-plugin-tts/issues/62#issuecomment-371747202 for the answer to your question.

andersborgabiro commented 6 years ago

It's not a solution, at least not for me: If I at all set rate it will sometimes speed up to maximum rate. It's hilarious to listen to, but not very practical :).

jlchereau commented 6 years ago

rate: RX_IOS.test(window.navigator.userAgent) && !window.MSStream ? 0.7 : 2 means 0.7 for iOS and 2 for Android with #b25e7ac which is much more reliable than v0.2.3 AFAIK.

andersborgabiro commented 6 years ago

Update: If I never set custom values, but only 0.7 or 2, it works. I will simply not allow custom rates from now on.

Thanks!

jlchereau commented 6 years ago

Feel free to use https://github.com/kidoju/Kidoju-Mobile/blob/master/js/app.tts.js if it helps.

andersborgabiro commented 6 years ago

Thanks. That might come in handy.

I have my own queue system for TTS, to avoid over-runs. I figure that's part of this code too.

macdonst commented 6 years ago

On iOS you don't even need a plugin. The speech synthesis part of the W3C API is implemented in the web view.

andersborgabiro commented 6 years ago

I tend to make applications platform-independent, but the difference in this case could of course be abstracted.

macdonst commented 6 years ago

@andersborgabiro yeah, that is why my plugin follows the w3c api. So the same API works on Android and iOS even though you don't actually "need" the plugin on iOS.

mgkaradag commented 6 years ago

@macdonst Hey Simon, What do you mean by "you don't need a plugin on iOS"? Can you pls elaborate how to implement TTS on iOS without a Cordova plugin (not mentioning about Obj. C or Swift, of course) ?

jlchereau commented 6 years ago

Use the Web Speech API: https://developer.mozilla.org/en-US/docs/Web/API/Web_Speech_API. @macdonst might correct me if I am wrong but it works with iOS 10 and iOS 11, but not with prior versions. See https://caniuse.com/#feat=speech-synthesis.

macdonst commented 6 years ago

@mgkaradag what @jlchereau is correct. On iOS 10 and greater you can just use the Web Speech API as it is already in the web view. This way you are delivering less code to your user and you have a smaller app footprint.

jlchereau commented 6 years ago

My experience with migrating from this plugin to SpeechSynthesisPlugin at https://github.com/macdonst/SpeechSynthesisPlugin/issues/18. I have updated https://github.com/kidoju/Kidoju-Mobile/blob/master/js/app.tts.js to be compatible with both plugins.