# Fractions, Variables, etc., in Mininotation

**URL:** <https://uzu.lurk.org/t/fractions-variables-etc-in-mininotation/3419>\
**Category:** TidalCycles\
**Tags:** questions\
**Created:** [19 August 2021 14:51 UTC](https://uzu.lurk.org/t/fractions-variables-etc-in-mininotation/3419 "2021-08-19T14:51:12Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![SpacepersonJ](https://uzu.lurk.org/letter_avatar_proxy/v4/letter/s/fbc32d/32.png) [@SpacepersonJ](https://uzu.lurk.org/u/SpacepersonJ)\
**Post date:** [19 August 2021 14:51 UTC](https://uzu.lurk.org/t/fractions-variables-etc-in-mininotation/3419/1 "2021-08-19T14:51:13Z")

</div>

Hi, all,

I’m writing an article for this year’s ICLC conference and have a question: In Tidal, would it be possible to put a fraction or a variable inside a control pattern? I’d like to be able to do this:

```haskell
d1 $ freq "440*4" # s "superfm" |* freq "1 1.2 1.5 0.8888888888888888"

```

...but instead express the last three values as fractions - something like this:

```haskell
d1 $ freq "440*4" # s "superfm" |* freq "1 (6/5) (3/2) (8/9)"

```

--but this doesn't work, nor if I try to substitute the fractions with variables:

```haskell
let ratio65 = 1.2
    ratio32 = 1.5
    ratio89 = 0.8888888888888888

d1 $ freq "440*4" # s "superfm" |* freq "1 ratio65 ratio32 ratio89"

```

Would I have to somehow define these values as floats before I can proceed?

Thanks!

SpacepersonJ

---

<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:** [19 August 2021 17:25 UTC](https://uzu.lurk.org/t/fractions-variables-etc-in-mininotation/3419/2 "2021-08-19T17:25:50Z")

</div>

you might try something like `inhabit`, although i bet you'd have to explicitly define all your custom names...it wouldn't be dynamic if you changed the fraction value without changing your `inhabit` def first.

> [@Melodic Examples with Tidal?](https://club.tidalcycles.org/t/melodic-examples-with-tidal/490/40):
>
> Hola @yecto, You could do it with inhabit. mychords = inhabit [("hola", "[0,4,2]" :: Pattern Double), ("hello", "[0,5,7,12]") ] d1 $ n (mychords "hello hola") # s "superpiano" You have to use :: Pattern Double to tell haskell what kind of pattern you're making, but you only have to do that on one of the values, it can work out the rest.

---

<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:** [19 August 2021 19:06 UTC](https://uzu.lurk.org/t/fractions-variables-etc-in-mininotation/3419/3 "2021-08-19T19:06:21Z")

</div>

Hi @SpacepersonJ, this should work:

```haskell
d1 $ freq "440*4" # s "superfm" |* freq "1 6%5 3%2 8%9"

```

In mininotation, `%` denotes a ratio (`/` manipulates time)

---

<div class="post-metadata">

**Author:** ![ndr\_brt](https://uzu.lurk.org/user_avatar/uzu.lurk.org/ndr_brt/32/396_2.png) [@ndr\_brt](https://uzu.lurk.org/u/ndr_brt)\
**Post date:** [19 August 2021 19:24 UTC](https://uzu.lurk.org/t/fractions-variables-etc-in-mininotation/3419/4 "2021-08-19T19:24:18Z")

</div>

Whhoooaaa! Didn't know about that, and don't know how I didn't see that into the parser code.

That will change my flow a lot! Thanks

---

<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:** [19 August 2021 22:07 UTC](https://uzu.lurk.org/t/fractions-variables-etc-in-mininotation/3419/5 "2021-08-19T22:07:13Z")

</div>

really cool!

---

<div class="post-metadata">

**Author:** ![SpacepersonJ](https://uzu.lurk.org/letter_avatar_proxy/v4/letter/s/fbc32d/32.png) [@SpacepersonJ](https://uzu.lurk.org/u/SpacepersonJ)\
**Post date:** [20 August 2021 04:38 UTC](https://uzu.lurk.org/t/fractions-variables-etc-in-mininotation/3419/6 "2021-08-20T04:38:33Z")

</div>

Thanks, all!

@yaxu - thanks for the tip. The % trick didn't work, though - I got this message:

Error in pattern: Syntax error in sequence:  
"1 6%5 3%5 8%9"  
^  
unexpected '%'  
expecting float, "'", "w", "h", "q", "e", "s", "t", "f", rest, "[", "{", "\<", "." or end of input

Is this a new feature? I haven't upgraded TC in a bit...

Thanks again,

SPPJ

---

<div class="post-metadata">

**Author:** ![geikha](https://uzu.lurk.org/user_avatar/uzu.lurk.org/geikha/32/2701_2.png) [@geikha](https://uzu.lurk.org/u/geikha)\
**Post date:** [20 August 2021 06:10 UTC](https://uzu.lurk.org/t/fractions-variables-etc-in-mininotation/3419/7 "2021-08-20T06:10:22Z")

</div>

i think it's 1.4.8 onwards ?

- Add ratio shorthand to floating point patterns @yaxu

> <https://github.com/tidalcycles/Tidal/blob/main/CHANGELOG.md#148---limerick>

---

<div class="post-metadata">

**Author:** ![SpacepersonJ](https://uzu.lurk.org/letter_avatar_proxy/v4/letter/s/fbc32d/32.png) [@SpacepersonJ](https://uzu.lurk.org/u/SpacepersonJ)\
**Post date:** [24 August 2021 16:38 UTC](https://uzu.lurk.org/t/fractions-variables-etc-in-mininotation/3419/8 "2021-08-24T16:38:35Z")

</div>

Sorry it took so long to reply - I had a bit of trouble updating Tidal.

Wow - the ratio shorthand is incredible!!!! Thanks so much, Yaxu!!!

SPJ
