An AngularJS service to speak the text via the OpenFPT TTS (text-to-speech) API.
# from the terminal at the root of your project
bower install openfpt-ng-tts --save
Or you can install by this repo (not recommended)
# from the terminal at the root of your project
bower install fpt-corp/angular-tts --save
angular.module('xxx', ['fpt.angular-tts']);
Go to Open FPT API Developer Portal to get your API Key
<audio id="openfpt-tts"> </audio>
Add openfptTts as injection to use in angular controller
angular.module('myApp').controller('HomeCtrl', ['$scope', 'openfptTts', function ($scope, openfptTts) {
// Your code goes here
}];
openfptTts.apiKey = 'YOUR_API_GOES_HERE';
openfptTts.elementId = 'openfpt-tts'; //default is 'openfpt-tts'
openfptTts.voice = 'both'; //default is 'both'
openfptTts.speed = 0; //default is 0
voice
option can bemale | female | both
. When voice is set toboth
, the engine will speak with male voice and female voice sequentially.speed
option can be:-3
: extreme slow-2
: very slow-1
: slow0
: normal (default)1
: fast2
: very fast3
: extreme fast
- text
string
: Text you want to speak. - cb
nodejs callback
cb(err)
- textArray
array[string]
: Text you want to speak. - cb
nodejs callback
cb(err)