TidalCycles trunc cuts a pattern short while linger repeats the kept fraction to fill the cycle
trunc x p plays only the first fraction x of pattern p and silences the rest. linger x p also takes only the first fraction x but then repeats that portion to fill the remaining cycle time. With linger 0.25 $ n "0 2 [3 4] 2" # sound "arpy", only the first quarter of the pattern plays, then loops four times — creating a one-note drone from whatever event falls in that first quarter. Both functions accept patterns for x, enabling dynamic truncation across cycles (e.g., "<0.75 0.25 1>"). linger is particularly useful for looping a sample slice or a single chord to fill a break.
Examples
d1 $ trunc 0.75 $ sound "bd sn*2 cp hh*4" -- plays first 3/4
d1 $ linger 0.25 $ n "0 2 [3 4] 2" # sound "arpy" -- loops first 1/4
d1 $ every 4 (linger 0.25) $ n "0 2 [3 4] 2" # sound "arpy" -- linger every 4
Assessment
Explain the audible difference between trunc 0.5 $ s "bd hh sn hh" and linger 0.5 $ s "bd hh sn hh". What would linger "<0.25 0.5 1>" do over three cycles?