I’m getting ready to present the head(banger)phones for the ITP Winter Show. A little bit of solder helped to get rid of the short circuit problem I was having periodically with the accelerometer. I also replaced the orchestral audio samples I originally used to demo the head(banger)phones with some synth samples I recorded from my Sidstation.
The head(banger)phones are a personal music device made up of a pair of headphones and a sensor. When the user wears the head(banger)phones, the motion and position of her head triggers different sounds, creating a dynamic interactive musical experience.
Source code after the jump:
import ddf.minim.signals.*;
import ddf.minim.*;
import ddf.minim.analysis.*;
import ddf.minim.effects.*;
import processing.serial.*;int counter = 0; //variable for controlling tempo
int tempo = 20; //the higher the number, the slower it goes//minimum and maximum values coming from accelerometer
int minX = 270;
int maxX = 440;
int minY = 270;
int maxY = 440;Serial myPort; // The serial port
int accelX=0;
int accelY=0;Minim minim;
AudioSample kick;
AudioSample x1;
AudioSample x2;
AudioSample x3;
AudioSample x4;
AudioSample x5;
AudioSample x6;
AudioSample y1;
AudioSample y2;
AudioSample y3;
AudioSample y4;
AudioSample y5;
AudioSample y6;void setup()
{
println(Serial.list());
myPort = new Serial (this, Serial.list()[0], 9600);
minim = new Minim(this);
size(1440,850);
background(0);
textFont(createFont(“Helvetica”, 80));
textAlign(CENTER);
fill(255,0,0);
text(“head(banger)phones”, width/2, height/2 – 50);
fill(255);
text(“(move your head)”, width/2, height/2 + 50);kick = minim.loadSample(“kick.mp3″, 1440);
x1 = minim.loadSample(“x1.mp3″, 1440);
x2 = minim.loadSample(“x2.mp3″, 1440);
x3 = minim.loadSample(“x3.mp3″, 1440);
x4 = minim.loadSample(“x4.mp3″, 1440);
x5 = minim.loadSample(“x5.mp3″, 1440);
x6 = minim.loadSample(“x6.mp3″, 1440);y1 = minim.loadSample(“y1.mp3″, 1440);
y2 = minim.loadSample(“y2.mp3″, 1440);
y3 = minim.loadSample(“y3.mp3″, 1440);
y4 = minim.loadSample(“y4.mp3″, 1440);
y5 = minim.loadSample(“y5.mp3″, 1440);
y6 = minim.loadSample(“y6.mp3″, 1440);
}void draw()
{
counter = (counter+1)%tempo;if (counter == 0)
{
//always play the kick
kick.trigger();
//play samples according the the X value
if (accelX == 1) {
x1.trigger();
}
else if (accelX == 2) {
x2.trigger();
}
else if (accelX == 3) {
x3.trigger();
}
else if (accelX == 4) {
x4.trigger();
}
else if (accelX == 5) {
x5.trigger();
}
else if (accelX == 6) {
x6.trigger();
}//play samples according the the Y value
if (accelY == 1) {
y1.trigger();
}
else if (accelY == 2) {
y2.trigger();
}
else if (accelY == 3) {
y3.trigger();
}
else if (accelY == 4) {
y4.trigger();
}
else if (accelY == 5) {
y5.trigger();
}
else if (accelY == 6) {
y6.trigger();
}
}
}void serialEvent(Serial myPort)
{
// read the serial buffer:
String myString = myPort.readStringUntil(‘\n’);
// if you got any bytes other than the linefeed:
if (myString != null) {
myString = trim(myString);
// split the string at the commas
// and convert the sections into integers:
int sensors[] = int(split(myString, ‘,’));
if (sensors.length > 0) {
accelX = int(map(sensors[0], minX,maxX,1,6));
accelY = int(map(sensors[1], minY,maxY,1,6));
println(accelX + “,” +accelY); //debugging to make sure the values are coming through and being translated
}
}
}//don’t really know what this does, but the Minim sample code says to be sure to do this, so can’t hurt
void stop()
{
x1.close();
x2.close();
x3.close();
x4.close();
x5.close();
x6.close();
y1.close();
y2.close();
y3.close();
y4.close();
y5.close();
y6.close();
minim.stop();
super.stop();
}




4 responses
head(banger)phones @ ITP Winter Show 2008 | LEESEAN.NET // Dec 18, 2008 at 4:07 pm
[...] are some photos of me presenting the head(banger)phones at the ITP Winter Show 2008 last night. Thanks to Justin Tedaldi, editor of the JETAANY [...]
Nod Your Head, Change the Beat: Accelerometer Headphones | PSFK // Dec 18, 2008 at 6:33 pm
[...] are an interesting project that has come out of the Winter 2008 ITP show. Created by Lee-Sean Huang, the headphones have an accelerometer attached to them that measures the wearer’s head [...]
Links for 12.18.08: MySpace’s Swift love, being late, typewriters… « the listenerd // Dec 18, 2008 at 10:42 pm
[...] Check out this set of Head(banger)phones tricked out with an accelerometer, so the listener can alter the music as he or she bops his [...]
Experience Music in Motion via Accelerometer Headphones | Mr.Gadget // Dec 19, 2008 at 8:19 pm
[...] Lee-Sean.net via Gizmodo Share this Gadget Post: [...]
Leave a Comment