Make Music with your Muscles
Hi everyone! I’m Cristian, a junior at Nido de Aguilas High School in Chile. Aside from math and engineering, which are my main interests, I enjoy playing drums and reading nonfiction.
During my internship here at Backyard Brains, I’ve been working on building a musical instrument! It is a modification of our Muscle SpikerShield that measures the electrical signals going through your muscles and transforms them into a note or melody according to how much you flex! I feel proud to join a long tradition of musical instrument makers stretching back 35,000 years.
My musical box has four settings that produce four different outputs. You can change between these settings by pressing the red button on the Muscle SpikerShield. The first setting outputs a frequency that is proportional to how much you flex your arm, so if you really tighten your arm, it’ll output a high frequency, and if you untighten it, it’ll output a low frequency.
I am a very efficient coder. Look at my fundamental code. Rejoice in its beauty.
tone(8, finalReading/1.5, 100);
The second setting outputs notes on a chromatic scale, so you can play different melodies by changing how much you flex your arm.
The third setting plays “Mary had a Little Lamb” on repeat and, just like a real musical box, lets you alter the speed at which the melody plays. If nursery rhymes aren’t really your thing, you can always alter the code and change the melody. This is for all our circuit bending friends out there.
Lastly, the fourth setting lets you play the four notes that make up “Mary had a Little Lamb”, so you can try and create the melody yourself by flexing at different strengths, (which is very hard to do).
Below are two pictures of the setup you will need. Make sure to place jumpers in ground and digital pin 8 and connect them to an audio mini plug, as shown below. The miniplug can be from speakers or headphones. You can use alligator clips.
Additionally, make sure to place 3 electrodes in your muscle of preference ( I used my arm), and connect them to the Muscle SpikerShield with the orange electrode cables.
You can find the code for the musical box here. It includes comments that explain how everything works.