Butterworth::HighPass<1> flips polarity of signal
heebje opened this issue · comments
Shameless Plugs commented
Hi,
I use a simple 6dB/oct Butterworth::HighPass<1> in an audio plugin I am developing, and I discovered that apparently it flips the polarity of the signal.
I would expect the pass band to have a phase of close to 0 degrees, but it's close to 180 degrees instead.
I noticed this when mixing the 'wet' signal of my plugin with the dry signal.
I did an extra test, outside of my plugin, just to confirm.
Is this by design?
It doesn't feel right.
Bernd Porr commented
int main(int, char**)
{
const int order = 1;
// sampling rate here 1kHz as an example
const float samplingrate = 1000;
FILE *fimpulse = NULL;
// Butterworth lowpass
Iir::Butterworth::LowPass<order> f;
double cutoff_frequency = 100; // Hz
f.setup(samplingrate, cutoff_frequency);
fimpulse = fopen("lp.dat", "wt");
// let's simulated date streaming in
for (int i = 0; i < 1000; i++)
{
double a = 0;
if (i == 10) a = 1;
double b = f.filter(a);
fprintf(fimpulse, "%e\n", b);
}
fclose(fimpulse);
}
Bernd Porr commented
Impulse response positive so all good. Since you haven't provided a testable case I'm closing it.