VU { *kr { arg synth; var amp1,amp2,colors,cliplevel; var w; w = GUIWindow.new("In", Rect.newBy(870, 50, 105, 151)); 10.do({ arg i; StringView.new( w, Rect.newBy(35, 120-(i*11), 8, 8), ""); }); 10.do({ arg i; StringView.new( w, Rect.newBy(71, 120-(i*11), 8, 8), ""); }); 20.do({ arg i; w.at(i).backColor = Color.new(100,100,200); }); cliplevel = 0.23; // set this to whatever value your inputs seem to clip at amp1 = Amplitude.kr(AudioIn.ar(1)); amp2 = Amplitude.kr(AudioIn.ar(2)); colors = [ Color.new(0,100,0), Color.new(0,100,0), Color.new(0,100,0), Color.new(0,100,0), Color.new(0,100,0), Color.new(0,100,0), Color.new(0,100,0), Color.new(255,255,0), Color.new(255,255,0), Color.new(255,0,0) ]; synth.trepeat(0,0.1,{ 10.do({ arg i; if (amp1.poll >= ((cliplevel / 10) * i), {w.at(i).backColor = colors.at(i)}, {w.at(i).backColor = Color.new(100,100,200)}); }); 10.do({ arg i; if (amp2.poll >= ((cliplevel / 10) i), {w.at(i+10).backColor = colors.at(i)}, {w.at(i+10).backColor = Color.new(100,100,200)}); }); }); ^Plug.kr(0.0); } }/* authors so far: mattr */ |