Recording SC: using the same sample multiple times

Oh - ok this is a subtle one. If you evaluate
s.plotTree
you will see a window showing you the order of synth nodes on the server. By default the only node is the default group number 1. Evaluate one of your “/s_new” messages and you will see the new synth node you have made appear after the default group. When you evaluate s.record, you will see the recording synth also appear after the default group. Which one is first in the order of execution depends on which one you evaluated first, this is why you are getting unpredictable behavior.

It’s better practice to put all your synthesis inside the default group, then the record synth will always come last. If you change the fifth item in your OSC array from 0 to 1, you will see the synth appear inside of the default group, because you are setting the target to group #1.

But, I also recommend using the Synth abstraction rather than sending OSC messages directly to the server, unless you have a good reason for doing so. Makes confusion like this easier to avoid. A clearer way of writing this, IMO, is:

s.record;

x = Synth("help-LoopBuf", [\bufnum, b.bufnum, \startPos, 10000, \startLoop, 80000, \endLoop, 5000000]);
x.set(\rate, -0.6);
x.free; // stop the synth

y = Synth("help-LoopBuf", [\bufnum, b.bufnum, \startPos, 10000, \startLoop, 80000, \endLoop, 5000000]);
y.set(\rate, -0.6);
y.free;

s.stopRecording;

This way the recording synth will always come last and you don’t have to worry about targets or groups until you really need to.

1 Like