On Sun, Aug 29, 2021 at 10:03:20PM +0200, Robin Gareus wrote:
During the last days, I looked into phase-ration:
components of a signal
are delayed differently depending on their frequency.
This works well, except for the first FFT bin: 0 Hz,
DC offset. If the
phase-shift changes the average DC level of the signal there is a
discontinuity.
If you are working with real-valued signals, you can't change the phase
of DC or the Nyquist frequency (FS/2).
You can if you are using complex-valued signals, as often used in SDR.
To understand this, look at the real FFT. Assume the input is 256 samples.
The result is also 256 real values, which are in fact 129 complex ones.
Two of those, for DC and FS/2 will be purely real, with the imaginary
part zero. They have to be, as both sin (i * 0) and sin (i * pi) is zero
for all integer values of i. So we get in fact 256 and not 258
independent real values. This must be so as the FFT has an exact
inverse, so no information can be lost nor added.
To implement this you need more than just FFT and IFFT. Using only
those on each block would amount to circular convolution, while
what you need is linear convolution. Changing only the phase of
a signal is just a special case of filtering, which means the output
will be longer than the input.
You could use jconvolver to do this. Define the phase shift in the
frequency domain (i.e. as if it were the result of an FFT), do the
inverse FFT and use the result as the IR for the convolver.
In fact jconvolver can generate 90 degree phase shifters for you,
see the 'hilbert' command in the README. Combined with an equivalent
delay this can be used to obtain any phase shift you want.
Now don't believe that phase shifting a signal will always result
in a waveform with a lower peak/RMS ratio. It could very well
have the opposite effect. Any phase shift can be undone by
just another one. If one of those decreases the peak/RMS
ratio the the other will increase it... There is a bit more
to it that they won't tell you in ads.
Greetings to all from sunny Crete.
--
FA