Basic Electroacoustics II: Music-Making Systems |
| Music G6602Y |
| TueThu 3:10-5:00pm |
| Spring 2008 |
| hello. |
| Professor: Douglas Repetto [douglas at music columbia edu] |
| TA: Victor Adan [vga2102 at columbia edu] |
| hello. |
| Our Motto: "Why and how." |
| hello. |
| syllabus | lectures |
CREATURES!
Last week Victor introduced the basic OOP ideas. OOP techniques lend themselves well to many biological metaphors -- it's easy to think of classes as types of organisms (ants) and to think of objects as particular individuals (an ant named Jojo). Today in class we'll build (from scratch!) a system of autonomous sound-makers that interact in an environment. We'll spend the class coding together, then your homework will be to take what we've done so far and expand/modify it.
Okay, here's what we came up with:
import ddf.minim.*;
import ddf.minim.signals.*;
AudioOutput out;
int num_creatures = 5;
Creature[] creatures = new Creature[num_creatures];
void setup(){
size(400, 400);
println("doing setup...");
frameRate(10);
setupSound();
setupCreatures();
}
void setupSound(){
Minim.start(this);
out = Minim.getLineOut();
}
void setupCreatures(){
for(int i=0; i width / 20){
size = width / 20;
}
}
void updateSound( ){
sine.setAmp(amp());
sine.setFreq(freq());
sine.setPan(pan());
}
void nudgePosition(int dx, int dy){
x += dx;
y += dy;
updateSound();
}
float pan(){
return x / width;
}
float freq(){
return y * 10;
}
float amp(){
println(size/ (width / 20.0));
return size / (width / 20.0);
}
}
And here's the applet.
Homework: extend the example, or if you're ambitious, start fresh and make some creatures of your own.