Is there a way to toggle GUI elements like scope~/specctroscope~ to save CPU?

Caligula Cuddles's icon

I've been working on a couple M4L patches, and being able to have a lot of visual feedback is really useful to setting parameters, but ultimately not worth the CPU drain to keep them on all the time. Is there a way to turn off the scope~ and spectroscope~ objects and ease off the CPU usage when I no longer need to see them for fine-tuning?

I did a quick search through some old posts, but I didn't see anything.
Well, I did see some mention of using poly~, but I was confused as to how that would work for displaying GUI elements.

Pedro Santos's icon
  1. Thinking that a scope~ or spectroscope~ wouldn't use any CPU if not actually receiving audio, I figured out that you could have a gate~ object letting the audio pass or not to the visual object. Measuring the CPU usage, it is exactly the same (the spectroscope~ object keeps using the same CPU resources).

  2. Now, if I disconnect the patch cord that goes into the spectroscope~ object, the CPU is not used at all.

  3. Given this information, you could use scripting names and thispatcher to script the connection and disconnection of the patch cords. It's not the easiest approach (number 1 should suffice, in my opinion), but it's one that works.

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

Caligula Cuddles's icon

Huh. I thought I tried that before and didn't see any CPU reduction.
Cool. Well, that means the solution was always under my nose, and the real issue then becomes finding out what else is chewing up resources. Ha ha.

thx

jvkr's icon

Hiding ui elements is an option too.

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

Roman Thilenius's icon

what make you think that gate~ can interrupt audio? :)

#P window setfont "Sans Serif" 9.;
#P user number~ 128 223 202 238 9 139 3 2 0. 0. 0 0. 250 0. 0 0 0 221 221 221 222 222 222 0 0 0;
#P user ezdac~ 65 264 109 297 0;
#P window linecount 1;
#P newex 102 161 126 9109513 gate~;
#P newex 147 100 126 9109513 noise~;
#P comment 212 223 215 9109513 <- try moving the signum when audio is on;
#P connect 2 0 3 0;
#P connect 2 0 4 0;
#P connect 1 0 2 1;
#P window clipboard copycount 5;

for objects not supporting "enable 0", poly~ can be used as gate/switch to turn off a GUI object (with no signal outlet)

just make a poly~ patcher with an in~ 1 connected to an out~ 1 and t hen turn the poly patcher off.

Roman Thilenius's icon

other methods are
1. scripting the connection (thispatcher.maxhelp) - or
2. do this kind of weird stuff:

audio
[prepend foo]
[gate]
[route foo]
audio