This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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