How to calculate delay/phase caused by filters and other modules.
Probably I just don't know the correct search term.
I have been making some distortion and saturation effects which include filters in the signal chain. I want to have a wet/dry mix just before the output but the wet signal is of course out of phase with the dry signal so I get unwanted cancellation.
How can I calculate the number of samples delay that are happening in my effect so that I can compensate for it in the "dry" side?
Best Answer
-
if you swap the 0 inputs of the cross fades for the main L and R (lowest pair of cross fades in the pic), you will hear (subtle or not so much depending on the settings and the audio being processed) phase cancellation but with the LP-HP it's much improved.
Also, if you do create the same structure with a 1-pole all-pass, and compare the output with the LP-HP version, the error/difference doesn't exceed ~ 5e-7 so about -130dB which is pretty good ;-)
0
Answers
-
Hello,
filters change phase differently over frequency, so there is no delay for that you can apply, that work for all frequencies.
Only 6dB/Oct filters don't change the phase. Have you tried it and does it sound strange? Maybe it's you have to generally compensate for the delay the FX introduce. You could measure the delay within your DAW with a short rectangle signal, a spike and measure the difference between the signal through the chain and the bypass signal, by set the d/w to 50 percent. With the data you can then of course delay the bypass signal.0 -
"Only 6dB/Oct filters don't change the phase"
That's not true, 6db/Oct IIR filters (at least the Reaktor core factory ones) change the phase by up to -90 degrees (-pi/2 radians) depending on the frequency (2 pole 180, 4 pole 360…)
0 -
"How can I calculate the number of samples delay that are happening in my effect so that I can compensate for it in the "dry" side?"
You can't use a delay, because that is frequency independent. What you need is an all-Pass filter that complements the filter.
There is an example of this in the core filter library. If you look at the crossover filters, there are some macros with a += in the name, these mix the bands with the dry signal, so the dry signal needs to be phase adjusted to match.
e.g. here is the X-over LR2 += macro (2-pole Linkwitz-Riley crossover mixer)
The all-pass applies the same phase offset to the dry signal without changing the amplitudes, so the phases align.
You need the correct all-pass for the filter. Might be able to do this in Primary with guesswork, trial and error and luck. Or in core by doing the math (ouch)… or by using the TF (transfer function) section of the filter toolkit to plot the phase curves of various filters and match them to all-pass phase curves.
(not sure how you deal with something like a 2pole band pass where the phase offset goes from +90 to -90 though…?)
Here is a basic setup to plot the phase using TF (no actual numbers here, just the curve, but it's still useful ;)
Using this it's easy to see that a factory 2pole SVF low pass (EDIT:with resonance at zero!!) has the same phase plot as a factory 1 pole all-pass. Just by swapping the connections (to the funny 'j' macro with the |z| and arg outputs) and seeing the same plot.
2 -
Thx - good to know
0 -
Seems there are fancy things like minimum phase filters, and fir zero phase things etc. but for standard iir there is no way to have no phase distortion afaik.
1 -
Yes that's why I thought it, I know for passive filters for speakers you have a phase shift e.g. high pass from -90 to 0 (low to high) but now I know iir filters have that too (the same way as passive filters for the phase?)
0 -
It does make some intuitive sense that if you have a multi-mode filter then mixing the low-pass output with the high-pass output should give you all-pass with the correct phase, but I'm sure there are some subtleties in there that I'm failing to consider :))
0 -
Really helpful, thank you. Luckily I don't need resonance so hopefully it'll be simple.
0 -
Only if the slope of the filter was vertical. Otherwise there's a bit around the cutoff frequency that is not linear.
0 -
Can't have a filter with a vertical slope.
Here's an example to test. Drag some music onto the 'tapedeck' (wav only iirc), toggle the play button, set the cutoff, then twiddle the mix control to mix in more or less of the unfiltered signal. This has been 'all-passed' using LP-HP of the same filter… try comparing the sound of the through audio to just the 'all-passed' version, it sounds pretty good to me? Obviously, as soon as you increase the resonance, it falls down because you get a peak at the cutoff frequency…
0 -
"can'thave a filter with a vertical slope"
- that was my point :)
Thanks for the replies. I got it working using the 1-pole LPF and the 1-pole AllPass in Primary. By putting a few in a row the slope is acceptable.
I now have a multiband distortion kind of thing where I can just saturate the lows and mix it in.
I am finding this kind of effect really powerful on drums. The convenient thing about only distorting the lows is that you don't really need to oversample because all the filtering avoids much of anything getting close to Nyquist.
Next I will try different distortion approaches to see what sounds best. Probably asymmetric clipping for second order harmonics…….
1 -
Ah I need to update my Reaktor to check your example…..
0 -
if you swap the 0 inputs of the cross fades for the main L and R (lowest pair of cross fades in the pic), you will hear (subtle or not so much depending on the settings and the audio being processed) phase cancellation but with the LP-HP it's much improved.
Also, if you do create the same structure with a 1-pole all-pass, and compare the output with the LP-HP version, the error/difference doesn't exceed ~ 5e-7 so about -130dB which is pretty good ;-)
0
Categories
- All Categories
- 19 Welcome
- 1.4K Hangout
- 60 NI News
- 735 Tech Talks
- 3.9K Native Access
- 15.9K Komplete
- 1.9K Komplete General
- 4.1K Komplete Kontrol
- 5.5K Kontakt
- 1.5K Reaktor
- 364 Battery 4
- 817 Guitar Rig & FX
- 416 Massive X & Synths
- 1.2K Other Software & Hardware
- 5.5K Maschine
- 7K Traktor
- 7K Traktor Software & Hardware
- Check out everything you can do
- Create an account
- See member benefits
- Answer questions
- Ask the community
- See product news
- Connect with creators