### DFT help needed

Hi, i’ve created a patch that maps positions of an object at time intervals. now i want to do the dft (discrete fourier transform) or the fft(fast fourier transform) of that "position vs time" signal, so i can have the fundamental frequency of the object at a certain position! i think there is no object in Max that allows me to do that, so I have to write a external one.

Does someone has any suggestion about this? is there some object that can do it? or if i have to write the external, can someone point me in the right track…

thank you!

best regards, baltaz

Hi,

Before launching into development, did you try the fft~ or pfft~

objects in MSP? I think you could create signals of position over

time (if your position is 3D, you can make three signals for X, Y, Z,

or maybe Ro, Phi, Theta…) and feed those into fft~ or pfft~ objects

(3x fft~ or 3-inlet pfft~ for XYZ).

I guess we’d need to know a little more about this – is it real-time

(if so, what would be an appropriate number of analysis bins), or if

not, how many time-units are you looking to do? fft~ and pfft~ are

limited to power-of-2 sizes. fft~ is limited to max 4096 samples.

pfft~ doesn’t have this limitation – I’ve just tested with 131072

samples (Max 5, not sure if this works in 4.6). That’s a lot of data!

Alternatively, if you’re working with non real-time, jit.fft might be

usable – really depends on your scenario.

I’m not quite sure what you mean by ‘fundamental frequency at a

certain position’. Taking an fft of position/time is going to give

you the magnitude of the position of the object at a given periodic

frequency. If this is the case, then unless your object is jumping

around a lot, then pretty much all of the energy is going to be in

the bottom few frequency bins (think of smooth movement as very low

frequencies). Sudden changes of direction will show up as bursts of

energy across the whole spectrum (which will be naturally distorted

by the windowing used). Fourier transforms really shine on input

signals with lots of harmonic components… coupled pendula might be

interesting.

Hope this helps in some way…

Graham

On Nov 25, 2008, at 7:11 AM, baltaz wrote:

>

> Hi, i’ve created a patch that maps positions of an object at time

> intervals. now i want to do the dft (discrete fourier transform) or

> the fft(fast fourier transform) of that "position vs time" signal,

> so i can have the fundamental frequency of the object at a certain

> position! i think there is no object in Max that allows me to do

> that, so I have to write a external one.

>

> Does someone has any suggestion about this? is there some object

> that can do it? or if i have to write the external, can someone

> point me in the right track…

>

> thank you!

>

> best regards, baltaz

Be seeing you

grrr waaa

http://www.grahamwakefield.net

thanks for the help…

I will try to feed the signal to that objects you mentioned fft~ or pfft~. the analysis is to be made in real time, i still don’t know how many samples would be enough to get a good result…

my intention is to estimate the period of the movement that is assumed to be more/less periodic…that’s why im thinking of using the fft…do you have another suggestion??

thanks baltaz

Forums > Dev