Every/FoldEvery confusion?

Greetings, everyone, I’m new to the community, how’s everybody doing?

Anyway, here’s the scoop:
I’m composing a track and my idea for a certain part is to have a pattern play every first and fourth cycIes. I understand that muting it for every 2nd and 3rd cycIes is easier, so I’m using Kindohm’s shorthand function “gtfo” for that, which is the same as attributing a siIent note to a const function.
What happens is that , both using foldEvery [2,3] as well as every (2) and then every (3),the second is muted as it should, but then it plays for the next one and then the fourth is muted. I Imagine it is understanding the fourth cycle as a second cycle again but I can’t understand what it is doing to the thid one or think of a way of working around it. It is an euclidean sequence with angle brackets on the third parameter and I’m using randomness both with degradeBy as well as with a sometimesBy applied to a stutter, so I don’t think the results would be satisfatory if i created a longer pattern and applied a slow to it or something, but I may try something like that. I just think this thread must be useful so we can understand a bit about how tidalcycles “thinks”

Thank you everyone.

Note to readers: The L key on my keyboard is broken and I’ve developed the habit of using hypercase I’s for my lowercase L’s to avoid using the virtual keyboard that much.
I tried avoiding that in this thread for search-result optmization but I must have slipped sometimes, I’m sorry.

Maybe you should post snippets of your code, this will be more clear to understand :slightly_smiling_face:

Yikes I’m not sure how I missed this question!

@oloide if you are able to post your code, that would be easiest. Otherwise I kind of have to guess what you are going for.

It sounds like you want a higher-level pattern that occurs over four cycles:

cycle 1: pattern plays
cycle 2: pattern does not play
cycle 3: pattern does not play
cycle 4: pattern plays

I think the easiest to do this is with cat:

let myPattern = s "bd(3,8)"
let nothing = s "~"

d1 $ cat [ myPattern, nothing, nothing, myPattern ]

Another way is with whenmod:

d1 $ whenmod 4 2 gtfo $ s "bd(3,8)"

The trouble (or joy?) with foldEvery is that the logic cascades and layers on itself. So if you do foldEvery [2,3] gtfo you are muting the sequence every 2nd cycle AND every 3rd cycle simultaneously. Any time every 2 or every 3 is true, gtfo will be called:

cycle   | every 2 | every 3 | result
1       | true    | true    | gtfo
2       | false   | false   | -
3       | true    | false   | gtfo
4       | false   | true    | gtfo
5       | true    | false   | gtfo
6       | false   | false   | -
7       | true    | true    | gtfo
8       | false   | false   | -
9       | true    | false   | gtfo
1 Like

You could also do d1 $ mask "<t f f t>" $ s "bd(3,8)

1 Like