when package:tidal

The given pattern transformation is applied only when the given test function returns True. The test function will be called with the current cycle as a number.
d1 $ when (elem '4' . show)
(striate 4)
$ sound "hh hc"
The above will only apply striate 4 to the pattern if the current cycle number contains the number 4. So the fourth cycle will be striated and the fourteenth and so on. Expect lots of striates after cycle number 399.
Like when, but works on continuous time values rather than cycle numbers. The following will apply # speed 2 only when the remainder of the current Time divided by 2 is less than 0.5:
d1 $ whenT ((< 0.5) . (flip Data.Fixed.mod' 2))
(# speed 2)
$ sound "hh(4,8) hc(3,8)"
whenmod has a similar form and behavior to every, but requires an additional number. It applies the function to the pattern when the remainder of the current loop number divided by the first parameter is greater or equal than the second parameter. For example, the following makes every other block of four loops twice as dense:
d1 $ whenmod 8 4 (density 2) (sound "bd sn kurt")