Code That Creates: Visualization

Song of the Goddess by Erutan is a beautiful song and personally, I love it even though I am actually do not understand the language. This week, I have finished visualizing the song buffer size and made a poster out of it. From the example shown in previous week, I was able to create the poster and export the PDF as an output. This is the code:

import processing.pdf.*;
import ddf.minim.*;PShape g;
PFont f,e;
Minim minim;
AudioPlayer groove;void setup()
{
beginRecord(PDF, “Erutan.pdf”);
background(255);
size(601, 850);
minim = new Minim(this);
groove = minim.loadFile(“Erutan-Goddess.mp3”, 200);
groove.loop();
g = loadShape(“Goddes-01.svg”);
f = createFont(“Parchment”,12,true);
e = createFont(“Arial”,12,true);
noStroke();
fill( 255, 128 );

}

void draw(){
stroke( 0 );
for(int i = 0; i < groove.bufferSize() – 1 ; i++)
{
float x1 = map( i, 0, groove.bufferSize(), 0, width );
float x2 = map( i+1, 0, groove.bufferSize(), 0, width );
noFill();
stroke(random(0,100),0,random(0,255),128);
strokeWeight(groove.bufferSize()/(50*(i+1)));
ellipse(300.5,-100+i,groove.left.level()*width*5,groove.right.level()*width*5);
}
shape(g,0,0);
}

void keyPressed() {
if (key == ‘w’) {
String a = “Erutan”;
String b = “Song Of The Goddess”;
fill(random(50,100),0,random(200,255));
textSize(80);
textFont(f,80);
textAlign(CENTER);
text(a,width/2,800);
textSize(20);
textFont(e,20);
text(b,width/2,840);
stroke(random(50,100),0,random(200,255));
strokeWeight(3);
line(0,790,180,790);
line(420,790,width,790);
}
if (key == ‘q’) {
endRecord();
exit();
}
}

As I pressed ‘Q’, a PDF was exported and I am happy with the design.

Erutan

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s