Time-aware merging of two Event Pattern streams

Hey, just revisiting this a while later. I ended up using your implementation vs mine, as it handles some of the edge cases a bit better, and the implementation is a little more straightforward. I made one change that you might be interested in:

nextValueEvent = valueStream.next(inevent);

becomes:

nextValueEvent = valueStream.next(cumulativeEvent.copy);

This allows downstream patterns to compose all the way up through the chain:

PtimeChain(
	Pbind(
		\c, Pkey(\a) + Pkey(\b)
	),
	Pbind(\a, Pseries(0, 0.1), \dur, 1),
	Pbind(\b, Pseries(0, 2), \dur, 2)
).asStream.nextN(10, ()).do(_.postln)
1 Like