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

Mathieu Bouchard matju at artengine.ca
Mon Sep 12 18:13:43 CEST 2011

On Sun, 11 Sep 2011, Rick T wrote:

> 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?

A complex signal is a pair of signals. One is labelled «real» and the 
other is labelled «imaginary».

A common way to think of it, is in 3 dimensions, with a time axis, a real 
signal axis, and an imaginary signal axis.

Multiplying by a real number means multiplying both signals by the same 

Multiplying by i means the input real becomes the output imaginary, while 
the input imaginary is negated and becomes the real output.

Multiplying by i is multiplying by both -1 and i, and you can see that you 
end up with three [*~ -1], of which two cancel each other, so, you can do 
it with just one [*~ -1].

[*~ -1] can also be replaced with a [-~] because x*-1 = 0-x.

But the phase shift you are talking about is not the same thing.

Multiplying by i only does a phase shift in the frequency domain, because 
it turns sin into cos, cos into -sin, -sin into -cos and -cos into sin 
(it's the same sign business as what i wrote about above). The Fourier cos 
components are labelled «real» and the Fourier sin components are labelled 
«imaginary», as in Euler's identity :

   exp(a+i*b) = exp(a) * (cos(b)+i*sin(b))

The meaning of real vs imaginary, in the time domain, mostly just means 
you can process two signals at once. Multiplying a real&imaginary signal 
by an imaginary gain is a form of stereo mixing thought of in a different 
way. Generally speaking, complex numbers are a way to unify math concepts 
so that some things become easier to think about in the long run.

| Mathieu Bouchard ---- tél: +1.514.383.3801 ---- Villeray, Montréal, QC

More information about the Pd-list mailing list