Hello
As per my knowledge, this editing the source code to increase this limit might be possible, but it’s complex. You could also try optimizing your code or splitting it into smaller sections to avoid hitting the limit.
@Wako - the CPU usage isn’t the culprit here, but the size of the SynthDef that function:scope is creating to run it.
The way to optimize this is to break the code into smaller chunks as SynthDefs if possible - I have to say, that won’t necessarily be easy. The approach you are using was supported in SC2 because Spawn was used for adding to the processing graph, but with SC Server, the architecture really gives that control more over to you.
I don’t think changing the source code is the way to go. SC Server isn’t really made to be optimized for the way you are working with it. The Function:scope method was really made for limited backwards compatibility and for testing small chunks of code - I’d recommend avoiding it. Understanding how this is all working under the hood a little more is probably going to be the thing that gets you where you need to be.
BUT… you’re relying on a convenience method to create a big SynthDef for you.
Convenience methods are not guaranteed to handle every case. Once you “grow up” in your SC usage, it’s time to learn what they are doing for you and take the reins for yourself.
You can.load big SynthDefs that are impossible to .send.
So, if you really prefer the working method of giant synthdefs, write e.g.
fork {
SynthDef(\myBigDef, {
... hundreds of lines of ugens...
}).load;
s.sync;
x = Synth(\myBigDef);
};
… and use s.scope, not {}.scope.
Modularizing into smaller synths is better, but if you really strongly dislike that idea, you can get around the UDP limit by not sending the big def over UDP at all – use a disk file instead (.load).
I tried your solution on my current script where i reached the limit, and it works just fine. This solved my problem, without the need to change my dirty way of writing code. Thanks a lot!
(I do much additive synthesis, sometimes with loops inside loops, there i easy reached the maximum allowed size also with small amounts of code, which is difficult to break in parts)