# Using eucliean notation inside curly braces

**URL:** <https://uzu.lurk.org/t/using-eucliean-notation-inside-curly-braces/1304>\
**Category:** TidalCycles\
**Tags:** questions\
**Created:** [1 June 2020 22:52 UTC](https://uzu.lurk.org/t/using-eucliean-notation-inside-curly-braces/1304 "2020-06-01T22:52:20Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![crashingbooth](https://uzu.lurk.org/user_avatar/uzu.lurk.org/crashingbooth/32/1619_2.png) [@crashingbooth](https://uzu.lurk.org/u/crashingbooth)\
**Post date:** [1 June 2020 22:52 UTC](https://uzu.lurk.org/t/using-eucliean-notation-inside-curly-braces/1304/1 "2020-06-01T22:52:20Z")

</div>

These two phases look/behave the same on their own:

```haskell
s "x ~ ~ x ~ ~ x ~"
s "x(3,8)"

```

But seem to behave very differently inside the curly braces:  
e.g.,

```haskell
s "{x ~ ~ x ~ ~ x ~, y ~ ~ }"
s "{x(3,8), y ~ ~}"

```

The `y` seems to repeat once for every 23 'x beats' in the 2nd example - which feels like a bug, but I'm not sure.

The sound of euclidean patterns playing against a regular cross rhythm is a very cool sound - other than spelling it out 'long hand', is there any way to do this?

---

<div class="post-metadata">

**Author:** ![kit-christopher](https://uzu.lurk.org/user_avatar/uzu.lurk.org/kit-christopher/32/686_2.png) [@kit-christopher](https://uzu.lurk.org/u/kit-christopher)\
**Post date:** [1 June 2020 23:33 UTC](https://uzu.lurk.org/t/using-eucliean-notation-inside-curly-braces/1304/2 "2020-06-01T23:33:30Z")

</div>

can you just layer the patterns within the regular square brackets?

---

<div class="post-metadata">

**Author:** ![crashingbooth](https://uzu.lurk.org/user_avatar/uzu.lurk.org/crashingbooth/32/1619_2.png) [@crashingbooth](https://uzu.lurk.org/u/crashingbooth)\
**Post date:** [2 June 2020 00:27 UTC](https://uzu.lurk.org/t/using-eucliean-notation-inside-curly-braces/1304/3 "2020-06-02T00:27:18Z")

</div>

Within regular square brackets the two patterns line up every cycle, but within curly braces (and I'm not sure if I'm phrasing this accurately but this is how I conceptualize it) the length of the pattern subdivision of the first pattern determines the length of the second pattern's subdivisions (and the subdivisions from both patterns share a common pulse). So not polyrhythm but polymeter, if I understand the terms correctly.

That means that `s "{x ~ ~ x ~ ~ x ~, y ~ ~ }"` (a fairly simple example) should repeat every 3 cycles (or every 24 beats).

Not sure how to achieve the same effect with square brackets apart from figuring out the resultant rhythms and typing it out in 'long hand'.

---

<div class="post-metadata">

**Author:** ![kit-christopher](https://uzu.lurk.org/user_avatar/uzu.lurk.org/kit-christopher/32/686_2.png) [@kit-christopher](https://uzu.lurk.org/u/kit-christopher)\
**Post date:** [2 June 2020 01:00 UTC](https://uzu.lurk.org/t/using-eucliean-notation-inside-curly-braces/1304/5 "2020-06-02T01:00:07Z")

</div>

copy that. yeah, not sure! i totally see what you mean. the "long hand" pattern is nice and not at all like the euclid version.

---

<div class="post-metadata">

**Author:** ![yaxu](https://uzu.lurk.org/user_avatar/uzu.lurk.org/yaxu/32/2_2.png) [@yaxu](https://uzu.lurk.org/u/yaxu)\
**Post date:** [2 June 2020 07:06 UTC](https://uzu.lurk.org/t/using-eucliean-notation-inside-curly-braces/1304/6 "2020-06-02T07:06:35Z")

</div>

Yes that looks like a bug!

```haskell
drawLine "{x(3,8), y ~ ~}"
[8 cycles]
|x x x |x x x |x x x |x x x |x x x |x x x |x x x |x x x 
|y------- |y------- |y-------         

```

You can report it here: [https://github.com/tidalcycles/Tidal/issues/new/choose](https://github.com/tidalcycles/Tidal/issues/new/choose)

---

<div class="post-metadata">

**Author:** ![crashingbooth](https://uzu.lurk.org/user_avatar/uzu.lurk.org/crashingbooth/32/1619_2.png) [@crashingbooth](https://uzu.lurk.org/u/crashingbooth)\
**Post date:** [2 June 2020 10:20 UTC](https://uzu.lurk.org/t/using-eucliean-notation-inside-curly-braces/1304/7 "2020-06-02T10:20:52Z")

</div>

Thanks for confirming. . . I reported the issue

---

<div class="post-metadata">

**Author:** ![greathorned](https://uzu.lurk.org/user_avatar/uzu.lurk.org/greathorned/32/1642_2.png) [@greathorned](https://uzu.lurk.org/u/greathorned)\
**Post date:** [1 June 2021 02:30 UTC](https://uzu.lurk.org/t/using-eucliean-notation-inside-curly-braces/1304/8 "2021-06-01T02:30:38Z")

</div>

Hello! Have there been any solutions to this? Like @crashingbooth I would like to play with Euclidean rhythms that span several cycles polymetrically. I also noticed that using the \* mini-notation within curly brackets does not seem to work as expected. Compare these examples:

```
drawLine "{y*8, a b c}" -- doesn't work as expected

drawLine "{y y y y y y y y, a b c}" -- works

-- Euclidean rhythms:
drawLine "{y*8, x(3,7)}" -- doesn't work as expected

drawLine "{y*8, x ~ x ~ x ~ ~}" -- doesn't work as expected

drawLine "{y y y y y y y y, x ~ x ~ x ~ ~}" -- works

```

I would love to be able to use the Euclidean mini-notation in a polymetric (curly-braces) scenario. I've done similar things with SuperCollider but hope that I can make it work in Tidal.

---

<div class="post-metadata">

**Author:** ![crashingbooth](https://uzu.lurk.org/user_avatar/uzu.lurk.org/crashingbooth/32/1619_2.png) [@crashingbooth](https://uzu.lurk.org/u/crashingbooth)\
**Post date:** [1 June 2021 10:27 UTC](https://uzu.lurk.org/t/using-eucliean-notation-inside-curly-braces/1304/9 "2021-06-01T10:27:23Z")

</div>

I think the discussion on github issue I opened concluded that there are situations where treating `x(3,8) `as a single step rather than 8 is expected behaviour, and modifying that would be a breaking change.

Fwiw, you can easily make these work with a few extra keystrokes by moving the euclidean (or \*8 etc) pattern out of the curly braces and explicitly setting the pulse of the 2nd part with %:  
`drawLine "[x(3,8), {y~~}%8]"`

---

<div class="post-metadata">

**Author:** ![yaxu](https://uzu.lurk.org/user_avatar/uzu.lurk.org/yaxu/32/2_2.png) [@yaxu](https://uzu.lurk.org/u/yaxu)\
**Post date:** [1 June 2021 22:09 UTC](https://uzu.lurk.org/t/using-eucliean-notation-inside-curly-braces/1304/10 "2021-06-01T22:09:59Z")

</div>

```haskell
drawLine "{y*8, a b c}" -- doesn't work as expected

```

`*` will treat 'y' as a subpattern in a single step, and 'speed it up'. To repeat a step, use `!` instead:

```haskell
drawLine "{y!8, a b c}"

```

This one is similar, they both are subpatterns so take up one 'step':

```haskell
drawLine "{y*8, x(3,7)}" -- doesn't work as expected

```

Replacing the `*` with `!` as above takes us halfway.. Unfortunately there isn't an alternate euclidean syntax that does what you want, but you can stretch that step out with `@`:

```haskell
drawLine "{y!8, x(3,7)@7}" 

```

---

<div class="post-metadata">

**Author:** ![greathorned](https://uzu.lurk.org/user_avatar/uzu.lurk.org/greathorned/32/1642_2.png) [@greathorned](https://uzu.lurk.org/u/greathorned)\
**Post date:** [1 June 2021 23:28 UTC](https://uzu.lurk.org/t/using-eucliean-notation-inside-curly-braces/1304/11 "2021-06-01T23:28:12Z")

</div>

Ahh this amazing, thanks @yaxu. This opens up lots of doors with Tidal. I love being able to layer up different Euclidean sequences of different lengths and modulate the density of the sequences with the first _k_ variable:

`d1 $ s "[{hh!8, ht(<8 6 4 2>,11)@11, lt(<1 3 5>,7)@7}, bd sd]"`

Since the second variable _n_ in the Euclidean syntax has to be the same as the number after the @ (i.e. `x(k, n)@n` ), it would be super convenient to be able to use setF for this purpose. This works for the two variables inside the parenthesis, but doesn't work for the number after the @. This was mentioned in [this thread](https://club.tidalcycles.org/t/struct-variables-and-mininotation/3131/9).

```
setF "kVal" $ "3"

setF "nVal" $ "7"

d2 $ s "[{hh!8, ht(^kVal, ^nVal)@7}, bd sd]" -- works

d2 $ s "[{hh!8, ht(^kVal, ^nVal)@^nVal}, bd sd]" -- no error but doesn't play correctly
```
