Helpful little function for "arranging" subpatterns within a larger context

Hi all!

I'm constantly finding myself in a position of wanting certain patterns to play longer and more complex "macrocycles", and wishing my patterns had a more "arranged" feel to them. It sort of strikes me that my patterns have too much of a repetitive feel (ya I know, even for someone of the "algorave generation"). Kidding aside, one of the things I identified that might be able to create this effect was to have some mechanism for playing a subpattern for a certain number of cycles, followed by another period of rest cycles, and if there was a way to offset this whole thing by a given number of cycles, all the better...

So I came up with this pretty simple little function that leverages whenmod and const $ s "~" to create exactly that effect:

playRest play rest skew ptrn = (skew ~>) $ whenmod (play + rest) play (const $ s "~") ptrn

It's pretty darned fun to work with. It makes it possible to make more arranged feeling patterns, and to have a little bit of counterpoint between different "voices" in the track.

I know you can accomplish a similar effect with seqPLoop (which is a way more hilarious name -- "seek ploop") but I feel like the syntax of my playRest function is a little simpler to work with.

As a demo I created this experiment. It's all superdirt so you should be able to run OOTB.

setcps 0.60

do
  let dr1 = degradeBy 0.2
        $ stack [
          s $ steps [
            ("jazz","0 0  34")
            ,("jazz","5")
            ,("jazz","    7 7")
            ,("procshort","    555")
          ]
          ,(# gain 0.85) . (# rel 0.05) $ s $ steps [("jazz", " 1 1    1 1 1 ")]
        ]
        # room 0.05
        # coarse (choose [6,1])
        --
      dr2 = struct "{<1 1*2> <0 1 1> <0 1> 0 0 0 0}%<14 7>" $ s "bd" # 2 # coarse 8 # gain 0.95 # speed 0.9
        --
      chrds = stut 5 0.1 (-3/14) $ degradeBy 0.4 $ stack [n "<df7'maj7 ef6'min7 bf6'maj af6'maj>!7"]
        # s "superhex" # gain 0.60 # room (choose [0.4, 0.1]) # size 0.6 # orbit 1 # release (choose [0.1, 0.4]) # accelerate (slow 12 $ range 0 0.06 $ sine)
        --
      chrds2 = degradeBy 0.4 $ ((1/14) ~>) $ n "bf6'min7*7" # s "superhex" # gain 0.5 # rel 0.3 # room 0.2
        --
      cymb = degradeBy 0.2 $ stut 3 0.2 (-1/14) $ struct "1(5,14)" $ s "dr"
        # n "[19 20]/1.5" # speed 1.0 # gain 0.64 # room 0.8 # rel 0.2 # orbit 2 # shape 0.4 # pan 0.9
        --
      casio = degradeBy 0.2 $ s "casio*14" # gain 0.48 # pan 0.2 # shape 0.4 # n "[0 1]/2"
        --
      bassy = ((2/7) <~) $ struct "1" $ s "jungbass" # n 1 # speed (1.1) # gain 1.0
        --
      hat = stut 12 0.9 (-3/14) $ s "[[electro1*2 electro1:7] ~@6]/4" # rel 0.3 # room 0.1 # cut 1 # pan 0.4 # gain 0.92
  d1
    $ (1 ~>) $ every 8 (within ((5/7),(7/7)) (# coarse 8))
    $ (3 ~>) $ every 8 (trunc (4/7))
    $ every 16 (stut 22 0.1 (-1/21) . trunc (1/21))
    $ stack [
      playRest 15 2 0 $ dr1
      ,playRest 5 5 0 $ dr2
      ,playRest 5 5 5 $ bassy
      ,playRest 16 32 0 $ chrds
      ,playRest 32 16 16 $ chrds2
      ,playRest 4 4 0 $ cymb
      ,playRest 4 4 4 $ hat
      ,playRest 3 3 0 $ casio
    ]

in particular, notice how 'chrds' and 'chrds2' are playing opposite each other, as are 'cymb' and 'hat'.

Thanks for checking this out :slight_smile:

8 Likes

And here is a link to a hydra jam with the above pattern, if you're interested:

https://www.instagram.com/p/CKXreFCDneg/?utm_source=ig_web_copy_link

This is super cool! From your instagram, I see you are in West Bath :dizzy_face: - I live in Bath, just up the road. I didn't think there was another tidalcyles user north of Boston.

1 Like

seriously?!? that is hilarious. we should get together in a post covid world. any interest in doing a tidalcycles hack night or similar sometime? really super nice to meet you, neighbor!

Yeah, been thinking of a music tech hack thing. Back in the day I used to run Music Hack days - I miss those times. I talked with one of the nice folks at Union and Co. pre-covid and they were up for something.

Also, I like to walk the loop at the Hamilton preserve. Perhaps we can do a safe-distance outdoor walk sometime. It'd be neat to actually talk to someone about generative music, tidalcycles and music tech on the midcoast. -- Paul

Yes, absolutely! I'll send you a DM with my contact info shortly. I know one of the union and co. guys. that could be a really cool idea to host a thing there. A buddy of mine and teacher at the highschool also has an after school robotics club. I was thinking about pitching a computer music club to him too, to get the younger folks interested in tidal, composition, synthesis, etc.

This is super nice! Thanks. Have had it bookmarked since you posted to try. Not sure I understand how the skew is working... Is late will try and wrap my head around it tomorrow. It also works with "ur" for added craziness. Yet another addition that means I have to rework my base template. It never ends :wink:

Hey.. Glad you like it!

The skew is just offsetting the whole shebang, so you can have a pattern "A" and "B" play opposite each other. For example, in the above code:
playRest 4 4 0 $ cymb
playRest 4 4 4 $ hat

both cymb and hat are playing for 4 cycles, then resting for 4. But because hat is offset by 4 cycles, you get: cymb x 4 followed by hat x 4. They never play on the same cycles this way.

I'm just getting into using 'ur' myself, and find it to be very flexible, offering a solution to pretty much the exact problem I set out to solve with 'playRest'. It might make my function unnecessary even. We shall see. Have an awesome day!

1 Like

Ah got it. That was what was throwing me was trying to see what effect it was having on a single pattern... silly me.

:+1::+1::+1:

ur can definitely achieve the same result but, with the limited play I have had and my relatively new knowledge of ur, your function adds an extra parameter/rule for all incoming patterns that can then be manipulated within/by ur.... I don't know. time for bed I think.

Cool example. Currently looking at and learning from it as a beginner. Thanks for posting that.

You are quite welcome!