Program to record speech audio into RAM and then play it back, moving Billy Bass's mouth in sync with the speech.

Dependencies:   mbed

Remember Big Mouth Billy Bass?

I've made a simple demo program for him using the Freescale FRDM-KL25Z board. I've hooked up the digital I/O to his motor driver transistors and pushbutton switch.

This program records 1.8 seconds of speech audio from ADC input when the pushbutton is pressed, then plays the audio back with Billy Bass's mouth controlled so that it opens during vowel sounds.

The ADC input is driven from a microphone and preamplifier, via a capacitor and into a resistor divider connected to the +3.3V supply pin to provide mid-range biasing for the ADC signals.

The DAC output is connected to his audio amplifier input (to the trace that was connected to pin 10 of the controller IC). I had to provide a DC bias using the DAC to get the single transistor amplifier biased into proper operation.

For more on the method of vowel recognition, please see the paper: http://www.mirlab.org/conference_papers/International_Conference/ICASSP%201999/PDF/AUTHOR/IC991957.PDF

Y. Nishida, Y. Nakadai, Y. Suzuki, T. Sakurai, T. Kurokawa, and H. Sato. 1999.

Voice recognition focusing on vowel strings on a fixed-point 20-MIPS DSP board.

In Proceedings of the Acoustics, Speech, and Signal Processing, 1999. on 1999 IEEE International Conference - Volume 01 (ICASSP '99), Vol. 1. IEEE Computer Society, Washington, DC, USA, 137-140. DOI=10.1109/ICASSP.1999.758081 http://dx.doi.org/10.1109/ICASSP.1999.758081

Committer:
bikeNomad
Date:
Wed May 15 15:32:34 2013 +0000
Revision:
3:c04d8d0493f4
Child:
4:c989412b91ea
Got audio sampling and analysis working

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bikeNomad 3:c04d8d0493f4 1 #ifndef __included_audio_analyzer_h
bikeNomad 3:c04d8d0493f4 2 #define __included_audio_analyzer_h
bikeNomad 3:c04d8d0493f4 3
bikeNomad 3:c04d8d0493f4 4 namespace NK
bikeNomad 3:c04d8d0493f4 5 {
bikeNomad 3:c04d8d0493f4 6
bikeNomad 3:c04d8d0493f4 7 class AudioAnalyzer
bikeNomad 3:c04d8d0493f4 8 {
bikeNomad 3:c04d8d0493f4 9 protected:
bikeNomad 3:c04d8d0493f4 10 int8_t const *samples;
bikeNomad 3:c04d8d0493f4 11 uint16_t nsamples;
bikeNomad 3:c04d8d0493f4 12 uint16_t zeroCrossings;
bikeNomad 3:c04d8d0493f4 13 uint32_t power;
bikeNomad 3:c04d8d0493f4 14 int8_t minValue;
bikeNomad 3:c04d8d0493f4 15 int8_t maxValue;
bikeNomad 3:c04d8d0493f4 16 bool analyzed;
bikeNomad 3:c04d8d0493f4 17
bikeNomad 3:c04d8d0493f4 18 void analyze();
bikeNomad 3:c04d8d0493f4 19
bikeNomad 3:c04d8d0493f4 20 public:
bikeNomad 3:c04d8d0493f4 21 AudioAnalyzer(int8_t const *_samples, uint16_t _nsamples)
bikeNomad 3:c04d8d0493f4 22 : samples(_samples), nsamples(_nsamples), zeroCrossings(0), power(0), analyzed(false) {
bikeNomad 3:c04d8d0493f4 23 }
bikeNomad 3:c04d8d0493f4 24
bikeNomad 3:c04d8d0493f4 25 uint16_t getZeroCrossings() {
bikeNomad 3:c04d8d0493f4 26 if (!analyzed) analyze();
bikeNomad 3:c04d8d0493f4 27 return zeroCrossings;
bikeNomad 3:c04d8d0493f4 28 }
bikeNomad 3:c04d8d0493f4 29
bikeNomad 3:c04d8d0493f4 30 uint32_t getPower() {
bikeNomad 3:c04d8d0493f4 31 if (!analyzed) analyze();
bikeNomad 3:c04d8d0493f4 32 return power;
bikeNomad 3:c04d8d0493f4 33 }
bikeNomad 3:c04d8d0493f4 34
bikeNomad 3:c04d8d0493f4 35 void getMinMaxValues(int8_t *min, int8_t *max) {
bikeNomad 3:c04d8d0493f4 36 if (!analyzed) analyze();
bikeNomad 3:c04d8d0493f4 37 *min = minValue;
bikeNomad 3:c04d8d0493f4 38 *max = maxValue;
bikeNomad 3:c04d8d0493f4 39 }
bikeNomad 3:c04d8d0493f4 40 };
bikeNomad 3:c04d8d0493f4 41
bikeNomad 3:c04d8d0493f4 42 } // namespace NK
bikeNomad 3:c04d8d0493f4 43 #endif