I'm hoping someone can help me find out how to use the audio waveform data to draw both across and down the screen-
Basically, at the moment im just drawing sine waves that overlap each other from right to left- as soon as they hit the edge of the screen, they start again from the left, a little lower. I'm using a mask to create areas that the pattern "skips" over.
I'd like to use minim to do the same with audio input instead of just a sine wave.
So- draw the waveform 'dynamically', hit the edge of the screen, and then keep drawing the waveform a little lower.
Below is the code i have that uses sine waves.
Fiber [] fiber;
int NUMFIBERS = 3;
int STEPS_PER_FRAME = 300; // number of moves made by each fiber per frame (call to draw())
I'm pretty new at all this, so.
I'm very, very stuck.
I'm trying to write a program that will draw a pattern of sine waves to the screen by updating the x and y locations of a bunch of "fibers" - objects that leave a trail behind them, basically.
My problem is, i want each line to draw / animate across the page, rather than just appearing (which is what's happening now).
For the life of me i cannot figure out how to work that in with what i've written so far. My code's pasted in below- i would be grateful if anyone could take a look and maybe point out what i ought to change.
fiber = new Fiber[NUMFIBERS];
createFibers();//calls a function to create fibers
collisionMask = createGraphics(width, height, JAVA2D);
collisionMask.beginDraw();
// Clear the collision mask's background to white
collisionMask.background(255);
// Draw three black circles on the collision mask
collisionMask.fill(0);
collisionMask.ellipse(0.25*width, 0.50*height, 100, 100);
collisionMask.ellipse(0.50*width, 0.50*height, 200, 200);
collisionMask.ellipse(0.75*width, 0.50*height, 100, 100);
// Tell Processing that we've finished the drawing by calling endDraw()
collisionMask.endDraw();
}
void createFibers () {
for (int i = 0; i < NUMFIBERS; i++)
fiber[i] = new Fiber(x,y);
}
void draw() {
fill(255, 0) ;
for (int i = 0; i < NUMFIBERS; i++){
fiber[i].move();
}
}
class Fiber{
//location
float tempX, tempY;
float nextX, nextY;