17.2. Cycle-space time primitives: TimeSpan, Hap, and cycle helpers

Module strudel_time

17.2.1. Structures

TimeSpan
Fields:
  • start : double - Inclusive start position in cycles.

  • stop : double - Exclusive end position in cycles.

Hap
Fields:
  • whole : TimeSpan - Ideal full span of the event (full note duration).

  • part : TimeSpan - Portion of whole visible in the current query window.

  • has_whole : bool = true - False for continuous events that have no discrete onset (e.g. signals).

  • value : Event - The event payload (what to play and how).

17.2.2. Cycle math

cyclePos(t: double): double

Fractional position within the current cycle (0.0–1.0).

Arguments:
  • t : double

sameCycle(t: double): double

Cycle number containing time position t (integer part as double).

Arguments:
  • t : double

splitSpans(span: TimeSpan): array<TimeSpan>

Split a time span at integer cycle boundaries. Example: splitSpans(TimeSpan(0.75, 2.25)) returns [(0.75,1.0), (1.0,2.0), (2.0,2.25)].

Arguments: