home/ atoms/ sardine-player-pattern-syntax

Sardine Players (Pa–PZ) are the core scheduling unit: each holds a looping pattern that runs against the global clock

Sardine exposes 48 player objects (Pa through PZ) as the basic building block for patterns. A player is assigned a sender function and pattern string using * or >> syntax: Pa * d(‘bd cp’) launches a looping drum pattern. The pattern argument is a string that unfolds over time — whitespace separates elements, periods are rests, and suffixes like !2 repeat elements. The period parameter p controls rhythmic speed in beats (p=0.5 fires twice per beat). All players synchronize to the same global clock, so complex multi-voice arrangements stay in time automatically.

Examples

Pa * d(‘bd cp hh’, p=‘0.5!3 1’) — alternating hi-hat subdivisions on a single player. Pa >> d(‘bd’) runs the pattern until silence(Pa) or Pa.stop().

Assessment

Write a two-player Sardine pattern where Pa plays a kick on beats 1 and 3 and Pb plays a snare on beats 2 and 4 at 120 BPM.

“The Player is the most basic way to create patterns - it uses a shorthand syntax, and uses patterns and arguments to make musical output.”