How a line-drawing algorithm creates evenly spaced beats: draw a diagonal, snap its intersections to a grid, then hear the pattern.
The yellow line is continuous; green grid columns are its discrete, evenly distributed rhythmic hits. Shift the line with rndPt.
Green blocks mark the Euclidean hits; the white cursor follows playback. An optional kick marks the bar’s downbeat at step 0.
Think of rasterising a diagonal, as in a grid-based line-drawing algorithm. The ideal hit positions lie at x = i × tupDen / tupNum + rndPt. Taking the floor maps these continuous positions to grid columns; wrapping them around the bar gives a repeating rhythm. With tupNum ≤ tupDen and timeRes = 1, this produces a rotation of a maximally even Euclidean rhythm. rndPt slides the line horizontally (0 to tupDen is one full cycle). Larger timeRes values explore coarser quantisation, which can break perfect evenness.
Drum samples: Michael Fischer’s TR-808 recordings, CC0 public domain. The app loads them when online and uses its own percussion synthesis if offline. Runs directly as an HTML file.