Conditionally silence pattern by notes?

Let’s say i have a pattern of notes:

d1 $ n “7 2 5 7 5 2 0 2” # sound “midi”.

Is there a way to conditionally silence or “mask” the notes that come out by specifying their note number?

For an example, using a list of allowed notes,

d1 $ maskN [0, 7] $ n “7 2 5 7 5 2 0 2” # sound “midi”

would yield the equivalent of
d1 $ n “7 ~ ~ 7 ~ ~ 0 ~ “ # sound “midi”

such that all notes not in the list [0, 7] are turned into rests.

Tidal offers cool ways to silence parts of patterns on the basis of time (like the function mask ). i’m not familiar with methods that use the values themselves, like note number.

I’m able to extract values from a pattern with queryArc but i’m having a hard time reassembling the pattern with rests.

1 Like

I think that fix could do this. I don't know about a list of allowed notes, but it would work with a list of prohibited notes. I haven't tested this, but you should be able to filter out note numbers 4,6, and 8 with:

fix (# silence) "[4,6,8]"

2 Likes

Thanks @crashingbooth ! yes fix is exactly what i’m looking for.

It’s working for me if I put (n “[2, 5]”) as the second argument of fix. :smiling_face_with_three_hearts:

Wow the function contrast-- more general version of fix-- is super fun for improvising. Having a blast changing octaves, using (# silence) and (id)

d2 $ fast 4 $ contrast (id) (|- n 24) (n "<0 5 7 2 5 7 2 5>") $ n "0 2 5 7 " # sound "midi" # midichan "1"

1 Like

Cool!

Also cool!

1 Like

Dang, it looks like fix and contrast don't work out-of-the-box with nTake.

With n it works fine:
d1 $ fast 4 $ contrast (|+ n 12) (|- n 12) (n "[0, 7]") $ n "<0 3 7 14>" # sound "midi"

but with nTake, it doesn't:
d1 $ fast 4 $ contrast (|+ n 12) (|- n 12) (n "[0, 7]") $ nTake "wish" [0, 3, 7, 14] # sound "midi"

Hmmmm. No idea why (n "[0,7]") isn't matching the notes selected by nTake. I am on Tidal version 1.7.2. I wonder if there's a workaround.