Help: Turn a signal into a list
I would like to take a signal from pfft~ and turn it into a list or vector so I can easily get the amplitude at each frequency. I am new at Max so please be clear and simple in explanation. thanks
also give a look at the msp tutorials about the fft, that should help a lot
I have looked at capture and record as well as the tutorials and I am having trouble figuring out how to access the stored data. In the attached picture I am showing the input from adc~ going through pfft~ (with FFT size of 512) and then capturing the whole spectrum (512, same as FFT size, right?). I also have a spectrograph hooked up to make sure the audio is working. I do not know how to get this data back. For instance if I want to have a live updating number of the amplitude of bin number X, how would I do that?
/Max */examples/fft-fun/sonograph.maxpat is a pretty interesting example of this. You can also use poke~ to write into a buffer~.
You can also store FFT frames into a jit.matrix and access/view them.
So I looked at the sonograph example (mentioned by mzed) and looked into jit.matrix (mentioned by christopher) and am still confused on how to actually store and retrieve the info. I feel like all the tutorials and examples I see are just barley over my head (I understand the concepts and what a jit.matrix is for example, but the implementation is not described clearly enough for me to figure it out.) If someone could do a brief example using the basic pfft example I attached in my last post, and modify it to store values and retrieve the amplitude values for a certain frequency that would be very helpful and would be greatly appreciated.
Thanks for all the help guys.
Your graphic appears to show an incorrect patch. Your pfft~ object is apparently sending out a time-domain signal (implying that the pfft~ subpatch contains a fftin~ 1 object connected to a fftout~ 1 object), so you’re capturing a snippet of the audio signal, not of the FFT.
Do you feel you understand the distinction? The FFT process (fftin~) takes some number of samples of the time-domain audio signal and converts that into the same number of complex numbers (real and imaginary pairs) representing the spectrum of that audio. At that point it shows up in the subpatch in the form of two MSP signals, but those represent the real and imaginary values of the FFT, not the original audio itself. What I think you want to do is convert the complex numbers of the FFT into magnitude and phase information, then capture/display the magnitudes, right?
Here is a patch that demonstrates that. You will first need to download the attached file and save it somewhere in the Max file search path. Then open the patch below, and try it out.
<code>-- Pasted Max Patch, click to expand. --Copy all of the following text. Then, in Max, select New From Clipboard.----------begin_max5_patcher---------- 1749.3oc0ZsziaaCD9r2eED5rqqodY6dKH.AnGJxgDfdHIvfVhxlIxjBRT6t MAM+16PRIYIKqG1qWG2CqWqgOzLeySxw+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0rBGCNdrmSAZ1xioQn4NbVraLmVNJscRZoUGK23OBtw4l wMtifaVcy3Fa6QBN3KfcL1QG0RcEmbTqzOpM5sagdWsOGdO+6C+WSs0l+ -----------end_max5_patcher-----------
(P.S. You say you’re new to Max. This is moderately complicated stuff, so you might want to start with simpler tasks.)
Forums > MaxMSP