Patch too heavy?

Hi everyone,
I’m working on a sound installation, which consists of a (long) loop in supercollider.
Sometimes I have to repeat myself 3 or 4 times to get the code to work, but once it is launched it works fine, without error message.
The whole patch is about 1200 lines long (the loop itself 200 lines + about 20 synthDef, and maybe 80 audio files). The loop looks like that:

(
Routine.new{({
	~blabla1.play; 
	rrand(25,35).wait;
	~blabla2.play;
	rrand(25,35).wait;
	~blabla3.play;
	rrand(20,30).wait;
}).loop;
}.play;
)

How can I solve this problem? Do I need to change the memory size? (something like p = ServerOptions.new; p.memSize = 4096*???)

Can you share the code? It’s a bit difficult to pin down the issue otherwise. How long are your audio files? Also check to make sure you aren’t reallocating more buffers every time you evaluate with the same audio files or it’s going to lead to some headaches.

I like to put

s.freeAllBuffers

at the beginning of my code (before their allocation) if I’m working with buffers just so I don’t accidentally accumulate the same ones every time I evaluate.

But that may not even be the issue…

Josiah

1 Like

Yes, I already have the “freeAllBuffers” at the beginning of my code.

50 audio files are 1-2 min long, the 30 others are quite shorts (a few seconds)

1 Like

If you have to repeat it 3-4 tunes, offhand it sounds like a sync problem (trying to use a resource before it’s fully loaded).

But that really will be impossible to troubleshoot without some code. Trying to figure this out from feeling around descriptions of the code is unlikely to be successful.

Btw memSize is only for the real time memory pool. Buffers don’t use the real time pool, so memSize is irrelevant for Buffers.

hjh

1 Like

Yes, it turns out that I wasn’t waiting long enough between the execution of my “set up code” and my loop. If I wait a few more seconds, everything works fine!

1 Like

Ah! FWIW I like to add

s.sync;
"done".postln;

as a conveniece if there’s a lot to do in the setup :slight_smile:

Cheers,
Josiah

1 Like