#include "soundfile.h" int main(int argc, char** argv) { Options options; options.define("a0=d:1", "first feedforward term"); options.define("a1=d:1", "second feedforward term"); options.define("a2=d:1", "third feedforward term"); options.define("b1=d:1", "first feedback term"); options.define("b2=d:1", "second feedback term"); options.process(argc, argv); double a0 = options.getDouble("a0"); double a1 = options.getDouble("a1"); double a2 = options.getDouble("a2"); double b1 = options.getDouble("b1"); double b2 = options.getDouble("b2"); SoundFileRead insound(options.getArg(1)); int sampleCount = insound.getSamples(); SoundHeader header = insound; header.setChannels(1); // write only mono files SoundFileWrite outsound(options.getArg(2), header); double currin = 0.0; // x[n] double lastin = 0.0; // x[n-1] double lastin2 = 0.0; // x[n-2] double currout = 0.0; // y[n] double lastout = 0.0; // y[n-1] double lastout2 = 0.0; // y[n-2] // the for-loop implements the difference equation for a biquad filter: // y[n] = a0*x[n] + a1*x[n-1] + a2*x[n-2] - b1*y[n-1] - b2*y[n-2] for (int i=0; i