function say(msg, callback) { console.log('発話: ' + msg); document.getElementById('caption').textContent = msg; annyang.abort(); console.log('録音停止'); function voiceErrorCallback() { console.log("発話エラー"); annyang.start(); console.log('録音再開'); } function voiceEndCallback() { console.log('Resume annyang'); } responsiveVoice.speak(msg, 'Japanese Female'); annyang.start(); console.log('録音再開'); };
// file is included here: eval(fs.readFileSync('voice.js')+''); // Turn on debug messages annyang.debug(); annyanf.setLanguage("fr-FR"); // Define sample command var commands = { '*input': analyze }; // Add our commands to annyang annyang.addCommands(commands); // Start listening. You can call this here, or attach this call to an event, button, etc. annyang.start(); function talk(output){ annyang.pause(); responsiveVoice.speak(output); annyang.resume(); } function analyze(input){ switch(input){ case "hello": talk("hi"); break; default: talk("i didn't understand"); }
onend: function() { annyang.start(); console.log('録音再開'); document.getElementById('recording').textContent = '録音再開'; }
function voiceErrorCallback() { console.log("発話エラー"); annyang.start(); console.log('録音再開'); }