Pattern created with audio using minim
in
Core Library Questions
•
5 months ago
Hi. I'm very new to Processing, so I would really appreciate your help on my project. I have been working on a sketch where I use audio as an input to generate a random pattern.
So far I have used noise as a variable, and the only output so far is a ellipse/rectangle shape moving in a random path. I was wondering if you guys knew how I for instance could use a more organic and complex shape as an output, like for instance a tree, or if it is possible to trigger different .svg shapes based on the frequency and the height of the notes.
I realize that this probably is a complex question, but I would be grateful for any help!
My code so far looks like this:
- import ddf.minim.*;
- Minim minim;
- AudioInput input;
- float x;
- float y;
- float t = 0;
- int nbLignes = 400;
- int i=0;
- void setup() {
- size(700,700);
- background(160);
- noStroke();
- smooth();
- minim = new Minim (this);
- input = minim.getLineIn (Minim.STEREO, 512);
- }
- void draw() {
- float dim = input.mix.level () * width;
- x += input.mix.level () * 100;
- float n = noise(t);
- float h = map(n, 0, 1, 0, 500);
- fill(103, 255, 255);
- pushMatrix();
- translate(i*(height/nbLignes), width/2);
- rotate(radians(h));
- ellipse(0, 100-h/2, dim, dim);
- ellipse(0, 100+h/4, dim, dim);
- popMatrix();
- t+=0.01;
- if (i<width) i++;
- else {
- i=0;
- }
- }
1