"Time-based patterns" here are value patterns that use time as part of their calculation. Event patterns are naturally time-driven when played on a clock. (Technically it's possible to request events from an event stream without running it in an EventStreamPlayer, but this is not typical usage.)
Most of these patterns work by remembering the clock's current time at the moment the pattern is embedded into a value stream. The time value used for calculation is, then, the clock's time at the moment of evaluation minus the starting time -- that is, the number of beats elapsed since the patterns started embedding. If the pattern is embedded several times, the starting time is also reset so that the pattern begins again from the beginning.
There is nothing to prevent using these patterns outside of a scheduling context. In these documents, that context would be an event pattern played on a clock, but streams made from these patterns can be used in scheduled routines or functions as well. Only a scheduling context can ensure precise timing of requests for values.
This Pif pattern uses Ptime to get values from the true branch for exactly 4 beats after the first value is requested. After that, the condition will be false and Pif reverts to the false branch, which is nil. That causes the stream to stop. (This is like Pfindur for event patterns, but Pif/Ptime works for value patterns as well.)
Pstep(levels, durs, repeats)
level value for its corresponding duration, then move to the next.
Pseg(levels, durs, curves, repeats)
curves should be patterns.
Env supports the stream protocol:
asStream turns an Env into a stream, and timed values can be obtained from it using
next. The envelope stream returns the value the envelope would have at the elapsed time, in the same way
.at(time) returns the envelope value at the specified time.
loopNode envelope parameters do not take effect, because they are meaningful only when used in a Synth with a gated EnvGen.
When the envelope ends, the stream will hold the final level indefinitely. The
Pif(Ptime(inf) < totalTime, Env(...)) trick can make it stop instead.