[PD] help with rfft~

Stefan Turner stefanlturner at yahoo.co.uk
Tue Nov 29 10:15:01 CET 2005

<snip> Does this mean that if frequency and
> phase of a sinusoid
> can br represented as
> A*sin(2*PI*f*t)+B*cos(2*PI*f*t), then the left
> output of fft~ is B and the right output is A?

Yes, if f is the sample position within the output
block (i.e. which frequency it refers to) and t is the
frequency of ffting, i.e. block size divided by sample
rate. The equations don't have anything about phase,
though, as this form represents the input as sin and
cos waves (with phase of 0, starting at the beginning
of each fft block).

> If so, how do I get frequency and phase?

I think you mean magnitude and phase. The frequency of
the sinusoid depends upon which sample of the output
block you are looking at. E.g. if the first three
samples output from the left outlet (the cos side) are
0.1, 0.2, 0.3, then the amplitude of the 0*f (direct,
0Hz) component is 0.1, of the 1*f component is 0.2, of
2*f component is 0.3, etc. The 2*f component, for
example, will be that which makes 2 complete
oscillations within each block. So, sample 2 (counting
from 0, i.e. the 'third', counting from 1, sample) of
the left output is the amplitude of the cos wave which
makes 2 complete oscillations. There's only a direct
component for the cos side, as sin of 0 is always 0.

You can convert them into magnitude and phase form,
where instead of a pair of sin and cos waves of a
certain frequency, you have one wave of the same
frequency but a certain phase relative to the start of
the fft block.

Magnitude = sqrt(sincomponentamp^2 +

Can't remember phase, but it should be in here
somewhere, together with all of this explained better
than I can:

Good luck, I'm still learning this stuff, but I think
it's worthwhile once you get there!

WIN ONE OF THREE YAHOO! VESPAS - Enter now! - http://uk.cars.yahoo.com/features/competitions/vespa.html

More information about the Pd-list mailing list