Max Patch Slowing down when using multiple Peakamp~, line and multislider objects...

EraserHead's icon

Hi everyone,

I'm pretty much done with a pretty big patch composed by a heavy GUI interface (Many sliders, knobs, etc).
I'm experiencing a big lag in the interface and I understood that is coming from this part of the patch (when I remove it everything is pretty smooth again).
There are 10 sound sources (I just made 8 for the demo) that are analysed via Peakamp on Computer 1 and then sent via OSC to Computer 2 which adjust the data received and generates the visuals in Jitter. Each sound source is then directed inside the patch and used as modulation sources.

How can I optimise this patch to make it run smoothly?

I noticed when experiencing this lag, that apparently I'm using very little CPU (~10%) and GPU on my new MacBookPro 2019 with this config: i7 2.6GHz and Vega20 16GB of Ram. Is there a way to address more efficiently Max to the computer resources?

Also I'm trying to trigger events with peaks, but I have often unwanted repetitions, any suggestions to make it more accurate?

Thank you very much in advance for your precious help!

PatchSlowDown.maxpat
Max Patch

EraserHead's icon

PS. All the knobs and fader are from live, I already set the "update limit" to 20ms and ticked "Defer automation output"

tmhglnd's icon

I'm not experiencing any lag with your patch (macbook 15" i7 16Gb osx 10.12), but my guess is that the lag is coming from the peakamp's, reporting new values at a 15 ms time-interval and then all the slides that have to calculate there new values. You might want to try and build the entire envelopefollower in the signal-domain. To avoid the repetitions you can then use [thresh~], which has a lo and hi threshold.

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

EraserHead's icon

Hi Timo, this is what I thought... too much infos for the data domain! Thank you very much for your suggestion!!

Roman Thilenius's icon

you could also try to not run the peakamaps in sync, i.e. use time values which are individually, randomly between 15. and 16. ms.

EraserHead's icon

So, I did all the programming in MSP, problem fixed! Thank you very much Timo for the nice threshold~ trick, it works perfectly...
Best!