[LAD] Phase rotation

Fons Adriaensen fons at linuxaudio.org
Tue Aug 31 14:49:21 CEST 2021


On Tue, Aug 31, 2021 at 04:24:43AM +0200, Robin Gareus wrote:

> I hoped to sidestep that because the phase-angle should be a sweepable
> parameter. I can probably make this work by cross-fading the computed
> FIR when the parameter changes.

Provided that what you want is the same phase angle on all frequencies,
you can easily make it 'sweepable' without recomputing the IR.

The N-point hilbert IR will give you 90 degrees plus a delay of N/2
samples [1]. So in a second channel make a delay of N/2 samples.
Then by combining both in the right proportions you can make any 
phase angle you want. For A degrees, just do

out = cos (A) * D + sin (A) * H, where D and H are the delay and
hilbert convolution outputs respectively.

[1] It's not possible to do the phase shift without additional
delay. It's more or less the opposite of a linear phase filter:
for 90 degrees the IR must be anti-symmetric. The lenght of the
hilbert IR determines its bandwidth, the 3 dB points will be
near FS / N and FS / 2 - FS / N. So ideally instead of a delay
for the second channel you should use a FIR with the same 
magnitude response as the Hilbert IR.

Ciao,

-- 
FA



More information about the Linux-audio-dev mailing list