Skip to content

Instantly share code, notes, and snippets.

@haruiz
Created March 27, 2017 07:34
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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