SOUND
I have not thought much about sound but my main goal is to make the sound interactive with snake so it can have this waving effect. Maybe i can have a tone going on in the background and have the sound change when the snake moves up and down or to a certain point. I think that the sound will only be a secondary thing to the idea of the snake, so i am a little bit worried about this.
The link shows after a few try out of different sound, that works the best with the type of imagery. The sound was made through garageband on my laptop and exported as an mp3 file.
To work out different ways of introducing sound i picked apart some different codes and used the groove audio player so my sound continually plays and changes in volume depending on where the snake is moving it gets quit loud sometimes so just a WARNING (turn down the volume!!!!!)
To work out different ways of introducing sound i picked apart some different codes and used the groove audio player so my sound continually plays and changes in volume depending on where the snake is moving it gets quit loud sometimes so just a WARNING (turn down the volume!!!!!)
import ddf.minim.*;
import ddf.minim.effects.*;
Minim minim;
AudioPlayer groove;
BandPass bpf;
float beginX = 20.0;
float beginY = 10.0;
float endX = 500.0;
float endY = 400.0;
float distX;
float distY;
float exponent = 4;
float x = 0;
float y = 0;
float step = 0.01;
float percentage = 0.0;
void setup()
{
minim = new Minim(this);
groove = minim.loadFile("My Song.mp3");
groove.loop();
size(550, 450);
noStroke();
smooth();
distX = endX - beginX;
distY = endY - beginY;
bpf = new BandPass(440, 20, groove.sampleRate());
groove.addEffect(bpf);
}
void draw()
{
fill(0,1);
rect(0, 0, width, height);
percentage += step;
if (percentage < 1.0) {
x = beginX + (percentage * distX);
y = beginY + (pow(percentage, exponent) * distY);
}
fill(255);
ellipse(x, y, 20, 20);
}
void mousePressed() {
percentage = 0.0;
beginX = x;
beginY = y;
endX = mouseX;
endY = mouseY;
distX = endX - beginX;
distY = endY - beginY;
}
void mouseMoved()
{
float passBand = map(endX,0 , width, 0, 2000);
bpf.setFreq(passBand);
float bandWidth = map(endY ,0, height, 500, 1000);
bpf.setBandWidth(bandWidth);
bpf.printCoeff();
}
void stop()
{
groove.close();
minim.stop();
super.stop();
}
No comments:
Post a Comment