hey all, im doing an art project but im new to code,
i need to make an ellipse start and expand each time a sound goes in pocessing
i already did the drawing based on a sketch from openprocessing, now i just need to make it start from sound and not from keypressed,
im using the minim library
here is my code:
- ArrayList Circles = new ArrayList();
- Circle D;
- import ddf.minim.*; //minim audio input
- Minim minim;
- AudioInput in;
- int s = 1700; // audio input sensivity
- void setup(){
- size(600,600);
- smooth();
- minim = new Minim(this);
- minim.debugOn();
- in = minim.getLineIn(Minim.MONO, 64);
- }
- void draw(){
- background(0);
- strokeWeight(3);
- for (int i=0; i<Circles.size(); i++){
- Circle D = (Circle) Circles.get(i);
- D.run();
- }
- }
- class Circle {
- PVector pos;
- color c;
- float s;
- int age;
- Circle( PVector _pos, color _c, float _s ) {
- pos = _pos;
- c = _c;
- s = _s;
- }
- void run() {
- render();
- age += 3;
- if(age > 600) {
- Circles.remove(this);
- }
- }
- void render() {
- stroke(255,255,255);
- fill(255, 255, 255, 155-age*0.35);
- ellipse( width/2, height/2, age*1.5, age*1.5 );
- }
- }
- void keyPressed(){
- Circle D = new Circle( new PVector(random(width), random(height)), color(100),0);
- Circles.add(D);
- }
- void stop(){
- in.close();
- minim.stop();
- super.stop();
- }
i really apreciate all the help!