In my previous project, I showed how to control a few LEDs using an Arduino board and BitVoicer Server. In this project, I am going to make things a little more complicated. I am also going to synthesize speech using the Arduino DUE digital-to-analog converter (DAC). If you do not have an Arduino DUE, you can use other Arduino boards, but you will need an external DAC and some additional code to operate the DAC (the BVSSpeaker library will not help you with that).
In the video below, you can see that I also make the Arduino play a little song and blink the LEDs as if they were piano keys. Sorry for my piano skills, but that is the best I can do :) . The LEDs actually blink in the same sequence and timing as real C, D and E keys, so if you have a piano around you can follow the LEDs and play the same song. It is a jingle from an old retailer (Mappin) that does not even exist anymore.
The following procedures will be executed to transform voice commands into LED activity and synthesized speech:
- Audio waves will be captured and amplified by the Sparkfun Electret Breakout board;
- The amplified signal will be digitalized and buffered in the Arduino using its analog-to-digital converter (ADC);
- The audio samples will be streamed to BitVoicer Server using the Arduino serial port;
- BitVoicer Server will process the audio stream and recognize the speech it contains;
- The recognized speech will be mapped to predefined commands that will be sent back to the Arduino. If one of the commands consists in synthesizing speech, BitVoicer Server will prepare the audio stream and send it to the Arduino;
- The Arduino will identify the commands and perform the appropriate action. If an audio stream is received, it will be queued into the BVSSpeaker class and played using the DUE DAC and DMA.
- The SparkFun Mono Audio Amp will amplify the DAC signal so it can drive an 8 Ohm speaker.