Guitar legend maker Using Atmega32


The name of our final project is “Legend Maker, Train to Be a Guitar Legend”. Legend Maker is a game that is a cross between Guitar Hero (rhythm) and Karaoke Revolution (tone detection) as it tests the user’s ability to play a real guitar (or any electric string instrument).
Guitar legend maker Using Atmega32
The user can choose from a list of songs from the hyperterm and test how well he/she can play them. When the user selects a song, a sequence of three events occurs:
1) The main melody of the song is outputted through the speakers and the notes are outputted on the hyperterm. This lets the player know what the melody sounds like.
2)After that the melody is played, the notes are output on the hyperterm and the user must play along with the notes. If the user plays a note correct, “count it” is displayed to the hyperterm. Else, either “low” or “high” is displayed, dependent upon whether or not the note played was higher or lower in frequency than the desired note. The object of this is to let the user know how well he/she is playing the melody. “no note played” is outputted when the user does not play anything or play too soft.
3) If the user gets number of notes correct more than number of notes worng, then the user is deemed worthy of not needing the filters and playing along with the background bass notes. Hence the user will have an option of playing the riff again but this time with background music. Else, the user is told to keep practicing. The object of this is to give a reward in the game for performing well.
This is a basic summary of Legend Maker. We have also added another function to the program since it would be unfair to expect a beginner to be able to play riffs at full speed right away. Hence there is an option called “slow mode” which gives a whole second between each note when asking the user to play a riff. Hence giving the user some time to position his/her fingers around the instrument before the next note is called.

High level design

Rationale and Source of project idea
There are a few key reasons why we choose this project. One of them being that almost all people enjoys music; hence we feel that a lot of people would enjoy a game that involves music. Also, there are a lot of video games that test how well one can play rhythm, and a lot of tone recognition software, but there doesn’t seem to be any commercial device that combines the two. Hence we feel this project is original. Moreover, a lot of people try to learn guitar but become bored of it and give up, this game will give people the motivation to keep practicing as they see their scores become better and better. Finally, we want people to have fun, and playing Legend Maker is a safe enjoyable source of recreation while enabling someone to better themselves, in terms of musical skills.
Background Math
The two most important parts of the project, the filtering and sound output, involve math.
For the filtering part, we choose to use 2nd order IIR (Infinite Impulse Response) filters, in particular Butterworth Filters, for the filtering necessary for the game. IIR filters are better for our design than FIR (Finite Impulse Response) filters because they have a much sharper frequency response with fewer coefficients. IIR filters alter the phase of the input signal, but for this design we are not concerned with phase, but only the magnitude of the output signal. The figures below shows the basic block diagram of IIR and FIR filters.
The input signal is sampled at varying times (though each time interval is equal), corresponding to each square. Each square also has a coefficient, A1, A2, A3, etc., that is the coefficient multiplied with each sample. The output of this particular filter is: Y(n)=B1*X(n) + B2*X(n-1) + B3*X(n-2) + B4*X(n-3).
This figure shows the basics of an IIR filter. It is similar to an FIR filter except that previous outputs are “fed back” into the summation. The output of this particular filter is Y(n)=B1*X(n) + B2*X(n-1) + A1*Y(n-1) + A2*Y(n-2)
Different types of IIR filters have different frequency responses. For example, an Elliptic filter has a very sharp cutoff region but has large ripples in the passband region, while a Butterworth filter has no ripple but not as sharp a cutoff. After running the simulations in Matlab, using the GUI “fdatool,” we came to the conclusion that Butterworth filters give the best frequency responses for passing an instrument note. For example, a Chebyshev Type 2 filter will pass very little of an undesired notes frequency, but if your string is only slightly out of tune, then it may be blocked as well. Hence we decided that Butterworth filters gave the best trade off between blocking other notes and passing enough signal of the desired note.
There is also math involved with sound output. We use a method called Direct Digital Synthesis (DDS) in synthesizing the sound. The main formula being: increment = 68719*frequency, when the microcontroller is in fast PWM mode and we are setting OCR0=128 + sineTable[highbite]. Where sineTable is a length 256 array representing a sine wave. highbite is the upper bite of a variable called accumulator, and accumulator is a 4 byte variable that equals accumulator + increment. This leads us to derive that increment equals 2^32(# of bits in accumulator)*256(value of “Top Register” in fast PWM mode)*(1/clock_speed)*output frequency. We used a 16 MHz clock and hence calculate that increment = 68719*frequency. This is how we calculate the PWM output signal that corresponds to a particular frequency.
Logical Structure
Logical Structure Guitar legend maker Using Atmega32
Hardware/Software Tradeoffs
Choosing a Filter
As we mentioned in the Background Math part, different types of IIR filters have different frequency responses, but we chose to use the Butterworth IIR filter because it passes enough signal for the desired notes while blocking other notes that is suitable for filtering guitars or other string musical instruments.

Parts List:

For more detail: Guitar legend maker Using Atmega32

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top