Nowhk wrote:JCJR wrote:Maybe it was already mentioned, but of course these causal IIR filters of any type, lp, hp, bp, ap etc-- They all have phase shift.

Phase shift on IIR is somethings I never really catch in terms of "what happens behind the games".

This for example is a graph that I don't understand.

Time to learn a bit about this, so maybe I can understand why "transient pitch shift" is related to the "energy" that filter picks up when I modulating a filter cut off

Thanks for your always brilliant supports.

Hi Nowhk

Your linked picture shows a "phase-wrapped" plot. It appears to be wrapped at +/- 90 degrees but I could be mistaken. More typically, so far as I recall, such charts will wrap at +/- 180 degrees. Or sometimes even +/- 360 degrees.

It is common to wrap phase charts to accommodate phase plots which have A LOT of phase shift, so that the charts can show decent detail without being incredibly tall. If you see a phase hit bottom and instantly jump to the top (or vice-versa) you could take pencil and paper and draw a taller version of the chart, connecting the top of the discontinuous point to the bottom of the "sudden jump" or vice-versa, and it would show a smooth "non-jumpy" phase curve on a much taller graph. The phase curve isn't (usually) really suddenly jumping between the rails. It is just hitting the top and continuing from the bottom or vice-versa.

A phase shift of 180 degrees is the same as inverting the signal, multiplying all the samples by -1.0. And a phase of 360 degrees is in some ways "the same as a phase of 0 degrees, or 720 degrees, or whatever. The circle keeps going round and round.

It is tricky to grock in its entirety and I wish I had better understanding. Phase shift also causes group delay. Some frequencies get delayed more than other frequencies.

But the frequencies of biggest phase shift are not necessarily the frequencies with the biggest delay. For instance (a very non-rigorous explanation follows) if we delay 1000 Hz by 90 degrees (a quarter wave period), it would be about 1 ms / 4 = 0.25 ms delay. But if we are simultaneously delaying 100 Hz by 45 degrees (an eighth of the wave period), then the 100 Hz would have about 10 ms / 8 = 1.25 ms delay. So in this situation, the higher frequency would have bigger phase shift, but the lower frequency would have bigger delay because that smaller phase shift is getting applied to a longer wave period.

Like FFT, phase shift is often visualized as the effect on an "indefinite duration" repeating waveform. When audio changes, if the pitch or timbre changes, or when notes start or stop, the behavior around the change boundaries is more complicated. For instance if you feed a sine wave into a filter, then after the sine has been running for a few cycles you can measure amplitude and phase of the output vs the input after everything has settled. But the first few cycles after the sine wave starts, and the first few cycles after the sine wave stops, the phase shift and frequency is still happening but it is hard to see the exact effect until the system "settles down". I suppose someone with sufficient expertise and practice would generally "know what to expect" when certain audio is started, stopped, or changed when fed into certain filters.

Of note-- The phase plots of lowpass, highpass, bandpass, allpass, notch are "fairly simple" things and generally move in one vertical direction from left to right as viewed on a phase plot. But peaking and shelving filters have less predictable phase plots. They have phase shift curves fer sure but the behavior is not "cut and dried" like the above simple lowpass or highpass. Peaking and shelving filters can have "non-intuitive" looking phase plots unless you look at them long enough to know what to expect.

When you sweep a synth filter down, the phase shift gets progressively greater at any fixed tone frequency in the sweeep range. So each new instant of the waveform gets slowed down, delayed a little more as the phase is significantly (negatively) increased. So that slight moment-to-moment increase in the delay causes the pitch to play flat while the filter is moving down, but after the sweep stops (or moves far enough past the tone frequency until phase isn't changing very much, moment-to-moment) the tone pitch would return to normal. It is still being delayed by the new filter phase, but the delay is constant after the filter stops moving.

The same happens on an upward sweep. As the phase sweeps up in frequency, the moment-to-moment delay is constantly decreasing, causing the tone to momentarily go sharp. Each wave period gets "crowded together" a little closer so long as significant phase shift is happening at that tone's frequency.

Perhaps a good simple demo of the effect would be a classic old subtractive synth flute patch. Flutes have a little bit of tremolo and a little bit of vibrato. Sometimes "not bad" flute patch could be made using a single triangle wave oscillator, fed to a lowpass filter. Adjust the lowpass filter to 1:1 track the keyboard, and tune the lowpass filter "somewhere in the ballpark" of the triangle wave pitch. Modulate the filter with an LFO.

Because the triangle wave is mellow, the timbre changes a little bit as the filter wobbles up and down, but it is subtle timbre change. Similarly, the volume of the triangle wave subtly goes up and down making a tremolo component, because the filter is modulating the amplitude of the mellow tri wave as much as it is modulating the timbre. And also the up-n-down filter modulation imparts a subtle pitch vibrato to the tri wave. So you simultaneously get subtle timbre, tremolo and vibrato with just the LFO-modulated lowpass filter.