Analyzing buffer using RMS instead of avg~, cleanup help

sounds of distress's icon

Hello everyone,

I am pretty new to Max would like some help with the following patch:

Short description:
The patch analyzes the incoming signal (I use a 200ms prerecorded buffer for this that gets played back into this patch), giving me the "absolute mean" value of each frequency band ([avg~]) and out puts it as a list. the [avg~] are getting a bang at the start of playing the buffer and at the end of playback, thus giving me the absolute of the entire buffer.

What I need:
I would like for the patch to give me RMS values instead of what [avg~] gives me. I know [average~] has an rms mode, but I don't know how to set it up so I would get the entire buffer and nothing before and after, as well as converting it to float at the end.

Bonus:
If anyone has any ideas on how to make this patch a bit more elegant, I would love recommendations as well. I feel like there should be a way to do some "bulk processing" here, like using [mcs.fffb~] instead of [mc.fffb~], but I haven't figured out how to do it yet.

Max Patch
Copy patch and select New From Clipboard in Max.

sounds of distress's icon

So, I finally got around to trying out your advice. I managed to get it running (and got rid of the bloated style using MC). I'm using a [groove~] to playback the sample and use it as a sync signal as well. Working with [sah~] and signal driven playback is new to me, so I'm not sure this is the best way to do it. But it was the only way I could figure out that would only play back the sample once and not loop it.

Anyway, I'm getting the results I want, so thank you!

For anyone interested, it now looks like this:

Max Patch
Copy patch and select New From Clipboard in Max.

Roman Thilenius's icon

to "clear" the average object between buffer analysis processes you would simply insert a rest of 100 ms before/after every passage (while leaving DSP on)

you could then for example use

button
count~
index~
-~ 25000
clip~


to play from the buffer and let the capturing of the analysis only start when 0 is reached.