[PD] help with rfft~

thewade pdman at aproximation.org
Tue Nov 29 10:51:44 CET 2005


Georg Holzmann wrote:

> Hallo!
>
>> The help for fft~ says (for that rfft~ at least) the left and right
>> outputs can be considered as the coefficents of cosine and sine
>> respectively. 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?
>> If so, how do I get frequency and phase? (My calculus book is back in
>> Boulder)
>
>
> well, the output of a fft (or rfft) are complex numbers - the left 
> output is the real part, right the imaginary part.
> And as you can represent complex numbers with cos + sin - you have the 
> representation from above.
> If you want the amplitude+phase you have to convert these numbers from 
> rectangular to polar coordinates.
>
But you can represent any sinusoid as above, not just complex ones.
There is probably some nifty trignometric relation that quickly solves:
Rsin(2 pi f t + arctan(B/A))=Asin(2 pi f t)+Bcos(2 pi f t)
for f, R and phase (arctangent part), but basically I am interested in 
whatever method is fastest so that I can do more processing to the output.

>> If I am going to convolve the two signals - multiply in the frequency
>> domain - what happens to phase?
>
> convolution is a simply multiplication, but it's a multiplication of 
> complex numbers ...
> (and it's of course different, when you use rectangular or polar 
> representation)
>
So which is better for convolution: polar or rectangular? Some 
processing must happen for convolution, because just multiplying the 
real outputs of two rfft~ objects and the two complex outputs makes for 
very poor convolution. Do most convolution tools (PD or otherwise) 
convert to polar, multiply the frequencies, divide by niquist (I have no 
idea here), then use one of the the signal phases and convert back to 
rectangular for rifft~, or is there some oter way?

Thanks for the help!
-thewade




More information about the Pd-list mailing list