Forums > MaxMSP

Help: Turn a signal into a list

December 19, 2013 | 4:00 pm

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


December 19, 2013 | 4:26 pm

[capture~], [record~]
also give a look at the msp tutorials about the fft, that should help a lot


December 19, 2013 | 5:09 pm

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?

Attachments:
  1. pfftcapturetest

December 19, 2013 | 8:17 pm

/Max */examples/fft-fun/sonograph.maxpat is a pretty interesting example of this. You can also use poke~ to write into a buffer~.


December 19, 2013 | 8:31 pm

You can also store FFT frames into a jit.matrix and access/view them.


December 30, 2013 | 4:13 pm

Hey guys,

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.


December 31, 2013 | 10:37 am

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. –

</code>

(P.S. You say you’re new to Max. This is moderately complicated stuff, so you might want to start with simpler tasks.)


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