After Wednesday's "Putting it all together" class, I've not only discovered that YES, the Arduino can definitely teach me some neat things about Music as Information, but this could be something I'd be interested in as a hobby. Basically, the project that Bill took us through in class was using an Arduino and an accelerometer to communicate through the Processing program on a computer. Using a library called SoundCipher, it is possible to have the values being read from the accelerometer be represented with musical pitches. Once I realized where the class demonstration was going, the wheels started turning in my head.
I'm envisioning musical composition through body movement - a sort of marriage of interpretive dance and improvisational music. It would be a difficult art to master, but possibly rather easy to create (if I'm not underestimating the logistics here). LilyPads - the wearable Arduino - one for each sleeve and pant leg.
The specifics would be a lot easier to see in my head if I had actually been successful in getting the Processing sketch to actually play notes like Bill had done in class.
This is where the home-adventure begins. I tried following the example and directions from the class wiki. I was successful in opening the serial monitor so that I could view the values that the accelerometer was reading. When it came time to use those values to control a sketch in Processing, I was not so successful. I followed the Graph tutorial on the Arduino website and copied the code, but I wasn't sure how to get Processing to recognize the accelerometer values. The code worked and my graph ran perfectly, but it didn't show any values.
This was frustrating...I definitely don't know enough yet to diagnose problems on my own.
So... not wanting the adventure to be a total and utter fail, I left it and just played with SoundCipher for the rest of the night!
Exciting things started happening after that (well, I'm easily amused by musical ventures). I explored all of the tutorials in SoundCipher just to get a feel for what I could possibly do with it in the future. Then, I set off on a very small project, but I'm pretty proud of it, I must admit.
I created a monophonic song with the simple bing program. This program plays a single note and defines its pitch, dynamic, and duration. This is the most basic thing one can do with SoundCipher, but I wanted to see if I could really figure out how digital/algorithmic music works. The only knowledge I started with was that the numeric value assigned to a middle C note is 60. From there, I used the playPhrase program and I created a C chromatic scale to make sure the values for the notes were consecutive. Then, I created a one-octave C scale so that I could map out which notes I would be able to use for a song played in the key of C (60, 62, 64, 65, 67, 69, 71, 72).
And then I wrote a simple childhood song! Here's the code:
import arb.soundcipher.*;
SoundCipher sc = new SoundCipher(this);float[] pitches = {72, 69, 65, 60, 62, 64, 65, 62, 65, 60, 67, 72, 69, 65, 62, 64, 65, 67, 69, 67, 69, 70, 69, 67, 72, 69, 67, 65, 67, 69, 65, 62, 65, 62, 60, 60, 65, 69, 67, 60, 65, 69, 67, 69, 70, 72, 69, 65, 67, 60, 65};float [] dynamics = {80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80 ,80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80};float[] durations = {1.5, 1.5, 1.5, 1.5, .5, .5, .5, 1, .5, 3, 1.5, 1.5, 1.5, 1.5, .5, .5, .5, 1, .5, 3, .5, .5, .5, .5, 1, .5, .5, 2, .5, 1, .5, 1, .5, .5, 2, .5, 1, .5, 1,.5, 1, .5, .5, .5, .5,.5,.5,.5,1,.5, 3};sc.playPhrase(pitches, dynamics, durations);
I understand that there are very few other people who will be excited by this, but it was an extremely satisfying experience for me.
CREATION.
It's a bit annoying that each and every note has to be assigned a dynamic. In this case, I just wanted all the notes to be the same intensity. I'm sure there's a way to do it, but I don't know how. Also, I wonder if there is a way to set a time signature - because I realized halfway through my song that I was smart enough to pick one that was in 6/8 time...which is a pain to feel out, especially when trying to convert beats into seconds.
But there you have it - "Bicycle Built for Two" is a musical and historic gem, one must admit.
In the future, I would really like to figure out how to use the score setting so that I could add chords on top of the notes and have them play at a specific time. Also, perhaps one day, I can understand how the algorithms work...but that would require a better grasp of mathematics in general...and I am in the field of history for a reason...
In the meantime, must resist the urge to recreate the theme song from Super Mario Brothers!
Great work, Sara! Sorry you couldn't get the class example working at home. Try getting the Arduino to report the accelerometer values to the serial monitor. Then fire up Processing and try copying in all of the code from the last example of the wiki. E-mail me if that doesn't work like it did in class. Bill
ReplyDelete