Hello Friends,
So recently I worked on this small project that is supposed to incorporate text to speech feature provided by Cordova Plugin in an Ionic project.
There are lot of plugins out there but after trying many of them; this is what worked for me.
Step 1) Install the following Cordova Plugin i.e.
cordova plugin add org.apache.cordova.plugin.tts
Step 2) Next write the following code snippet to make use of the plugin to speak the text
Write the above code snippet in the onClick function of the speak button of your application.
So recently I worked on this small project that is supposed to incorporate text to speech feature provided by Cordova Plugin in an Ionic project.
There are lot of plugins out there but after trying many of them; this is what worked for me.
Step 1) Install the following Cordova Plugin i.e.
cordova plugin add org.apache.cordova.plugin.tts
Step 2) Next write the following code snippet to make use of the plugin to speak the text
var textToSpeech = new SpeechSynthesisUtterance('hello There');
textToSpeech.lang = 'en-US';
textToSpeech.rate = '0.7';
speechSynthesis.speak(textToSpeech);
That's it. Enjoy the way how your application now communicates with you :-)
Thanks to the following discussion at Ionic Forum i.e.
https://forum.ionicframework.com/t/problems-with-text-to-speech/31927