We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSound,  Music Libraries › Log frequency scale plotting
Page Index Toggle Pages: 1
Log frequency scale plotting (Read 376 times)
Log frequency scale plotting
Jul 17th, 2008, 11:02pm
 
I have a problem with trying to plot a frequency response of some filter coefficients on a logarithmic frequency axis.  How do you go about implementing that?  

I am doing the following:

void drawTransferFunction()
{
 // background(0,0,255);
 freqResponse.forward(Hb);
 for(int j=0; j< fftSize/2; j++)
 {
   H[j] = freqResponse.getBand(j);
 }
 freqResponse.forward(Ha);
 for(int j=0; j< fftSize/2; j++)
 {
   H[j] = H[j]/freqResponse.getBand(j);
 }
 for(int i=0; i < fftSize/2; i++)
 {
   float temp = 20.0*log10(abs(H[i]));
   float x = ((float)(width) - pow(1250,(fftSize*0.5-i)/(fftSize*0.5)));
   stroke(50,24,88);
   point(x, (-1*temp+20)/40*(float)(height));
 }
}


This seems to be working, but I'm not sure if it is accurate?  I wanted to plot text to say what frequency it was at as well on the axis.  Any ideas on how to go about doing that?  Basically its just a real time version of freqz in matlab, where you can drag around some biquad filters.
Page Index Toggle Pages: 1