Skip to content

Instantly share code, notes, and snippets.

@haruiz
Created March 27, 2017 07:34
Embed
What would you like to do?
var exec = require('child_process').exec;
var util = require("util");
var talk = (message, lang) =>{
lang = lang === "es" ? (' -l es-ES ') : (' -l en-US ');
const cmd = util.format("pico2wave -w speak.wav %s '%s' && sox speak.wav -r 48k speak.mp3 pitch -200 && omxplayer speak.mp3", lang, message)
console.log(cmd);
exec(cmd, function(error, stdout, stderr) {
if(error)
console.error(error);
});
}
module.exports = { talk : talk }//export the talk functions to Robot.js file, This will allow him to speak
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment