Unexpected results combining Biquad filters. #72
PaulDevenney
started this conversation in
General
Replies: 1 comment 2 replies
|
Hi, you're doing everything right essentially. The two approaches are equivalent conceptually, but technically combination of simpler filters will always work better (numerically, less round-off errors). Also, if you play around with parameters of your filters you'll notice that output discrepancies will be different depending on those parameters and sometimes they'll be pretty insignificant. using NWaves.Filters.Base64;
using NWaves.Utils;
var cascadeFilter = new IirFilter64(highpassFilter.Tf * peakFilter.Tf * highShelfFilter.Tf);
double[] cascadedSignal = cascadeFilter.ApplyTo(signal.Samples.ToDoubles());PS. Also, there's a var chain = new FilterChain(new IOnlineFilter[] { highpassFilter, peakFilter, highShelfFilter });
var filteredSignal = chain.ApplyTo(signal); |
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
According to https://github.com/ar1st0crat/NWaves/wiki/Filters#combining-filters, cascaded filters are equivalent to chained
ApplyTo(), but I don't observe this behaviour. I assume I'm doing something wrong and would be greatful for advice.leads to the following;
blue = FFTd signal
orange = FFTd eqdSignal
red = FFTd cascadedSignal
The orange line (
highShelfFilter.ApplyTo(peakFilter.ApplyTo(highpassFilter.ApplyTo(signal)))) is what I would have expected to see as a result.All reactions