Skip to content

Instantly share code, notes, and snippets.

@haruiz

haruiz/Robot.js Secret

Last active March 27, 2017 08:05
  • 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
Save haruiz/a4e714a4545523b025a20da725eecd9f to your computer and use it in GitHub Desktop.
const tts = require("./tts");//Text to Speech
const stt = require("./stt");//Speech to Text
class Robot{
constructor(name, config){
this.name = name;
this.config = config;
}
//just the phrase that you want the robot repeat for you
textToSpeech(phrase){
tts.talk("Hi all from raspberry pi");
}
//.wav file as binary, it comming from web interface
//we could be more strict and put all the code inside a try/ catch block, we are just
//assuming that everything'll be perfect :), is just a robot
async speechToText(audioAsBinary){
var response = await stt(this.config.BING_SPEECH_API_KEY, audioAsBinary); return response.data.results;
}
}
module.exports = Robot; //we are exporting the class Robot, to be used at the index file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment