home/ atoms/ strudel-hap-onset-whole-part

A Strudel Hap has an onset when its whole timespan begins at the same time as its part timespan

A Hap (event) carries two timespans. The whole span is the event’s full logical duration; the part span is the fragment that actually falls inside the queried window, which can be a strict subset of whole when a query cuts into a longer event. A Hap has an onset precisely when its whole timespan begins at the same time as its part timespan — i.e. the query window catches the moment the event starts. onsetsOnly() keeps only haps that have an onset, dropping fragments whose start was already before the window. discreteOnly() keeps only haps that have a whole timespan, removing continuous (unsegmented) signal haps. Distinguishing onset-haps from mere fragments matters when writing combinators that should fire only on note starts.

Examples

pattern.onsetsOnly() // keep only haps whose event begins in the window pattern.discreteOnly() // drop continuous (whole-less) haps

Assessment

Query a 1-cycle event starting at 0 with queryArc(0.25, 0.75). Describe whole and part for the returned Hap, and state whether it has an onset and why.

“A hap with an onset is one with a `whole` timespan that begins at the same time as its `part` timespan.”
corpus · strudel-internals-pattern-as-function-of-time-functor-applic · chunk 1