Newbie: what is the unit of .wait and can it be changed?

Line is a UGen, it only makes sense within a synth definition. What you need is a language-side solution.

Concerning your setup: probably it makes sense to look into Pspawner, which is a powerful pattern, designed to arrange sub-patterns, exactly the task you are going to achieve here.

And while James is right that you don’t need to make new tempo clocks for everything, keep in mind that adjusting the default tempo clock means, that all new patterns that you are playing without a specified TempoClock will take the adjusted default TempoClock, which can be very confusing. So IF you are going to change the tempo by manipulating a clock (you could do it in other ways) I’d recommend to take a dedicated new clock.

Example with Pspawner, suggested Pn as a more comfortable Pattern for repetition:

(
t = TempoClock(1);

p = Pspawner { |sp|	
	sp.seq(
		Pbind(
			\degree, Pn(0, 4),
			\dur, 0.2
		)
	);
	sp.wait(0.3);
	sp.seq(
		Pbind(
			\degree, Pn(2, 2),
			\dur, 0.2
		)
	);
	sp.wait(0.5);
	sp.seq(
		Pbind(
			\degree, Pn(3, 3),
			\dur, 0.2
		)
	);
}.play(t)
)

Concerning the tempo fade, you could do it by using one pattern changing the tempo clock of the other one. This solution is a bit lazy (here changing every 0.02 seconds), but practically it works. Note that Pseg is also a very useful Pattern, you can define curve types e.g. which is nice to find out convincing transitions.

(
TempoClock.default.tempo = 1;
t = TempoClock(1);

p = Pspawner { |sp| loop {
	sp.seq(
		Pbind(
			\degree, Pn(0, 4),
			\dur, 0.2
		)
	);
	sp.wait(0.3);
	sp.seq(
		Pbind(
			\degree, Pn(2, 2),
			\dur, 0.2
		)
	);
	sp.wait(0.5);
	sp.seq(
		Pbind(
			\degree, Pn(3, 3),
			\dur, 0.2
		)
	);
} };

q = Pbind(
	\dur, 0.02,
	\type, \rest,
	\newTempo, Pseg(Pseq([1, 1.5], inf), Pseq([5, 3, 2], inf)),
	\do, Pfunc { |ev| t.tempo = ev[\newTempo] }	
);
)

(
x = p.play(t);
y = q.play;
)

(
x.stop;
y.stop;
)

Besides you could do it also with multiplying durations with a factor, but this is probably less comfortable here, as the factor would have to be written at several places.

Other than that the tempo fade question has just been posed 5 days ago, and Simon has pointed to a worked-out soluion by Fredrik (which I haven’t tried yet):

https://swiki.hfbk-hamburg.de/MusicTechnology/763

1 Like