Forums > Jitter

Basic help on FFT

June 17, 2010 | 9:48 am


I made a patch which stores 512 samples of gestural data in a matrix and displays the curve in a LCD object and also the matrix data in a jit.pwindow object (values between 0 and 255).

– Pasted Max Patch, click to expand. –

The reception sampling rate is 200Hz.

As it is written in the patch, I would like to get the frequency content of my signal (which is not an audio signal but a continous stream of data stored in a matrix) and display it to see the frequencies of my movements.

I need some directions because I am a noob with Jitter or FTM, and even if it is ok for me to compute FFT on an audio signal with Max objects, it is quite more blurry to compute it on a non audio signal.

Thanks a lot,

Have a nice day,


June 17, 2010 | 12:19 pm

It seems I have to deal with fft~ and jit.poke~. I am aware of FFT mathematics, I know how to get it in Matlab for example, but I have to admit that it is not clear in Max.

I would like to get the spectrogram (time vs. frequency) of my matrix 0-511 samples containing the samples values at the right index.

Any help would be appreciated,

Thanks a lot,


June 17, 2010 | 2:04 pm

My question is finally : How can I send a continuous stream of data (not a signal) into a spectroscope~ object which accepts only signals ?

In max / msp we can only get the fft of audio signals or image ? how can I deal with stream of data ?


Have a nice day :)


June 18, 2010 | 5:07 am

Transform your data into an audio signal, but use a poly~ to downsample to your 200 Hz sampling rate. sig~ will do that for example. Or if your stream of data is not constant or hard to sync your rate, you could first dump it into a buffer~ with peek~ and then play~ the buffer~… (You can easiliy read out the buffer while still peeking into it…)


June 21, 2010 | 9:07 am

Thanks a lot,

It leads me to another questions.

As you correctly assumed, my sampling rate is not constant. Timer object shows to me that between two consecutive values I get 5ms, then 4.95ms, then 5,1ms … this coming from the WIFI hardware part of the values reception.

Then my sampling rate is around 200Hz but not always 200Hz …

Then I read several times this topic : but it is still hard for me to understand how I cope with the difference between floats and the signal after the sig~ object.

I want to get a sonogram (more precisely a spectrogram because I do not need to hear it) of my signal.

So here is my idea : (as you can see in my patch)

If I take the dynamic sampling rate and then do the math : 48000/f (48 Khz is my DSP status and f is the dynamic sampling rate) I get something around 240 which I can use in a degrade~ object (or a poly~ but I don’t get it, how can you make a poly~ object act in a similar way as a degrade ?) to make my signal be exactly as the float incoming values ?

And then my sonogram should be right displayed ? because it is not correct at the moment, I only get some peaks separater with blanks in the sonogram as if the sync were not good.

I have another problem. To make the sonogram work, I have to activate AUDIO ON / OFF. When I do that, it makes my sampling rate fall to 0Hz .. Do you know where it might come from ?

Here is my patch :

– Pasted Max Patch, click to expand. –

Thanks for your help Stefan, maybe the solution is Peek + buffer but I don’t really understand the difference. If I use peek, I will put one value at the time in my buffer and this not depending on my sampling rate ?

Have a nice day,


ps : maybe do you have another solution than sonogram ? maybe a classical FFT display like in the example Max files should be more efficient ?

June 22, 2010 | 8:24 am

Okay for the second solution, do you mean :

- Using peek~ and load values x(1),..,x(512) into [peek~ data] for example
- Using [buffer~ data] which contains the same values
- Using play~ or groove~ to play the buffer as it was a normal sound buffer (but here it contains the movements data)
- and then using for example the PVOC-2D example to display the frequency-time plane or playing it directly into a sonogram


Thanks a lot,

Have a nice day,


Viewing 6 posts - 1 through 6 (of 6 total)