programmatically adding latency

d.'s icon

Is it possible to detect cpu %usage and add program latency when the usage goes above a threshold?

Hans Höglund's icon

What do you mean by latency? In the scheduler or in signals? Please clarify.

Roman Thilenius's icon

it might be risky to implement an automatic mechanism for that, but it
is definetly possible.

you will find out which two objects you will need by simply unlocking
the DSP preferences patch, it is all in there.

-110

Roman Thilenius's icon

depending on your audio hardware it can be more safe to turn audio off before changing
the buffer setting.

d.'s icon

Thanks. I was out for the weekend, but I'm back. How can I unlock the DSP preferences patch? Are you referring to the DSPstatus.maxpat file in the interfaces folder in max (5 BTW)? I can't get that patch to go out of presentation mode.

pid's icon

@d:

right click the window
choose 'Edit'
hold down cmd (mac) / ctrl (win) and click on the 'View' toggle
magic...
copy anything you need...

jml's icon

i agree with roman here.
you could compromise the entire stability of the system by dynamically changing such settings.

i would recommend finding the worst case scenario and setting the patch accordingly upon init.

otherwise, you've got some troubleshooting and cleanup in store for your patch. :)

jml

Hans Höglund's icon

Concerning vector size I agree with previous posters, you don't want to change this in a running patch.

It is possible to change sampling rate though, by encapsulating parts of your patch inside a poly~ and sending up/down.

Hans Höglund's icon

Oops, found out you can actually change vector size inside poly~ as well, using the vs message (see docs).