Vous êtes sur la page 1sur 7

vsdev

Home Projects About Me

Table of Contents

Audio Echo Effect o Video o Description o Possible Improvements o Schematic o LTspice Simulation o mbed Code o Pictures o Comments

Audio Echo Effect


Video
Here is a video of my friend James playing his electric guitar, patched through the audio echo effect system, and then to his amp. I didn't make any effort to prove that this isn't a conspiracy, so you'll have to take my word that the echo effect is actually happening on the breadboard and not some hidden pedal or options on his amp. While I'm at it, I apologize for the camera phone video quality.

Description
This project is an audio echo/delay effect pedal of a sort, though I did most of the testing with a regular electret microphone and ear buds or external speakers. The circuitry of the pedal is fairly straight forward: the microphone/input is AC coupled, then amplified around a VDD/2 bias (I'm running on a single supply) across two stages, one of which is adjustable, then passed through a low pass filter at around 10-15KHz to clean out any high frequency in the input, and fed to a microcontroller for some processing. I used an mbed, which is a LPC1768 hardware platform plus all of that arduino pseudo-coding, because they're pretty neat and super quick to develop with, but any micro with an ADC and DAC will do. The output of the microcontroller's DAC is smoothed (LPF) out by a cap and fed to a final amplification stage, and then AC coupled to a speaker/output. Although I've labeled this particular project Audio Echo Effect, you can really do whatever you'd like on the mbed/micro for the processing, so I like to think about it as more of a general audio effect platform I can tinker with (though a DSP instead of a micro would

probably do better). The mbed and LM358s are the only ICs, the rest of the parts are passives and connectors. Substituting the mbed for a more economical microcontroller with an ADC, DAC (or even building an R2R DAC), and sufficient memory, this project can be built for under $15. There is a voltage divider potentiometer connected to an ADC of the mbed to adjust the amount of echo/delay. The actual delay effect is implemented by the following DT system:

The negative DELAY power of z corresponds to the delay variable and the G multiplier corresponds to the inv_gain variable in the mbed code. Although the mbed code does support adjusting the gain variable with a voltage divider potentiometer hooked up to p16, I found that the echo effect worked quite well with the gain fixed at 1/3. Below is the EAGLE schematic, LTspice schematic (for some frequency response simulation of the surrounding analog parts), mbed code, and pictures/video. See pictures and video sections for some eye candy. I think the mbed's blue led makes it look really hi-tech.

Possible Improvements

Better op-amps than the LM358 should be used. With the main low pass filter at around 11kHz cutoff, the sampling frequency should be around 22kHz. Since I'm essentially sampling as fast as possible in the mbed code, it's not clear what the exact sampling frequency is, but it's likely to be excessively high. Sampling explicitly at 22kHz should allow for a better use of sample memory as well as a longer echo effect. Each amplification stage could also incorporate a single-pole low-pass in the feedback loop, also at the Nyquist frequency. The two amplification stages could probably be collapsed into one. Better filter topology could be implemented instead of the Sallen-Key.

Schematic

Changing R4 to 10K helps for microphone applications, but input from a electric guitar pickup comes in pretty strong so I found 47K worked well when using an electric guitar. EAGLE schematic: http://www.frozeneskimo.com/schematics/echo_effect/echo-effect.sch

LTspice Simulation
I used LTspice for the frequency response simulation of some of the analog circuitry.

LTspice schematic: http://www.frozeneskimo.com/schematics/echo_effect/echo-effect.asc

mbed Code
? 1 #include "mbed.h" 2 15000 3 #define MAX_DELAY #define MIN_DELAY 50 4 5 #define MAX_GAIN 25 6 #define MIN_GAIN 2 7 8 /* ADC for the microphone/input, DAC for the speaker/output */ 9 AnalogIn mic(p19); 10AnalogOut speaker(p18); 11/* Two potentiometer voltage dividers for the delay/gain control knobs */ AnalogIn delay_knob(p15); 12AnalogIn gain_knob(p16); 13 14unsigned short buffer[MAX_DELAY]; 15 16/* inv_gain = 1 / gain; it's faster to avoid floating point during the main

17loop */ 18int inv_gain = 3; int delay = MAX_DELAY; 19 20void read_knobs(void) { 21 delay = delay_knob*MAX_DELAY; //gain = gain_knob*MAX_GAIN; 22 if (delay < MIN_DELAY) 23 delay = MIN_DELAY; 24 /*if (gain < MIN_GAIN) 25 gain = MIN_GAIN; 26 if (gain == MAX_GAIN) gain -= 1;*/ 27 } 28 29 int main() { 30 int i; 31 /* Fill up the sample buffer first */ for (i = 0; i < delay; i++) 32 buffer[i] += mic.read_u16(); 33 34 for (i = 0; ; ) { 35 /* Multiply old data by the gain, add new data */ 36 buffer[i] = buffer[i]/inv_gain + mic.read_u16(); 37 /* Write to speaker */ speaker.write_u16(buffer[i]); 38 /* Increment index and wrap around, effectively only using "delay" 39 length of the buffer */ 40 i = (i+1) % delay; 41 /* Occasionally read the knobs */ 42 if (i == 0) read_knobs(); 43 } 44 } 45 46 47 48 49 50 mbed program link: http://mbed.org/users/vsergeev/programs/echo_effect/5zrah/

Pictures
Some pictures of a breadboarded version of the system.

Comments
View the discussion thread. Back to top embedded_projects/audio_echo_effect.txt Last modified: 2011/08/11 01:20 by vsergeev Sitemap Login

Vous aimerez peut-être aussi