# [PD] is this a spectral gate?

Frank Barknecht fbar at footils.org
Wed Feb 21 22:34:44 CET 2007

```Hallo,
David Powers hat gesagt: // David Powers wrote:

> This looks sweet, thanks Frank! Hoping to have a play with this as
> soon as I get to do some actual music making later this week. By the
> way, I thought I'd clarify what I meant with the example of Plogue
> Bidule. The website invites one to: "Transform audio in the spectral
> domain, with Bidule's FFT modules. Time domain audio is split into two
> types of data, frequencies and magnitudes, which can be manipulated
> using a wide variety of spectral bidules."
> http://www.plogue.com/img/Spectral.png

Funny: That image looks like it does exactly the same as the
specdelay~.pd patch I posted. The only difference is that the
Bin_Delay module in Bidule is two objects in Pd: delwrite~ and vd~. ;)

> So basically, in most of the "simple" fft software, they split the
> signal into freq and amplitude. You can see in the screenshot this is
> represented by yellow and orange connectors, and they have specific
> objects so you can play with a whole bunch of crazy transformations on
> both freq and amp, and then you can resynthesize it back with an
> inverse fft module.

Yes, the same principle is in use in Pd as well, only that instead of
phase and amplitude (often also called "magnitude") you get "real" and
"imaginary" data in Pd. But this is only a different point of view on
the same thing: one is a "rectangular" view the other is "polar". But
you can convert between both views back and forth.  The DSP-Guide has
a nicer explanation of the conversion:
http://www.dspguide.com/ch8/8.htm

Polar and rectangular (or cartesian) is just expressing the same thing
with different words. It's like saying:

* go left 4 feet and straight ahead another 4 feet

versus saying:

* go 5.65 feet in a 135 degree diagonal direction.

Both instructions will let you end in the same spot, although they use
completely different numbers:

o
|
|
|
|____x

o
\
\
\
\x

Ah, how I love ASCII!

> I see that I can also get the freq and amplitude info from PD's fft,
> once I'm awake enough to follow your math anyway! But I'm wondering
> where the phase comes in exactly - in Plogue I'm assuming the phases
> are somehow calculated auto-magically?

Maybe they are  using the formulas I gave in my little guide. Really,
re/im vs. phs/amp is just a conversion.

I guess, the FFT_0 module in Bidule has phase information in its left
outlet and amplitude info in the right, orange path. As you can see in
the screenshot the phase info in Bidule is passed practically
unchanged (only delayed a bit), because the operations like gain or
filtering only work on amplitudes: They multiply the amplitudes. This
doesn't affect the phases at all.

It's similar with Pd's real/imaginary view on the issue. In fact for
pure amplitde scaling you don't even need to convert from re/im to
phase/amplitude, you can just multiply the re/im data directly with
something to scale the amplitudes. (Because phase information is not
affected by gain changes.) However you need to multiply both signal
paths to actually keep the phases unchanged. See I03.resynthesis.pd
for this in action.

> They DO let you set the blocksize of the signal with the fft. Also,
> how does this relate to [fiddle~], because fiddle I understand, it
> gives me a fundamental freq and the amplitude of some number of
> harmonics, and I could take that info (for instance) to resynthesize
> stuff in some additive synth.

fiddle works a bit differently, but it will not give enough
information to make a clean resynthesis.  Remember: An FFT on a
blocksize of 1024 will give you 1024/2 = 512 resynthesis channels, or
512 virtual "oscillators". fiddle~ basically only gives one frequency.

Ciao
--
Frank Barknecht                 _ ______footils.org_ __goto10.org__

```