import ddf.minim.*;
Minim minim;
AudioInput in;
float yl;
void setup() {
size(520, 360);
background(255);
// Create the Input stream
minim=new Minim(this);
in = minim.getLineIn();
}
void draw() {
// background(255,20);
noStroke();
fill(255,10);
rect(0,0,width,height);
float a = 0;
float angle = (2*PI) /100;
int step = in.bufferSize() / 2;
yl=0;
for(int i=0;i<step;i+=2){
float inn=in.mix.get(i)*1000;
stroke(255,0,0);
strokeWeight(1);
point(i,height/2+inn);
yl+=abs(inn);
}
if(yl>0){
println(yl);
fill(0,255,0);
rect(250,height,10,-yl/50);
}
}
麦克风
最新推荐文章于 2023-01-04 15:07:30 发布