Delay in Text to Speech Plugin for Android


#1

I’m trying to include a text to speech feature in my timer app. I used the following plugin:

cordova plugin add org.apache.cordova.plugin.tts

I am using Samsung Galaxy S3 Android Version 4.4.2. Ionic version : 1.3.2

First time when i call

TTS.speak({
text: "Hello World, This is me Blah Blah."
locale: ‘en-GB’,
rate: 1.5
}, function () {
}, function (reason) {
});

There is a 5 to 6 seconds delay for the device to speak, How can we avoid this delay ?
I am planning to use TTS inside a timer and i am concerned if the delay will mess things up.

Thanks !


#2

I don’t know the details of the TTS plugin, but if your timer doesn’t have too many unique instructions it needs to speak, you could pre-record each set of instructions and then play the mp3 file using the media player.

If you don’t want to record the instructions with your voice, you could use the say.js library, just pass the string to it, it returns a .mp3 for android and .wav for ios (for notifications). Only downside is that you then need to bundle all these mp3’s in your app which increases its download size.


#3

Thank you for your reply, Once i removed the configurations,the delay was gone.
I mean i removed the locale: ‘en-GB’ and rate: 1.5, and call the function with just
TTS.speak({
text: “Hello World !”,
}, function () {
}, function (reason) {
});

The delay is gone,not sure the reason behind this.