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?
The rightmost outlet of fftin~ gives you the bin index.
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!
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:)
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:)
Thanks a million for the great answer!
I will be happy if let me know when you finalize your article.
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.)
----------begin_max5_patcher---------- 620.3ocuVssiaBCD8YxWwH5qoqvlKooR6C86nZUkC3DbE1FgMMY2Ua91qsAx lzv1vlP3EmvXyLmyYtfeclm+J4NpxG9N7Svy60YddNSVCdsO64yI6RKHJ2w7 SkbNUn8m2rmltS6rqqdFVwDJPmSz.ohB75BMqrfp.4ZHBzRPQolsoPNohKEr T2NVCJxVsTpygsj+P6bcASPSk0Bm+CaMtVJzBBm5h4OpXjhtiWRzo4LwleUQ S0MLBEE8Pvb3a1ETbf8mHyCvSsuhnlyDETsiYnihfh8hKBHr4cZLyxbgTt52 eEi8e2AxZcmGBrFea1L6x7aTNMRI7E+qhzINhFmXWCWXWwAi.oCFORSeIijt ++xgC4sPb2Z+L.eNTQIiGTMdXEs5.Va7l94RZCP8UrMBa5.7WWHIF32ARyFt XdPK+jIQWMaa8azYIQtLidL66URtbREE2uRguFkht03xyJjSIUZYorXHRX6+ NvxqPxV5VStPY+mPght6JjhjeQw4VjDD1MP.ghGMQIreQAc0MXeH+Y1Yilwg DwlgHBF5v30bWm2EGQtvMZo46Bm1cQ104ET.N71Fbhv28JnGe7dU.4nTWSUx CwiT8SvHV+zujTlSTxp8.xjjwIwI336YKVTyULvnwpCa4cWfVuVu2VcGAwHL DL7oyiyb5lduQblzh9UrviTLWHbWq7etwqCkV6mJiJYcUZmNzM2CdGoYTklI HZlTb7ghO4P4rrLp33ARbVVozLWqEDvS8lTGLlBFBlr.GMcXJZnXZ5zoECAR QSNjPCARSXlCODYJXRwjUlvCARSWla4.ToE2.hLO71r+BL6ceRH -----------end_max5_patcher-----------
@ t: Did you finish your dissertation? I’d love to read it.
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!
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)