You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the exec function returns instantly and continues to run espeak in the background, so that it's possible to call speak again. If speak is called multiple times, all the message appear on top of each other.
We fixed this once, HaddingtonDynamics/Dexter#72 (comment)
but the fix wasn't incorporated and the code in DDE has changed enough that it needed to be re-implemented. I know the code below is working on my robot using job engine version 3.5.2, and I /think/ this will not cause problems going forward.
var to_speak = []
function speak({speak_data = "hello", volume = 1.0, rate = 1.0, pitch = 1.0, lang = "en_US", voice = 0, callback = null} = {}$
if (arguments.length > 0 && speak_data != null) {
var speak_data = arguments[0] //, volume = 1.0, rate = 1.0, pitch = 1.0, lang = "en_US", voice = 0, callback = null
//out("speak_data:"+speak_data);
}
var text = stringify_for_speak(speak_data)
if(window.platform == "node"){
if (speak_data != null) { //new speech text
let speak_cmd = "espeak \"" + text + "\" -a "+ (volume*200) + " -p " + (pitch * 50) + " -s " + (rate * 37 + 130)
to_speak.push(speak_cmd)
//out("saylater:"+speak_cmd)
}
else { //finished speaking prior text
if (to_speak.length > 0) { //say what's on the stack, dump, and call again with null
//out("saying: "+to_speak[0])
exec(to_speak[0], function(){ to_speak.shift(); speak({speak_data:null}); })
}
else {
//out("done saying");
if (callback) callback();
}
}
if (to_speak.length == 1) { //last one
//out("lastword:"+to_speak[0])
exec(to_speak[0], function(){ to_speak.shift(); speak({speak_data:null}); })
}
}
else {
var msg = new SpeechSynthesisUtterance();
//.... same from here down.
The text was updated successfully, but these errors were encountered:
the exec function returns instantly and continues to run espeak in the background, so that it's possible to call speak again. If speak is called multiple times, all the message appear on top of each other.
We fixed this once,
HaddingtonDynamics/Dexter#72 (comment)
but the fix wasn't incorporated and the code in DDE has changed enough that it needed to be re-implemented. I know the code below is working on my robot using job engine version 3.5.2, and I /think/ this will not cause problems going forward.
The text was updated successfully, but these errors were encountered: