Open ruohoruotsi opened 11 years ago
I agree. The example on how to initialize a lowpass filter is great, but - as a novice C++ coder - I'm having serious trouble figuring out how to apply the filter. Obviously I have to call either BiquadChain::processBiquad or BiquadChain::processFourthOrderSections (which one?) but I cannot figure out the syntax to do so.
Ok let me get some examples posted for you, with real audio flowing through, gimme a couple of days!
Would you please kindlly post me some examples of audio processing examples using Biquad and Biquad Chain? i want to implement a equalizer using BiquadChain, Thank you so much!
Hi there, yes I need to get an example going, I haven't been working on this in a while, but I do have some example code, let me test it out and push a PR for you to look at. thanks for your interest!
Would you please kindlly post me some examples of audio processing examples also?
Could you point out where am I wrong in following code:
vector \<Biquad> coeffs;
BiquadChain biquad_chan;
static void process_data (double *data, int count, int channels) { biquad_chan.processBiquad(data, data, 1, count, &coeffs[0]); return ; }
static void read_write_file (const char infilename, const char outfilename) { static double data [BUFFER_LEN] ; SNDFILE infile, outfile ; SF_INFO sfinfo ; int readcount ; memset (&sfinfo, 0, sizeof (sfinfo)) ;
if (! (infile = sf_open (infilename, SFM_READ, &sfinfo)))
{
printf ("Not able to open input file %s.\n", infilename) ;
puts (sf_strerror (NULL)) ;
return;
}
if (sfinfo.channels > MAX_CHANNELS)
{ printf ("Not able to process more than %d channels\n", MAX_CHANNELS) ;
return;
}
if (! (outfile = sf_open (outfilename, SFM_WRITE, &sfinfo)))
{ printf ("Not able to open output file %s.\n", outfilename) ;
puts (sf_strerror (NULL)) ;
return;
}
int filterOrder = 8;
double overallGain = 1.0;
Butterworth butterworth;
bool designedCorrectly = butterworth.loPass(44100, // fs
500,
0,
filterOrder,
coeffs,
overallGain);
biquad_chan.resize(coeffs.size());
while \((readcount = sf_read_double (infile, data, BUFFER_LEN))\)
{ process_data (data, readcount, sfinfo.channels) ;
sf_write_double (outfile, data, readcount) ;
}
sf_close (infile); sf_close (outfile) ;
return;
}
The result wav is noise.
Okay, this is an old issue that I previously promised to fix. Let me make an example to share w/ you. I'll also have a look at your code to see what possibly went wrong.
What is the test file that you are using?
The test file is your sweep_0_20K.wav
Add audio processing examples using Biquad and Biquad Chain, to make it explicit how to integrate the toolkit into an external signal processing chain.
A fully working pd or Max/MSP external would be ideal.