Portrait of my Mom

For my portrait, I decided to use the data collected from my mother’s iTunes playlist (an XML file) to create a static image using some names and music notes. The bigger the note, the more times my mom has listened to the song. I decided on the colour sceme because I feel that music flows just like the colours. The colours also slowly move between my mom’s favourite colours of purple and blue. Each time the sketch is opened, it is randomized just like my mom likes to listen to her playlist in a random order.

This data is very interesting. I feel that music can tell a lot about a person. For example, my mother’s music album consists of mostly top-40. Therefore, one can conclude that my mother is culturally main-stream. She enjoys listening to things that she hears on the radio which consists of songs she is able to sing along too. To conclude, I feel that this piece is more effective with the names of the songs. Adding the song names also help other relate to this art work when they find songs in the artwork that they also enjoy.

(Click to enlarge image)

Processing Code:

XMLElement root = new XMLElement(this, "itunes.xml");
XMLElement[] tracks = root.getChildren("dict/dict/dict");

PFont font; 

size(screen.width, screen.height);
smooth();
background(0);
font = loadFont ("ArialMT-120.vlw");

for (int i=0; i < tracks.length; i++) {
  XMLElement[] data = tracks[i].getChildren();

  float rw = random(width);
  float rh = random(height);

  int playCount = 0;
  for (int j=data.length-1; j > 0; j -= 2) {
    String key = data[j-1].getContent();
    String value = data[j].getContent();

    if ( key.equals("Play Count") ) {
      // turn a string (value) into an int (playCount)
      playCount = Integer.parseInt(value);

      if ( playCount >= 10 && playCount <= 200) {
        fill(playCount, rw, rh);
        stroke(playCount, rw, rh);
        ellipse(rw, rh, playCount/2, playCount/2);
        rect(rw-playCount/4, rh-playCount/2, playCount/20, playCount/2);
        rect(rw-playCount/4, rh-playCount/2, -playCount/5, playCount/20);
      }
    }
    if ( playCount >= 10 && playCount <= 200 && key.equals("Name") ) {
      stroke(150);
      fill(150);
      textFont(font, 10);
      text(value, rw, rh);
      text(value, 100, 100);
    }
  }
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s