mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-24 20:31:15 +00:00
Adding IPA output to emscripten js library and demo
This commit is contained in:
+27
-3
@@ -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');
|
||||
}
|
||||
|
||||
@@ -63,7 +63,8 @@ for (var method of [
|
||||
'set_rate',
|
||||
'set_pitch',
|
||||
'set_voice',
|
||||
'synthesize'
|
||||
'synthesize',
|
||||
'synthesize_ipa'
|
||||
]) {
|
||||
eSpeakNG.prototype[method] = _createAsyncMethod(method);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user