pfft~ access to single bin

Sep 26, 2011 at 2:01pm

pfft~ access to single bin


I look around in max’s help files but I can’t find answer form my question.

Do you know how to get access to single bin in fft frame in real time?
Is it possible with max?


Sep 26, 2011 at 2:37pm

The rightmost outlet of fftin~ gives you the bin index.

Sep 29, 2011 at 9:30am

Ok :)

But how can I get access to this data? With snapshot~ or buffer~ ?

Let say I want make a simple spectrogram based on fft~ with pfft~ and multislider. What should I put in the middle?

Thanks for help!

Sep 29, 2011 at 4:03pm

It depends where you want to store you data. If you want to make a spectrogram, I suggest you to store FFT data in a matrix (jit.matrix) using jit.peek~ to store and jit.poke~ to read the data. Working with FFT data is sooo much easier and more intuitive when the data is stored in a matrix that I really suggest you to go in that direction.

J.F. Charles published an awesome article in Computer Music Journal back in 2008 called A Tutorial on Spectral Processing Using Max/MSP and Jitter. There are also many accompanying patches to that article…have a search on the web. Priceless source of information!

PS: And you will have to decide between using fft~ or pfft~. There is no point in using both. At least not for what you want to do.

PS2: In case you’re not familiar with Jitter, you really need to know just few basics in order to create Spectrogram, so…I would say Jitter is the way forward:)

Sep 29, 2011 at 4:04pm

PS: I am just writing my dissertation on that topic, it will be finished very soon. Detailed description of spectral processing in Max/Jitter…stay tuned, 160 pages already:)

Sep 29, 2011 at 6:19pm

Thanks a million for the great answer!
I will be happy if let me know when you finalize your article.


Sep 30, 2011 at 4:28am

If you really want to isolate just a single bin (as opposed to displaying the entire spectrum), this may not be the most efficient way imaginable, but it works. (The example uses fft~ instead of fftin~, but the principle is the same.)

– Pasted Max Patch, click to expand. –
Jan 19, 2012 at 9:29am

@ t: Did you finish your dissertation? I’d love to read it.

Cheers, A

Jan 20, 2012 at 10:09pm

Thanks for the tips t! I’d love to peek at some of your dissertation as well. This is something I’ve been contemplating pursuing as well!


Jan 20, 2012 at 11:53pm

You can use ==~ and sah~ to accomplish this. (as in when the bin# is equal to n, sample the value and continue holding it until the next frame. You can use send~ on this. You may need to divide by the number of overlap since you’re adding multiple values together)


You must be logged in to reply to this topic.