Back to Pattern Factory

Cyclic iteration · Step sequencers

Music Beats

Sequence a 16-step beat. The cyclic loop that drives every sequencer.

Modern music software is built on the same 16-step grid you're playing with here. The pattern loops; each step either triggers a sound or doesn't. The underlying data structure — a fixed-length array iterated cyclically — is the same one driving traffic-light controllers, animation timelines, and game-loop tick handlers.

What’s happening under the hood

  • Fixed-length array of booleans, one per step. Iterator advances modulo array length — when it hits the end, it wraps back to 0.
  • The same primitive runs at radically different scales: 60 Hz for game loops, 44,100 Hz for audio samples, 4 Hz for trance hi-hats.
  • Time-keeping at audio-rate is a hard real-time problem: missing a tick by 5ms is audible. Audio engines run on dedicated threads to avoid garbage-collection pauses.

Dig deeper

Phase 1 · Control Flow

The concept you just explored is taught with full depth in the formal DURA curriculum.