Skip to content

Instantly share code, notes, and snippets.

@haruiz
Created March 27, 2017 07:34
Show Gist options
  • Save haruiz/4262c380bf3a946c67a843ecd5f73d48 to your computer and use it in GitHub Desktop.
Save haruiz/4262c380bf3a946c67a843ecd5f73d48 to your computer and use it in GitHub Desktop.
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