Code
2.2 — Physical Computing
Well, in this post I want to tell how I made my “voodoo” doll talk.
As I said earlier, I am using a javascript version of ELIZA bot as the engine. But, first of all, I want to make it able to communicate via voice. So I have to attach voice recognition and text-to-speech functionality.
I have started with speech synthesis, so ELIZA could talk:
Introduction to the Speech Synthesis API
Basically, it is all about these few lines of code:
See the Pen NgdPrr by Roman Trilo (@romantrilo) on CodePen.
Next step was to add voice recognition:
Voice Driven Web Apps: Introduction to the Web Speech API
Then I had to connect Arduino and ELIZA software.
I have installed Firmata Standard Plus code on the Arduino Leonardo. Then, using Johnny 5 javascript framework, I was able to get data from the MPR121 board using javascript:
See the Pen XgpJXZ by Roman Trilo (@romantrilo) on CodePen.
So I had a talking ELIZA and a code which could read the Arduino signals; I had to connect them via API. I have done that using PubNub:
See the Pen YQNPNb by Roman Trilo (@romantrilo) on CodePen.