# Concatenating polyrhythmic sequences

**URL:** <https://uzu.lurk.org/t/concatenating-polyrhythmic-sequences/4795>\
**Category:** TidalCycles\
**Tags:** questions\
**Created:** [21 July 2023 10:04 UTC](https://uzu.lurk.org/t/concatenating-polyrhythmic-sequences/4795 "2023-07-21T10:04:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jobi](https://uzu.lurk.org/user_avatar/uzu.lurk.org/jobi/32/2641_2.png) [@jobi](https://uzu.lurk.org/u/jobi)\
**Post date:** [21 July 2023 10:04 UTC](https://uzu.lurk.org/t/concatenating-polyrhythmic-sequences/4795/1 "2023-07-21T10:04:09Z")

</div>

I'm playing with making polyrhythmic sequences by concatenating smaller rhythmic patterns. For example, if I define `cellA` and `cellB`, and I want to make `structure` as follows:

```haskell
let
  cellA = "1!3 ~ 1!6 ~ 1!12 ~ 1!9 ~"
  cellB = "1!3 ~ 1!6 ~ 1!21 ~ 1!12 ~ 1!9"
--structure = 2 x cellA, 1 x cellB, all wrapped to 16th notes
-- = "{1!3 ~ 1!6 ~ 1!12 ~ 1!9 ~ 1!3 ~ 1!6 ~ 1!12 ~ 1!9 ~ 1!3 ~ 1!6 ~ 1!21 ~ 1!12 ~ 1!9}%16"

```

What's the best way to do that?

I have tried playing around with `cat` and `concat` but I haven't found a solution yet.

---

<div class="post-metadata">

**Author:** ![archaic.tech](https://uzu.lurk.org/user_avatar/uzu.lurk.org/archaic.tech/32/2965_2.png) [@archaic.tech](https://uzu.lurk.org/u/archaic.tech)\
**Post date:** [24 July 2023 16:10 UTC](https://uzu.lurk.org/t/concatenating-polyrhythmic-sequences/4795/2 "2023-07-24T16:10:59Z")

</div>

I’m sorry to say that this is something that Tidal currently isn’t very good at—in fact, solving this problem is the main motivation for a current rewrite of Tidal’s core.

Until that happens, the best method is probably using `timeCat`? That would require that you manually specify the number of steps that each pattern contains, but then it would allow you to concatenate patterns of different lengths.

---

<div class="post-metadata">

**Author:** ![jobi](https://uzu.lurk.org/user_avatar/uzu.lurk.org/jobi/32/2641_2.png) [@jobi](https://uzu.lurk.org/u/jobi)\
**Post date:** [25 July 2023 08:51 UTC](https://uzu.lurk.org/t/concatenating-polyrhythmic-sequences/4795/3 "2023-07-25T08:51:46Z")

</div>

Thanks for the reply @archaic.tech! I think you're right: so far `timeCat` looks like the best approximation. I'll need to practice my onstage arithmetic 😉

The other approach I was considering was using Haskell's base `concat` function to make a string that looks right and then turn this into a pattern. E.g.

```haskell
let structure = concat (["{"] ++ replicate 2 cellA ++ [cellB] ++ ["}%16"])

```

How can I convert `structure` (a `[Char]`) to a `Pattern Bool`?

---

<div class="post-metadata">

**Author:** ![staxl](https://uzu.lurk.org/user_avatar/uzu.lurk.org/staxl/32/1717_2.png) [@staxl](https://uzu.lurk.org/u/staxl)\
**Post date:** [25 July 2023 12:12 UTC](https://uzu.lurk.org/t/concatenating-polyrhythmic-sequences/4795/4 "2023-07-25T12:12:30Z")

</div>

Thanks for the insight! Curious to see how this is gonna get implemented in TC eventually.

---

<div class="post-metadata">

**Author:** ![archaic.tech](https://uzu.lurk.org/user_avatar/uzu.lurk.org/archaic.tech/32/2965_2.png) [@archaic.tech](https://uzu.lurk.org/u/archaic.tech)\
**Post date:** [25 July 2023 13:33 UTC](https://uzu.lurk.org/t/concatenating-polyrhythmic-sequences/4795/5 "2023-07-25T13:33:25Z")

</div>

You're totally right that concatenating mininotation strings is probably the simplest approach for this. In that case, you'll want to pass your string into `parseBP_E` (the underlying function that Tidal uses for parsing mininotation).

Also, for @staxl and anyone else who's curious: [yaxu's blog post](https://slab.org/2023/05/13/tidal-2-0-beatmode-tidalcycles-vs-tidalbeats/) is probably the most recent complete-ish explanation, but you can also find bits of discussion in [this thread](https://club.tidalcycles.org/t/tidal-2-0/4247), plus on the Discord innards channel, etc.
