[ SourceForge.JP | Freeverb3@Savannah | Freeverb3VST.SourceForge.JP ]

Library Usage Examples

Using IIR filter

The classes which have process() member function can get one sample and output one sample. You have to call process() multiple times to process samples.

// g++ -I /usr/include/libfreeverb3-2 -lfreeverb3
#include <freeverb/efilter.hpp>
#include <freeverb/biquad.hpp>
...

float input[size], output1[size], output2[size];
...
fv3::iir_1st_f IIR1_LPF;
fv3::biquad_f  IIR2_LPF;
IIR1_LPF.setLPFA(fc, sampleRate);

IIR2_LPF.setLPF(fc, transition_bandWidth, sampleRate);
for(int i = 0;i < size;i ++)
{output1[i] = IIR1_LPF.process(input[i]);
 output2[i] = IIR2_LPF.process(input[i]);}

Using FIR filter

The classes which have processreplace() member function can process multiple arrays of samples. You do not need to call processreplace() multiple times.

// g++ -I /usr/include/libfreeverb3-2 -lfreeverb3
#include <freeverb/irmodel3.hpp>
#include <freeverb/firfilter.hpp>
...
float inputL[size], inputR[size], outputL[size], outputR[size];

...
fv3::irmodel3_f FIR_LPF;
long lengthOfFilter; // must be an odd number.
// see fir3bandsplit.cpp predictN to calculate the length from transitionBandWidth
float filter[lengthOfFilter];
fv3::firfilter_f::lpf(filter,lengthOfFilter,FV3_W_HANNING,(fc/sampleRate),0);
FIR_LPF.setwetr(1);
FIR_LPF.setdryr(0);
FIR_LPF.loadImpulse(filter,filter,lengthOfFilter);
FIR_LPF.processreplace(inputL,inputR,outputL,outputR,size,FV3_IR_MUTE_DRY|FV3_IR_SKIP_FILTER);

Valid XHTML 1.1 Valid CSS! SourceForge.JP

[ SourceForge.JP | Freeverb3@Savannah | Freeverb3VST.SourceForge.JP ]