Open jlchereau opened 6 years ago
Same thing with me, any fixes?
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 ...
@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
I have the same issue, and I waiting for the update. Please @vilic
1.5 works on iOS, but sometimes it speaks with a very high speed, despite the same setting every time.
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.
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?
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.
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.
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.
@andersborgabiro, please read https://github.com/vilic/cordova-plugin-tts/issues/62#issuecomment-371747202 for the answer to your question.
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 :).
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.
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!
Feel free to use https://github.com/kidoju/Kidoju-Mobile/blob/master/js/app.tts.js if it helps.
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.
On iOS you don't even need a plugin. The speech synthesis part of the W3C API is implemented in the web view.
I tend to make applications platform-independent, but the difference in this case could of course be abstracted.
@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.
@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) ?
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.
@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.
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.
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.