Repeating items in a cat?

Currently working my way through a boom-bap style beat and I want to have the first bit repeat 3x and then the last bit play once - it makes sense to do this through a cat since they come one after another, but it seems like there should be some shorthand to replay the first stack 3x without having to copy paste. Is there currently a way to do this ?

The pattern in question:

d1 $ cat [
    stack [
        sound "bd:1 bd:1 cpu:2 ~",
        --sound "~ ~ ~ dbass:1" # speed "0.6" # gain 0.5 # cut 2,
        sound "~ ~ ~  ~ ~ ~  ~ ~ ~  ~ ~ bd:1",
        sound "~ claus ~ foley:2" # gain 0.4,
        --swingBy (1/3) 4 $ sound "hh:7*4" # speed "0.5" # hcutoff "7000" # gain "1.3" # gain sine,
        sound "~"
    ],
    stack [
        sound "bd:1 bd:1 cpu:2 ~",
        --sound "~ ~ ~ dbass:1" # speed "0.6" # gain 0.5 # cut 2,
        sound "~ ~ ~  ~ ~ ~  ~ ~ ~  ~ ~ bd:1",
        sound "~ claus ~ foley:2" # gain 0.4,
        --swingBy (1/3) 4 $ sound "hh:7*4" # speed "0.5" # hcutoff "7000" # gain "1.3" # gain sine,
        sound "~"
    ],
    stack [
        sound "bd:1 bd:1 cpu:2 ~",
        --sound "~ ~ ~ dbass:1" # speed "0.6" # gain 0.5 # cut 2,
        sound "~ ~ ~  ~ ~ ~  ~ ~ ~  ~ ~ bd:1",
        sound "~ claus ~ foley:2" # gain 0.4,
        --swingBy (1/3) 4 $ sound "hh:7*4" # speed "0.5" # hcutoff "7000" # gain "1.3" # gain sine,
        sound "~"
    ],
    stack [
        sound "bd:1 ~ [cpu:2!2 cpu:3] ~",
        sound "~ ~ ~ dbass:1" # speed "0.5" # gain 0.5 # cut 2,
        sound "~ ~ ~  ~ ~ ~  ~ ~ ~  ~ ~ bd:1",
        sound "~ claus ~ foley:2" # gain 0.4,
        --swingBy (1/3) 4 $ sound "hh:7*4" # speed "0.5" # hcutoff "7000" # gain "1.3" # gain sine,
        sound "~"
    ]]

Hey !

I'd use let to pre-define the 2 patterns variations, to sequence them as wanted with cat. Super convenient when you feel like you'll re-use sequences / patterns / functions etc...

do
  let
    pat1 = stack [
        sound "bd:1 bd:1 cpu:2 ~",
        --sound "~ ~ ~ dbass:1" # speed "0.6" # gain 0.5 # cut 2,
        sound "~ ~ ~  ~ ~ ~  ~ ~ ~  ~ ~ bd:1",
        sound "~ claus ~ foley:2" # gain 0.4,
        --swingBy (1/3) 4 $ sound "hh:7*4" # speed "0.5" # hcutoff "7000" # gain "1.3" # gain sine,
        sound "~"
      ]
    pat2 = stack [
        sound "bd:1 ~ [cpu:2!2 cpu:3] ~",
        sound "~ ~ ~ dbass:1" # speed "0.5" # gain 0.5 # cut 2,
        sound "~ ~ ~  ~ ~ ~  ~ ~ ~  ~ ~ bd:1",
        sound "~ claus ~ foley:2" # gain 0.4,
        --swingBy (1/3) 4 $ sound "hh:7*4" # speed "0.5" # hcutoff "7000" # gain "1.3" # gain sine,
        sound "~"
      ]
  d1 $ cat [pat1, pat1, pat1, pat2]
1 Like

ah! That makes sense. Thanks! But no way to repeat within the cat ?

Bc I can imagine it'll get unweildy if I start to have patterns of patterns that are 16 cycles long.

d1 $ cat [pat1*3, pat2] might work ? Not sure though.

1 Like

Use "ur" for global composition https://tidalcycles.org/index.php/ur

This message (and discussion) mentions some alternatives https://github.com/tidalcycles/Tidal/issues/654#issuecomment-632370332

2 Likes

@jwaldmann bingo! That looks like the ticket.

seqP is another one that could be handy for this.

2 Likes

Wow, ur looks like fun...how have I not seen this!