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:
Tue May 14 14:08:22 2013 +0000
Revision:
1:2fa375aacece
Child:
2:5bcd2f55a294
trying to get continuous conversion going

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bikeNomad 1:2fa375aacece 1 #ifndef __included_fast_analog_in_h
bikeNomad 1:2fa375aacece 2 #define __included_fast_analog_in_h
bikeNomad 1:2fa375aacece 3
bikeNomad 1:2fa375aacece 4 #include "mbed.h"
bikeNomad 1:2fa375aacece 5
bikeNomad 1:2fa375aacece 6 namespace NK
bikeNomad 1:2fa375aacece 7 {
bikeNomad 1:2fa375aacece 8
bikeNomad 1:2fa375aacece 9 using namespace mbed;
bikeNomad 1:2fa375aacece 10
bikeNomad 1:2fa375aacece 11 class FastAnalogIn: public mbed::AnalogIn
bikeNomad 1:2fa375aacece 12 {
bikeNomad 1:2fa375aacece 13 public:
bikeNomad 1:2fa375aacece 14 void start_read() {
bikeNomad 1:2fa375aacece 15 ADC0->SC1[0] = ADC_SC1_ADCH(_adc.adc); // start conversion
bikeNomad 1:2fa375aacece 16 }
bikeNomad 1:2fa375aacece 17
bikeNomad 1:2fa375aacece 18 uint16_t read_u16() {
bikeNomad 1:2fa375aacece 19 // Wait Conversion Complete
bikeNomad 1:2fa375aacece 20 while ((ADC0->SC1[0] & ADC_SC1_COCO_MASK) != ADC_SC1_COCO_MASK);
bikeNomad 1:2fa375aacece 21
bikeNomad 1:2fa375aacece 22 // Return value
bikeNomad 1:2fa375aacece 23 return (uint16_t)ADC0->R[0];
bikeNomad 1:2fa375aacece 24 }
bikeNomad 1:2fa375aacece 25
bikeNomad 1:2fa375aacece 26 FastAnalogIn(PinName what)
bikeNomad 1:2fa375aacece 27 : mbed::AnalogIn(what) {
bikeNomad 1:2fa375aacece 28 ADC0->CFG2 = /* ADC_CFG2_MUXSEL_MASK // ADxxb channels are selected */
bikeNomad 1:2fa375aacece 29 0 | ADC_CFG2_ADACKEN_MASK // Asynchronous Clock Output Enable
bikeNomad 1:2fa375aacece 30 | ADC_CFG2_ADHSC_MASK // High-Speed Configuration
bikeNomad 1:2fa375aacece 31 | ADC_CFG2_ADLSTS(0); // Long Sample Time Select = 24 clocks
bikeNomad 1:2fa375aacece 32
bikeNomad 1:2fa375aacece 33 // set up for averaging 16 samples at 125KHz sample rate => 7812.5 samples/sec
bikeNomad 1:2fa375aacece 34 ADC0->SC3 = ADC_SC3_AVGE_MASK // Hardware Average Enable
bikeNomad 1:2fa375aacece 35 | ADC_SC3_AVGS(2) // 16 Samples Averaged
bikeNomad 1:2fa375aacece 36 | ADC_SC3_ADCO_MASK; // contin conversion
bikeNomad 1:2fa375aacece 37 }
bikeNomad 1:2fa375aacece 38
bikeNomad 1:2fa375aacece 39 void enable_interrupt() {
bikeNomad 1:2fa375aacece 40 ADC0->SC1[0] |= ADC_SC1_AIEN_MASK; // enable interrupt
bikeNomad 1:2fa375aacece 41 ADC0->SC1[1] |= ADC_SC1_AIEN_MASK; // enable interrupt
bikeNomad 1:2fa375aacece 42 }
bikeNomad 1:2fa375aacece 43 void disable_interrupt() {
bikeNomad 1:2fa375aacece 44 ADC0->SC1[0] &= ~ADC_SC1_AIEN_MASK; // disable interrupt
bikeNomad 1:2fa375aacece 45 ADC0->SC1[1] &= ~ADC_SC1_AIEN_MASK; // disable interrupt
bikeNomad 1:2fa375aacece 46 }
bikeNomad 1:2fa375aacece 47
bikeNomad 1:2fa375aacece 48 };
bikeNomad 1:2fa375aacece 49
bikeNomad 1:2fa375aacece 50 }
bikeNomad 1:2fa375aacece 51
bikeNomad 1:2fa375aacece 52 #endif