Skip to content
This repository has been archived by the owner on Jul 10, 2019. It is now read-only.

Latest commit

 

History

History
42 lines (29 loc) · 1.17 KB

File metadata and controls

42 lines (29 loc) · 1.17 KB
title category
mask
conditional
mask :: Pattern a -> Pattern b -> Pattern b

Removes events from second pattern that don't start during an event from first.

Consider this, kind of messy rhythm without any rests.

d1 $ sound (slowcat ["sn*8", "[cp*4 bd*4, hc*5]"]) # n (run 8)

{: .render }

If we apply a mask to it

d1 $ s (mask ("1 1 1 ~ 1 1 ~ 1" :: Pattern Bool)
  (slowcat ["sn*8", "[cp*4 bd*4, bass*5]"] ))
  # n (run 8) 

{: .render }

Due to the use of slowcat here, the same mask is first applied to "sn*8" and in the next cycle to `"[cp4 bd4, hc*5]".

You could achieve the same effect by adding rests within the slowcat patterns, but mask allows you to do this more easily. It kind of keeps the rhythmic structure and you can change the used samples independently, e.g.

d1 $ s (mask ("1 ~ 1 ~ 1 1 ~ 1" :: Pattern Bool)
  (slowcat ["can*8", "[cp*4 sn*4, jvbass*16]"] ))
  # n (run 8) 

{: .render }

Detail: It is currently needed to explicitly tell Tidal that the mask itself is a Pattern Bool as it cannot infer this by itself, otherwise it will complain as it does not know how to interpret your input.