Issue with Pbind quantization when phase is larger then quant

Hello Everyone,

I’d like to make sure that ~pb01 always starts a bar of 7 beats later and ~pb02 always starts one bar of 7 beats + another 2.5 beats later.

It seems to me that in this example:

(
t = TempoClock(2);
p = Pbind(\legato, 0.1, \degree, Pseq((0..7),inf));
t.schedAbs(0,{|i| "beats: ".post;i.postln;1});
t.schedAbs(0,{|i| "       bar: ".post;i.postln;7});
t.schedAbs(2.5,{|i| "            +2.5".postln;7});
)
(
~pb01 = p.play(t,quant:7);
~pb02 = p.play(t,quant:[7,2.5]);
)
[~pb01,~pb02].do(_.stop);

There’s no guarantee that if I manually run ~pb01 and ~pb02 in one block, the desired delay will happen. Ie. if I manually run them both <2.5 beats after a 7 beat bar → ~pb02 won’t wait one bar + 2.5 beats. It will only be delayed 2.5 beats. However, if I happen to run them >2.5 beats after a 7 beat bar → the delay of ~pb02 will be as desired.

What I’m ultimately aiming for is to guarantee, that ~pb02 starts playing only after ~pb01 plays through the major scale up and then down + 2.5 beats:

(
t = TempoClock(2);
p = Pbind(\legato, 0.1, \degree, Pseq((0..7).mirror1,inf));
t.schedAbs(0,{|i| "beats: ".post;i.postln;1});
t.schedAbs(0,{|i| "       bar: ".post;i.postln;7});
t.schedAbs(2.5,{|i| "            +2.5".postln;7});
)
(
~pb01 = p.play(t,quant:7);
~pb02 = p.play(t,quant:[7,14+2.5]);
)
[~pb01,~pb02].do(_.stop);

Note:
1.) I would like to avoid defining the timingOffset parameter, because when calling .stop on a Pbind that has a timingOffset → it will stop the pattern that amount of beats later, which I don’t want, because when I call .stop on all Pbinds, I want them to stop at the same time.
2.) I’d also like to avoid Ptpar, because I’d like to access both Pbinds independently.

Can I solve this issue inside the .play(quant:[]) context?

Thank you,
cd

Seems to me there’s no way I can achieve this within the context of .play()

One of the simplest/most straightforward solutions seems to be placing this:

inside a routine and adding a .wait equivalent to the phase, to force ~pb02 to “wait” and entire up-and-down on the major scale by ~pb01 + 2.5 beats:

(
{
	t = TempoClock(2);
	p = Pbind(\legato, 0.1, \degree, Pseq((0..7).mirror1,inf));
	t.schedAbs(0,{|i| "beats: ".post;i.postln;1});
	t.schedAbs(0,{|i| "       bar: ".post;i.postln;7});
	t.schedAbs(2.5,{|i| "           +2.5".postln;7});
	~pb01 = p.play(t,quant:14);
	2.5.wait;
	~pb02 = p.play(t,quant:[14,2.5]);
}.fork;
)
{[~pb01,~pb02].do(_.stop);0.1.wait;t.stop;}.fork;

Yes, quant+phase is taken modulo quant: the earliest possible time that satisfies “some barline + phase,” not “the next barline + phase.”

If you want a consistent offset, I’d schedule the play calls very close to a barline (which is pretty much the solution you ended up with).

Edit: Or, begin the second pattern with a 2.5-beat rest, and schedule them both for the barline.

hjh