AirJam: wearable air guitar Using Atmega2

Introduction

Why a working, wearable air guitar? Bottom line, it’s just that cool. Who doesn’t want a machine that will take their jamming and turn it into rock they can hear? With just a glove, a pick and a little practice you can rock the synthetic acoustic guitar like no one else in the world.

wearable air guitar Using Atmega2

High Level Design

While perhaps not the first people to have the idea of a air guitar to actually play the instrument, we were inspired more by the hardware available than any other incarnation of a working air guitar. It looks something like this:

There are three basic functional components of Air Jam: the glove, the accelerometer and the software, which implements the Karplus-Strong algorythim. Karplus-Strong uses a burst of white noise (generated in this case by the repeated use of the stdlib rand() function) that is repeatedly filtered and played back. The frequency of the delay controls the frequency of the plucked string with a simple formula:

Delay Length L = Fsample/Fout

Nothing fancy about it.

Let us take a moment to consider whose toes Air Jam steps on. The Australian research company CSIRO have created a Wearable Instrument Shirt (WIS) that tracks arm position and uses it to calculated notes actually fretted. These i-Textiles are significantly more sophisticated technology than the simple flex sensors used in Air Jam’s glove, not to mention the fact that CSIRO synthesizes an electric guitar, not an acoustic one.

Hardware Design

Speaking of flex sensors, how does Air Jam work? Each finger of the glove has sewn directly to it a flex sensor that is in fact a variable resistor. Wires run from the glove to our circuit board, where in sits the rest of the circuit

a voltage divider and an analog comparator implemented by an op-amp with the inverting input tied to a 3.33 V line. The voltage divider between the flex-variable resistance and R would bring the non-inverting line above 3.33 V when a digit is extended, and below that value when it is flexed. During such a flex, the sensors resistance grows from ~71 kΩ to ~310 kΩ, and via experimentation we determined the value of R that gave the best triggering from 0 V to 5 V was 400 kΩ for the pinky, ring, middle and index fingers, and 300 kΩ for the thumb, because it flexed it’s sensor less than the other digits. The op-amp is a Linear Technology 1490, chose primarily because it was rail to rail.

The accelerometer is one of the ones generously donated by Freescale, whose output is an analoug value from 0 V to it’s 3 V supply (achieved using a voltage regulator). This output was hooked up to the Mega32’s A to D converter through a simple protective circuit (diodes to prevent any voltage less than 0 or getter than Vcc from being put on the ADC input pin). We tried to use a Kionex digital accelerometer, only to find the chips unable to function after they were exposed to multiple mis-wirings, possibly damaging the chips. Thank you, Freescale, for saving Air Jam.

The output of our circuit is a 3.5 mm stereo audio socket, an industry standard, an so you can use Air Jam with almost any set of speakers. We wanted to be able to use headphones, but the total output voltage was unfortunately too low so that without some sort of amplifier (meaning a volume adjust nob), the beautifully synthesized sound was inaudible.

Program design

How does Air Jam make that beautiful acoustic sound? Karplus-Strong, of course.

Math

In the Karplus-Strong algorithm, the pluck, which in real string can contain energy at any frequency, is simulate by filling the delay-line with noise at each note beginning. 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 device filters by simply adding the two last outputs and right shifting the result (divide by 2). The so create sample is then re-introduce 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.

 wearable air guitar Using Atmega2 Diagram

The period of the resulting signal is the period of the delay line plus the average group delay of the filter; the fundamental frequency, as usual, is the reciprocal of the period. The required delay D for a given fundamental frequency F1 is therefore calculated according to D = Fs / F1 where Fs is the sampling frequency.

Parts List:

Part Cost
STK 500 development board $15.00
Large solder board $2.50
Power Supply $5.00
Dip Sockets x2 $1.00
LT op-amp 8-dip x3 $13.25
Flex Sensors x 5 Surpluss
Accelerometer & Voltage Regulator (desoldered from battery board) Donated by Freescale
Glove $1
Radio Shack Audio Jack $3.00
Diodes 1N914 x2 Surpluss
TOTAL $40.75

For more detail: AirJam: wearable air guitar Using Atmega2


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:
LinkedinTwitter

Leave a Comment

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

Scroll to Top