[PD] Multiplying signal by complex number to create and see phase shift

Charles Henry czhenry at gmail.com
Mon Sep 12 18:49:07 CEST 2011

On Sun, Sep 11, 2011 at 7:33 PM, Rick T <ratulloch at gmail.com> wrote:
> Greetings All
> I plan on adding a phase shift to a signal/a wave file I import which is
> easy enough mathematically
> example: if the signal is x=sin(2*pi*1*t)
> to do a phase shift I would just multiply x*e(-i*pi) which would phase shift
> the signal by 90 degrees.
> But how does one multiple signals by complex numbers in PD like -i?
> note: there will be a several different phase shifts so a simple
> hibert transform won't work in this instance

I guess you already know what this is about then--as Patrice said,
you'll have to use fft~ on windows of your signal to accomplish
different frequency-specific phase shifts.

The Hilbert transform accomplishes one type of complex signal
decomposition that applies to phase shifts by complex number multiple:
the complex signal
c(t)=x(t) + i * Hx(t)

can be written as magnitude(t) and phase(t)

c(t)=magnitude(t) * e^( i * phase(t))

Then, applying multiple of e^( i * (phase shift) ) just adds the phase
shift into this decomposition of the signal.  As you said, it applies
to not just one frequency, and it also doesn't just shift every phase
by the same amount.

Now, notice the hilbert~.pd abstraction---This is a pair of all-pass
filters that shifts the signal by approximately 90 degrees at each
frequency.  You'll have to open it up and analyze it yourself to see
if it really does what you want--but it's been shown to be a very
practical and reliable way to accomplish phase shifts.


More information about the Pd-list mailing list