level 1
imsixteenand
楼主
import ddf.minim.*;
Minim minim;
AudioInput in;
void setup(){
size(1026,700);
smooth();
noStroke();
minim = new Minim(this);
in = minim.getLineIn();
}
void draw(){
background(87,149,255);
float a = 0;
float angle = (2*PI) /100;
int step = in.bufferSize() / 100;
for (int i=0; i < in.bufferSize()-step; i+=step) {
//mix.get(i)邻返回的值在-1和1之间,放大且平移
float x1 = width/2 + cos(a) * (900 * in.mix.get(i) + 100);
float y1 = height/2 + sin(a) * (1100 * in.mix.get(i) + 100);
float x2 = width/2 + cos(a + angle) * (1100 * in.mix.get(i+step) + 100);
float y2 = height/2 + sin(a + angle) * (900 * in.mix.get(i+step) + 100);
stroke(random(255), 100,100);
line(x1, y1, x2, y2);
a += angle;
2018年12月21日 05点12分
1
Minim minim;
AudioInput in;
void setup(){
size(1026,700);
smooth();
noStroke();
minim = new Minim(this);
in = minim.getLineIn();
}
void draw(){
background(87,149,255);
float a = 0;
float angle = (2*PI) /100;
int step = in.bufferSize() / 100;
for (int i=0; i < in.bufferSize()-step; i+=step) {
//mix.get(i)邻返回的值在-1和1之间,放大且平移
float x1 = width/2 + cos(a) * (900 * in.mix.get(i) + 100);
float y1 = height/2 + sin(a) * (1100 * in.mix.get(i) + 100);
float x2 = width/2 + cos(a + angle) * (1100 * in.mix.get(i+step) + 100);
float y2 = height/2 + sin(a + angle) * (900 * in.mix.get(i+step) + 100);
stroke(random(255), 100,100);
line(x1, y1, x2, y2);
a += angle;