A useful pattern that doesn't have a class: Pkey(\dur).integrate (like Ptime but doesn't "keep running" for paused streams)

Actually there is a class for it: Pseries.

It’s often assumed that Pseries’s step should be a constant, but that isn’t the case. If it’s a pattern, then it behaves as an integrator.

There’s a slight difference: .integrate returns the values after adding each value, while Pseries returns the value before adding (starting at an arbitrary value that you specify). For the use case stated at the top of this thread, Pseries(0, Pkey(\dur), inf) is probably a bit better.

hjh

1 Like