1
$\begingroup$

When I have digital audio signal, represented in samples, I can easily phase-shift the signal by 180° by simply inverting the value of each sample.

But what if I want to phase shift an arbitrary voice audio signal by say +90° or -90°?

How do I transform an arbitrary, discrete signal by phase-shifting it by an arbitrary phase angle?

$\endgroup$
2
$\begingroup$

The answers to this question explain the solution for the continuous-time case. In discrete time, the solution is completely analogous. The impulse response of a phase shifter with phase shift $\theta$ is given by

$$h[n]=\cos(\theta)\delta[n]+\sin(\theta)g[n]\tag{1}$$

where $g[n]$ is the impulse response of an (ideal) discrete-time Hilbert transformer. Eq. $(1)$ shows that the solution is just a linear combination of the identity system and a Hilbert transformer (which performs a $90$ degree phase shift).

$\endgroup$
  • $\begingroup$ I used to build analog phase shifters using this approach in the 90's, as vector modulators. The quadrature splitter was built with all pass filters for providing a broad frequency range for the 90° splitter (the products I worked on covered 10MHz to 500MHz), after the splitter were two bi-phase attenuators (one with a DC value proportional to the cosine of the desired phase shift and the other with a DC value proportional to the sine of the desired phase shift and then the output of the two attenuators were summed through a 0° combiner. Multipliers (mixers) work as well but are reflective. $\endgroup$ – Dan Boschen Sep 2 '18 at 1:51
0
$\begingroup$

The problem is that you need a phase shift that is constant across all frequencies.

You'd classically do that with a Hilbert transformation.

$\endgroup$
  • $\begingroup$ Erm, OK, could you elaborate a tiny bit? I can do discrete hilbert tranformation, and then what? $\endgroup$ – polemon May 4 '18 at 11:03
  • $\begingroup$ My (second) guess would be to make an analytic representation by taking your signal $s(t)+i H[s(u)](t)$, then multiply with $e^{i\phi}$ to shift your phase, and then take the real part of the result. This seems to be the same as taking FFT, multiply with $e^{i\phi}$, make it the FFT symmetric again, calculate IFFT. $\endgroup$ – BNJMNDDNN May 4 '18 at 12:04
  • $\begingroup$ after the HT you've got a 90° shifted signal $\endgroup$ – Marcus Müller May 4 '18 at 12:44
  • $\begingroup$ @MarcusMüller what if I want to shift the signal by an arbitrary amount? Can I use HT and pass a parameter that denotes the phase shift? $\endgroup$ – polemon May 7 '18 at 2:48
  • $\begingroup$ No. But arbitrary phase shifts are a different problem, and you should ask a new question, with details about what you want to solve! $\endgroup$ – Marcus Müller May 7 '18 at 6:04
0
$\begingroup$

To implement a phase shift you can use all pass structures which pass a wide range of frequencies with constant amplitude and only changing the phase. Note that these are dispersive structures when the phase is constant which means the time delay of each frequency component is changing (since time delay is the derivative of phase with frequency) so may cause significant distortion (you may actually want a constant delay and not a constant phase?). Also it is not possible to have a constant phase over ALL frequencies so you would specify a finite band of interest and minimize error in that band in your implementation. For more details on all pass filter structures see https://en.m.wikipedia.org/wiki/All-pass_filter

$\endgroup$
  • $\begingroup$ Well, most DAWs provide for the ability to phase shift a channel between -180° to 180°. I want to replicate and understand that function better. Hence my question. For my understanding, it is a constant phase shift of all frequencies by an arbitratry (i.e. user selectable) amount. $\endgroup$ – polemon Sep 2 '18 at 0:23
  • $\begingroup$ If you shifted an audio channel that contains a broad range of frequencies by a fixed phase over all frequencies, my understanding is that it would significantly distort the signal. Is that the intention? What is the purpose of the phase shift in this application? $\endgroup$ – Dan Boschen Sep 2 '18 at 0:27
  • $\begingroup$ Some instruments are recorded from several positions. For instance a drum can be recorded from the top and bottom. Let's call the top one mic A and the bottom one mic B. Some (most) frequencies of mic B will be phase-shifted by 180° compared to mic A. That's a simple example. Whenever there's one instrument recorded by several microphones from various angles, that might create a problem, when pre-mixing that channel (i.e. mixing all microphones into one compound channel for an instrument, for instance). $\endgroup$ – polemon Sep 2 '18 at 0:55
  • $\begingroup$ Would a delay correction then be the best solution? A delay would align the signals in time without introducing dispersive distortion $\endgroup$ – Dan Boschen Sep 2 '18 at 0:59
  • $\begingroup$ Possibly. I'm more interested in the signal processing algorithm itself, rather than the actual use-case scenarios, though. I'm wondering about the concept and the math behind it. Less so about the practical application. $\endgroup$ – polemon Sep 2 '18 at 1:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.