Adding IPA output to emscripten js library and demo

This commit is contained in:
Ben
2017-07-28 17:06:55 +02:00
parent 22270bd259
commit c98ed977f2
6 changed files with 90 additions and 5 deletions
+27 -3
View File
@@ -179,10 +179,12 @@ function speak() {
pusher.connect(ctx.destination);
console.log(' Creating pusher... done');
var user_text = document.getElementById('texttospeak').value;
// actual synthesis
console.log(' Calling synthesize...');
tts.synthesize(
document.getElementById('texttospeak').value,
user_text,
function cb(samples, events) {
//console.log(' Inside synt cb');
if (!samples) {
@@ -203,11 +205,32 @@ function speak() {
//console.log(' Leaving synt cb');
} // end of function cb
); // end of tts.synthesize()
console.log(' Calling synthesize... done');
console.log(' Calling synthesize... done');
console.log('Leaving speak()');
} // end of speak()
function ipa() {
console.log("Synthesizing ipa ... ");
var ts = new Date();
var user_text = document.getElementById('texttospeak').value;
//user_text = user_text.repeat(50);
tts.set_voice(document.getElementById('voice').value);
tts.synthesize_ipa(user_text, function(result) {
var te = new Date();
document.getElementById('ipaarea').value = result.ipa;
console.log("Ipa synthesis done in " + (te-ts) + " ms.")
});
}
function speakAndIpa() {
speak();
ipa();
}
function resetPitch() {
document.getElementById('pitch').value = 50;
}
@@ -254,5 +277,6 @@ function initializeDemo() {
console.log('Leaving cb1');
} // end of function cb1
);
console.log('Creating eSpeakNG instance... done');
}
+2 -1
View File
@@ -63,7 +63,8 @@ for (var method of [
'set_rate',
'set_pitch',
'set_voice',
'synthesize'
'synthesize',
'synthesize_ipa'
]) {
eSpeakNG.prototype[method] = _createAsyncMethod(method);
}