The goal of this project is to design an algorithm for a real-time digital guitar tuner and implement it using an Atmel AT90S8535 microcontroller. Each of the six strings of a guitar has a unique fundamental frequency, and our goal is to measure this frequency and compare it to the correct frequency. This project combines digital filter design, analog amplifier design, and several data analysis techniques.
High level design
The microcontroller accepts push button inputs which allow the user to select which guitar string is being tuned. It then samples the input waveform at 3000 Hz using the 8535’s on-board ADC. Each time a waveform sample is obtained, the following FIR (finite impulse response) filter algorithm is performed:
where P = 21, xn are the most recent 21 samples and ci are predetermined filter coefficients which are loaded from a lookup table for each string. This filter set to be a bandpass filter centered at the fundamental frequency of the selected guitar string, and it is used to remove unwanted harmonics and other noise from the sampled waveform. Note that we are limited to a 20-tap filter (P = 21) because all operations must be completed within one sample period (.333 mS) in order for the tuner to be true real-time. Generally speaking, the larger P is, the better the filter is.
After each filter output has been calculated, it is examined to see if it is a rising-edge zero-crossing. The number of sample periods between rising-edge zero-crossings is recorded and averaged, and the result is the fundamental period of the guitar tone. This fundamental period is compared to a series of threshold levels, and a single LED is illuminated to indicate the sharpness or flatness of the tone. The threshold levels (from LED0 – LED7 on the evaluation board) are fundamental +15%, +10%, +4%, +1%, -1%, -4%, -10%, and -15%. If the measured period falls within +1% and -1%, the two middle LEDs are illuminated (LED3 and LED4).
For more detail: EE476 Final Project: Design of a Real-Time Digital Guitar Tuner