TiPpFeHlEr
YaBB Newbies
Offline
Posts: 40
Brandenburg, Germany
Re: make Waveform moving
Reply #2 - Oct 24th , 2009, 2:19am
hi BlindFish
i found a way to do that
Code: /////////////////////////////////AUDIO-Signal/////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////// float a(){ float k = map(myFFT.getAvg(range-1), 0, 100, 0, 2); a= pow(k, 3); return a; } float b(){ float n = map(myFFT.getAvg(range), 0, 100, 0, 2); b= pow(n, 3); return b; } float c(){ float m = map(myFFT.getAvg(range+1), 0, 100, 0, 2); c= pow(m, 3); return c; } /////////////////////////////////AUDIO-Array//////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////// void RenderAll(){ readingsAll[399] = (a+b+c); for(int z = 0; z < numReadingsAll-1 ; z++){ readingsAll[z]=readingsAll[z+1];} indexAll = indexAll + 1; if (indexAll >= numReadingsAll) indexAll = 0; } void Render1(){ readings1[399] = a; for(int z = 0; z < numReadings1-1 ; z++){ readings1[z]=readings1[z+1];} index1 = index1 + 1; if (index1 >= numReadings1) index1 = 0; } void Render2(){ readings2[399] = b; for(int z = 0; z < numReadings2-1 ; z++){ readings2[z]=readings2[z+1];} index2 = index2 + 1; if (index2 >= numReadings2) index2 = 0; } void Render3(){ readings3[399] = c; for(int z = 0; z < numReadings3-1 ; z++){ readings3[z]=readings3[z+1];} index3 = index3 + 1; if (index3 >= numReadings3) index3 = 0; } /////////////////////////////////DRAW-WAVE-FORM's/////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////// int ctid = controlP5.window(this).currentTab().id(); if(ctid == 5) { stroke(150,150,0); line(20,height-avgAll,width,height-avgAll); noFill(); stroke(255,255,0); beginShape(); for(int t = 0; t < numReadingsAll-1 ; t++){ vertex(t,height- (readingsAll[t+1])*Volume); } endShape(); } else if (ctid==2) { stroke(150,0,0); line(20,height-avg1,width,height-avg1); noFill(); stroke(255,0,0); beginShape(); for(int t = 0; t < numReadings1-1 ; t++){ vertex(t,height- (readings1[t+1])*Volume); } endShape(); } else if (ctid==3) { stroke(0,150,0); line(20,height-avg2,width,height-avg2); noFill(); stroke(0,255,0); beginShape(); for(int t = 0; t < numReadings2-1 ; t++){ vertex(t,height- (readings2[t+1])*Volume); } endShape(); } else if (ctid==4) { stroke(0,0,150); line(20,height-avg3,width,height-avg3); noFill(); stroke(0,0,255); beginShape(); for(int t = 0; t < numReadings3-1 ; t++){ vertex(t,height- (readings3[t+1])*Volume); } endShape(); }
regards maik