# Using quant with the \setsrc NodeProxy role

I am using the \setsrc NodeProxy role in an Ndef, and I’m running into an unexpected behavior when I try to set the .quant of the Ndef. I expect the quant value to only determine the next time a new pattern will start after I change the Ndef (same behavior as Pdef). However, when I change quant, it is actually changing the delta time of the Pbind in the Ndef. Is this the correct behavior, is it a bug, or am I doing something wrong? Here is code to demonstrate (SC 3.11.2-rc1 on Raspberry Pi 4):

Ndef.clear;
Ndef(\ding, \setsrc -> Pbind(\delta, 1, \source, \default)).play;

// changing quant changes the delta time in the Pbind:
Ndef(\ding).quant = 2; // delta = 2

// changing quant to 0 goes back to the original delta in the Pbind:
Ndef(\ding).quant = 0; // delta = 1

// negative quant changes delta to (-4 * quant) huh???
Ndef(\ding).quant = -0.5; // delta = 2

// clear the Ndef and restart with a new pattern:
Ndef(\ding).clear;
Ndef(\ding, \setsrc -> Pbind(\delta, Pseq([1/2, 1], inf), \source, \default)).play;
// delta is still determined by quant


If this is correct behavior, then how do I set the quant so that, for example, I can start another Ndef pattern on the same down beat? I know I can just use regular Pbinds, but I would like to use the \setsrc NodeProxy role for a thing I’m working on.

Just happened to be on the computer…

As far as I can see, \setsrc is updating the source of one of the NodeProxy’s slots.

Updating the source is controlled by quant. When quant == 2, any source = ...something... will happen only on a multiple of 2 beats.

The pattern’s delta is not changing – you can see that by adding .trace:

Ndef(\ding, \setsrc -> Pbind(\delta, 1, \source, \default).trace).play;


At first, you might have assumed that the Pbind was playing the notes. That isn’t the case. The notes are happening because:

Ndef(\x).clear;

(
Ndef(\x).source = \default;
Ndef(\x).play;
)

Ndef(\x).source = \default;  // re-attacks!


This operation is controlled by quant.

I don’t know how to solve this. You may simply not be able to use \setsrc for rhythm and use quant for higher level control…?

hjh

1 Like

Thank you hjh, I guess I was expecting too much of \setsrc. I will look into workarounds for this tomorrow.