# Difference between revisions of "euclid"

From TidalCycles userbase

Left adjoint (talk | contribs) |
|||

(2 intermediate revisions by the same user not shown) | |||

Line 10: | Line 10: | ||

</source> | </source> | ||

− | + | is the same as | |

<source> | <source> | ||

Line 22: | Line 22: | ||

</source> | </source> | ||

+ | = euclidInv = | ||

+ | [[Type signature|Type]]: <source inline>euclidInv :: Pattern Int -> Pattern Int -> Pattern a -> Pattern a</source> | ||

+ | |||

+ | Inverts the pattern given by <source inline>euclid</source>. For example, | ||

+ | |||

+ | <source> | ||

+ | d1 $ stack [euclid 5 8 $ s "bd", | ||

+ | euclidInv 5 8 $ s "hh27"] | ||

+ | </source> | ||

+ | |||

+ | to hear that the hi-hat event fires on every one of the eight even beats that the bass drum does not. | ||

+ | |||

+ | = euclidFull = | ||

+ | [[Type signature|Type]]: <source inline>euclidInv :: Pattern Int -> Pattern Int -> Pattern a -> Pattern a ->Pattern a</source> | ||

+ | |||

+ | '''euclidFull''' is a convenience function for playing one pattern on the euclidean rhythm and a different pattern on the off-beat. | ||

+ | <source> | ||

+ | euclidFull 5 8 (s "bd") (s "hh27") | ||

+ | </source> | ||

+ | is equivalent to our above example. | ||

[[Category:Functions]] | [[Category:Functions]] |

## Latest revision as of 17:22, 25 December 2020

Type: `euclid :: Pattern Int -> Pattern Int -> Pattern a -> Pattern a`

**euclid** creates a Euclidean rhythmic structure. It produces the same output as the Euclidean pattern string.

For example:

`d1 $ euclid 3 8 $ sound "cp"`

is the same as

`d1 $ sound "cp(3,8)"`

**euclid** accepts two parameters that can be patterns:

`d1 $ euclid "<3 5>" "[8 16]/4" $ s "bd"`

# euclidInv

Type: `euclidInv :: Pattern Int -> Pattern Int -> Pattern a -> Pattern a`

Inverts the pattern given by `euclid`

. For example,

```
d1 $ stack [euclid 5 8 $ s "bd",
euclidInv 5 8 $ s "hh27"]
```

to hear that the hi-hat event fires on every one of the eight even beats that the bass drum does not.

# euclidFull

Type: `euclidInv :: Pattern Int -> Pattern Int -> Pattern a -> Pattern a ->Pattern a`

**euclidFull** is a convenience function for playing one pattern on the euclidean rhythm and a different pattern on the off-beat.

`euclidFull 5 8 (s "bd") (s "hh27")`

is equivalent to our above example.