Quant Adjustments in Pattern

Hi -
I am using Quant on some Pbindefs. It doesn’t seem that I am able to change the Quant information while the Pbindef is playing, though.

Is there a bit of code I am missing here?

(
SynthDef(\lowClick, {
	Out.ar(0, EnvGen.ar(Env.perc(0.01, 0.2), doneAction:2)*Blip.ar(20, 40))}).add;

SynthDef(\hiClick, {
	Out.ar(0, EnvGen.ar(Env.perc(0.01, 0.2), doneAction:2)*Blip.ar(10, 180))}).add;
)

Pbindef(\a,
	\instrument, \lowClick,
	\dur, 1/4).play(quant: [1, 0]);

Pbindef(\b,
	\instrument, \hiClick,
	\dur, 1/4).play(quant: [1, 2]);


///////change the quants.
Pbindef(\a,
	\instrument, \lowClick,
	\dur, 1/4).play(quant: [0.5, 0]);

Pbindef(\b,
	\instrument, \hiClick,
	\dur, 1/4).play(quant: [0.3, 1]);


I think it is supposed that you change p = Pbindef(…); p.playQuant = …, and then call Pbind(\a, …) without calling play again, maybe you are using it like it was Pbindf (without “de”)?

I’m sorry - I don’t understand this response. Can you explain this a little more?

It would be helpful to be precise about the behavior you expect.

Quant is used at the time of starting the pattern, to determine the time of the first event.

Quant is not used for the timing of later events. After that initial onset, timing is completely determined by the pattern’s delta values.

So if you set quant while the pattern is playing, then it’s expected that the timing will not change at that moment (because quant is irrelevant at that moment).

To change the timing means that the thread is already scheduled to wake up at a specific time and then rescheduled to wake up at a different time. You might think this is easy, but it isn’t. Actually it would be possible to implement in Pdef / Pbindef but I think it isn’t currently implemented.

hjh

The other day I checked the code for Pbindef and Pbindf because people use them for the same purpose but I don’t quite get how.

Pbindef is part of the JITlib, it uses a proxy space that is always playing, at least virtually, so when your code is evaluated:

// first call

Pbindef(\a,
\instrument, \lowClick,
\dur, 1/4).play(quant: [1, 0]);

// seconds call

Pbindef(\a,
\instrument, \lowClick,
\dur, 1/4).play(quant: [0.5, 0]);

I notice it’s calling play twice for the second call. From the documentation, the first Pbindef object creates the proxy space at the symbol \a and later calls don’t have to call play:

Pbindef(\a).trace.play;
Pbindef(\a, \degree, Pseq([1, 2, 3], inf)); // .play shouldn't be called here

In fact, calling play a second time for the same symbol will be ignored internally and the quant parameter will not take effect because it will be using playQuant property from Pbindef, so the solution could be to keep a reference to the original Pbindef and set the property

p = Pbindef(\a, \degree, Pseq([0, 0, 0, 0]));
p.playQuant = 4;
p.trace.play;

Pbindef(\a, \degree, Pseq([1, 2, 3], inf));
p.playQuant = 3

Pbindef(\a, \degree, Pseq([10, 20, 30], inf));

That seems to work, but I’m not sure it is working as I would expect, I might probably be missing something.

Similar but different is Pbindf which is a filter pattern and receives an event pattern as the first argument:

a = Pbind(\x, Pseq([1, 2, 3]), \z, 9000); // input stream, the original
b = Pbindf(a, \y, Prand([100, 300, 200], inf), \z, 99).play; // filter and play

I this case, I guess, people use it with stop and play like in the following example (I’m guessing because I don’t know):

a = Pbind(\x, Pseq([1, 2, 3], inf), \z, 9); // input stream, the original

(
// filter and play
b = Pbindf(a, \y, Prand([10, 30, 20], inf), \z, 90).trace.play(quant:1);
)

(
// stop, filter and play again.
b.stop;
b = Pbindf(a, \y, Prand([100, 300, 200], inf), \z, 900).trace.play(quant: 1);
)

In this later case quant works with play.

I’m sorry I can’t give more details, I don’t have them.