Help optimizing efficiency of Max for Live Frequency Spectrum Analysis/ Reducing CPU usage of patch
Hi all,
I've been a quiet observer of this forum and it's been immensely useful in learning Max for Live, so I wanna thank you all first. I'm making a patch that essentially sends a spectrum analyzer to Touch OSC. Everything works great, but the patch itself uses about 15% CPU in Ableton when running. It immediately drops to normal when turned off.
The variables that are important is that I specify each frequency that is sent out to each specific fader on the Touch OSC layout. I've achieved that and the spectrum works great on it, but I'm sure there is a more efficient way of doing it than sending 64 separate reson commands to 64 separate peakamps to each OSC send four times over.
Attached is just the patch for the low frequency portion of the analyzer as all four patches are mirrors of each other with the differences being the frequencies selected and the OSC routes.
I can say with certainty I'm probably not doing this patch the most efficient way I could be, but it's what I've been able to come up with from experimenting. I'm really hoping someone on here could help take a look at the code and tell me what I'm doing wrong!
You might want to look into doing this with FFTs, but if you want to use a filter bank, you might take a look at peqbank~ from the CNMAT externals package.....
\M
I've been looking into FFT's, but I'm unsure how to even process the frequency information as a list of values to then push the the faders. Do you or anyone else know how this might be achieved?
Lifted from this thread:
https://cycling74.com/forums/fft-bin-amplitude-data