Gradual Stretch Change between Pbindefs

Hello -

I’d like to do something relatively straightforward, but I’m not sure if there is a shortcut for doing it. I’d like to interpolate the stretch time between the following Pbindefs, when they are executed. Is there a convention for doing this?

	\dur, 0.3,
	\stretch, 1,

	\dur, 0.3,
	\stretch, 0.5,

I was thinking it might be possible to do something with Plazy, but the following requires re-executing the Pbindef and of course, the pattern doesn’t stay put after it finishes the adjustment.

~a = 0.9;

	\dur, 0.3,
	\stretch, Pn(Plazy(~a)),

~a = Pseq((0.9, 0.8..0.2), 1);


Not exactly answering your question but might want to have a look at the AlgaLib extension which focuses on interpolation.

Is the idea that every time you execute the Pbindef again, it uses a different stretch factor?
But over how much “executes” should this interpolation happen? The desired behavior is not entirely clear yet to me.

You could e.g. just generate a new Pbind every time you need one, e.g.

	var list_of_patterns = [];
	var pattern_maker = {
		| stretchtime |
			\degree, Pseq([1,2,3,2], 1),
			\duration, 0.3,
			\stretch, stretchtime,
	list_of_patterns = (0.9, 0.8..0.2).collect({
		| stretchtime|
	fork {
		// this wait statement is useful if calculating all the patterns takes a lot of time
		// to avoid that the first events are late
		wait(thisThread.clock.elapsedBeats -;