You Are Here: Home » AVR ATmega Projects » Sound - Audio Projects » Guitar Blocks Using Atmega644

Guitar Blocks Using Atmega644




Introduction

We present to you, the ultimate guitar — no strings attached (literally)! This guitar features an infrared strumming system and a fret board with physical buttons. It sounds like a real acoustic guitar and it works like a real acoustic guitar, but in the world of Guitar Blocks, it is your ultimate weapon in a game of Tetris.

Guitar Blocks Using Atmega644

Our final project teaches the user how to play a real acoustic guitar using our very own simulated guitar, two ATmega644 microcontrollers, a set of speakers, and a game of Tetris displayed on a television. Our simulated guitar is smaller (and has more silicon) than a full-size acoustic guitar, but is identical in terms of fingering. Our project, Guitar Blocks, features the simulated guitar as the game controller in a classic game of tetris. To move the falling block, the user must play specific chords. As the user advances in the game, the falling block speed increases and the chords used to move the falling block change. Users compete for the highest score by mastering all 15 basic chords.

High Level Design

Design Rationale

With the advent of Guitar Hero, Rock Band, and other similar games for various gaming platforms, we’ve learned how to party like a rockstar, rock-till-dawn like a rockstar, and perhaps even dress like a rockstar. But when presented with a real guitar, we can’t seem to find the five color-coded buttons. Our final project is similar to these simulation games in that we utilise a simulated guitar, but our guitar features the same fingering and sound as a real acoustic guitar so that when presented with a real guitar, the user is able to play a few chords.

Logical Structure

Our system uses two ATmega644 microcontrollers: Master MCU and Slave MCU. The Master MCU handles the guitar input and produces guitar-like sound with the Karplus-Strong Algorithm. The Slave MCU handles the Tetris game and video output. The two MCUs are connected by a unidirectional serial port interface (SPI). The Master MCU sends three 8-bit packets (representing the value for each of the 6 guitar “strings”) to the Slave MCU. The overall system structure is shown below.

Mathematical Theory

Synthesizing guitar sound with Karplus Strong Algorithm

Plucked-String Algorithm: In the Karplus-Strong algorithm, the pluck, which in real string can contain energy at any frequency, is simulated by filling the delay-line with noise at each note beginning. Originally, Karplus and Strong used two-level randomness with probability of 1/2 for -A and A, where A represents the maximum desired amplitude. This is more economic than using uniform randomness between -A and A with the only difference that the signal is 5 dB louder. On today computers, generation of random numbers is not an issue and therefore uniform randomness can be use without any speed consequence. In a real string, vibration eliminates those frequencies introduce by the pluck that don’t match the normal modes of the string. Friction and losses at end point will create the sound decay, with higher frequencies decaying faster than lower ones. At the end, the wave shape will almost be sinusoidal with a period corresponding to the fundamental mode of the string. The sound will finally decay to silence. In the Karplus-Strong model this can be achieve by the introduction of an averager in the loop.

Alex Strong devised his averager by simply adding the two last outputs and right shifting the result (divide by 2). The result sample is then re-introduced in the loop. This and the length of the loop will cause self-cancellation of the “non-harmonic” partials. This will also cause higher frequencies to decay more and more at each delay-line trip, until only the fundamental remain. Like in the case of a real string, the delay-line content will finally decay to a constant value, which sounds like silence.

 

Design Standards

NTSC: The standard for video signals in North America is the NTSC format, which has a framerate of 29.97 interlaced frames per second, where each frame consists of 525 lines. Guitar Blocks uses the video generation code from lab #3, which differs from the NTSC stanard in that the signal produced is not interlaced. Instead, a full half-frame is produced.

A440: The standard for an “A” pitch is 440Hz. Guitar Blocks adheres to this standard, producing in-tune guitar sounds using the Karplus Strong Algorithm.

Guitar: Our guitar adheres to the standard order of guitar strings and fingerings, such that the fingering positions on our simulated guitar are identical to those of a real acoustic guitar. This implementation is necessary because the purpose of the game is to teach the user the chords on a real guitar.

Tetris Blocks: Guitar Blocks uses standard tetrominoes from the Tetris game by Nintendo. These are the 7 combinations of 4-block arrangements. Color-coding is irrelevant in our case because our video signal is only black/white.

Serial Port Interface (SPI): Standard communication protocol between devices. It was easily implmented on the ATmega644 and performed well. Other options included I2C, but would be much more complicated.

Guitar Blocks Using Atmega644 block game

Trademarks and Patents

Tetris: Trademark owned by The Tetris Company. Although our implementation of a tetris-like game does not include the word “Tetris” anywhere in our gameplay, The Tetris Company is known for sending cease-and-desist letters to developers of tetris-like clones. Although The Tetris Company has only filed one lawsuit in its history, we will play it safe. Whatever happens in ECE, stays in ECE.

Guitar Hero and Band Hero are trademarks of Activision and Elecronic Arts, respectively.

Parts List:

Appendix C: Parts & Costs

MaterialCost
ATmega644 Chip$8
Protoboard$4
MAX233$7
STK500$25
Pushbuttons ($0.25 x 30)$7.50
Soldering Board (2 x $2 + 1 x $1)$5
IR receivers & transmitters$0
Total$56.50

 

For more detail: Guitar Blocks Using Atmega644

Leave a Comment

You must be logged in to post a comment.

Read previous post:
Haptic Exercise Coach Using Atmega644

Introduction The goal of this project was to assist the user in learning the proper technique for a physical exercise,...

Close
Scroll to top