TidalCycles mask gates a pattern with a boolean mask, letting events through only where the mask is true
mask boolPat p filters the events of pattern p, letting through only those events that coincide with a true (1) position in the boolean pattern boolPat. Unlike struct, which imposes a new structure, mask preserves the existing structure of p and silences events where the mask is false. This is equivalent to adding explicit rests at specific positions but expressed as a reusable mask. The mask pattern and the source pattern are separate, making it easy to swap out the rhythm or the mask independently. Common use: applying a rhythmic gate to a dense pattern to create space, or switching between two masks for variation.
Examples
d1 $ mask "t t t ~ t t ~ t"
$ s (cat ["sn*8", "[cp*4 bd*4, bass*5]"])
# n (run 8)
d1 $ mask "1 ~ 1 ~ 1 1 ~ 1"
$ s (cat ["can*8", "[cp*4 sn*4, jvbass*16]"])
# n (run 8)
Assessment
Explain the difference between struct "t ~ t ~ t t ~ t" p and mask "t ~ t ~ t t ~ t" p. When would you use mask rather than writing rests directly into the pattern? How could you use mask to create a ‘stutter’ effect on specific beats?