CPU usage at 100 in Max but not outside

Tanguy's icon

I have this granular synthesis patch which I have been using for a while, and never had any problems with, but in the past few days I've doubled it (so I can apply granulation to two recordings simultaneously), and I've had major issues with performance and with sound.

The CPU usage in the audio status window jumps to 100 as soon as I turn the audio on, and the sound is unusable as the audio isn't processed fast enough.
The weird thing is that my CPU usage in the control panel is around 3% or 4%, and I have no issues with other programs.
Also sometimes, the patch just starts running normally, the CPU usage stays around 30% in Max (but is still at 3%-4% in the control panel), and I have no issue.

I know the processor isn't actually in overdrive because I have no performance issues outside Max. And even if I increase the I/O vector size, it doesn't change anything, the CPU stays at 100.

Any ideas why this might be happening and how to fix it?

Ernest's icon

All operating systems report average cpuy usage. Something in the design is causing a sudden peak. It's usually an uzi.

Isabel Kaspriskie's icon

What OS are you on and which Max version? If you'd prefer to get in touch with Support directly, feel free to share these details (and if possible, your patch) to support@cycling74.com .

Tanguy's icon

I'm on windows 10 and the latest version of Max 8. I'm fine with sharing the patch, I'm just not sure how easy it'll be to start up, and also the fact that it sometimes randomly works means I can't know whether the same problem will appear on another computer...

Tanguy's icon

I think I've only got a couple of uzis, and they only send two bangs each, is that enough to cause any issue??

Isabel Kaspriskie's icon

It's hard to say without the patch, but it doesn't sound like an uzi problem.

If the patch was working fine on an older version of Max and the issue started with Max 8.2.0, I'd recommend contacting support.

Tanguy's icon

Alright, I'm going to send them an email, thank you for your help.

In the meantime, here is a version of the patch.

In presentation mode, I labelled the steps to get it started:
-Starting audio (through a startaudio message to mc.dac~ or by turning the general audio on)
-Recording audio (the buffer takes 30" of audio, but you can record less)
-Playing back the audio (starting the granular engine)
-Adjusting volume
-Adjusting the portion of sound to be played
-Changing grain parameters/presets

As I said, the synth is just doubled, so it's the exact same controls for the second synth.

In my case, the CPU jumps to 100 as soon as I turn on sound, before I even start the granular synth itself.

Let me know if you have any issues/questions.

MC Granular Synth CPU issue.maxpat
text/plain 167.82 KB

Tanguy's icon

PS: turns out I don't even have a single Uzi in the patch, so it's definitely not that.

Ernest's icon

lol. Conventionally we share patches by selecting all and choosing 'copy compressed' from the edit menu, then pasting that into the forum here. Welcome to max )

Ernest's icon

Anyway, I had a quick look, and generally it is not advisable to have a 'metro 1' in your design. That's as fast as the queue can run, so if it can't process the messages within 1 ms you're doing the same as putting an overloaded uzi in your patch. And when you just copied everything, you added a second metro. Changing them to qmetro objects may stop your cpu from quitting altogether, but it would be advisable to try a slower metro too.

Also you have 100 voices at least once already. Obviously, by doubling it, you've made 200 voices. That's an awful lot to ask to get processed in 1msec and you were lucky you didn't have problems before.

By way of indication I only have 32 voices with typical CPU usage of 0.75% and when I first made it a poly from a single-voice design I got a lot of clicks when I changed presets because I have 128 parameters, even on a 4GHz i7. So Ive had to do a lot to get my message queue down. Moving everything to gen~ made the most difference. Also you have to be careful with buffer reads on large numbers of voices, I wrote a tutorial that explains that here:

Roman Thilenius's icon


if you recently upgraded, you might also have lost some of your preferences. such as vectorsize...

mizu's icon

Trying the patch, i have at launch the message ,: bad number in Max console. Seems to come from : pack 0. , 127. 0. to a line object at a start comment. Max 8.1.11: i7 2.8 gHz, 45% cpu 128/128 samples. Max 8.2: ~40 %, .
hth bzz

Tanguy's icon

How would you go about switching to a gen~ object here?

Ernest's icon

Well that's quite an extensive topic, and I get asked it frequently, so I started some tutorials on it, the first one is here:

Ernest's icon

ok, now I covered the bases, but it did take seven tutorials, so here's the link to the final one in this set, which links to all the earlier ones. I'm kind of tutored out for the month now, lol.

Tanguy's icon

I'll look through them, thank you for sharing, and thank you for your help!