Skip to content

Commit 09e21f2

Browse files
authored
Merge pull request #303 from tidalcycles/282_plywith_cleary
add plyWith, closes #282
2 parents 8991f5b + f644799 commit 09e21f2

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

docs/reference/alteration.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,28 @@ Here is an example of it being used conditionally:
130130
d1 $ every 3 (ply 4) $ s "bd ~ sn cp"
131131
```
132132

133+
### plyWith
134+
135+
```haskell
136+
Type: plyWith :: Pattern t -> (Pattern a -> Pattern a) -> Pattern a -> Pattern a
137+
```
138+
139+
The `plyWith` function expands on the `ply` function, repeating each event the given number of times with another function applied. For example:
140+
141+
```haskell
142+
d1 $ plyWith "2 3" (# speed "1.2") $ s "bd ~ sn cp"
143+
```
144+
... is equivalent to ...
145+
146+
```haskell
147+
d1 $ ply "2 3" $ s "bd ~ sn cp" # speed "1.2"
148+
```
149+
`plyWith` can also be used for multiplicative operations. Here is an example, also being used conditionally:
150+
151+
```haskell
152+
d1 $ every 3 (plyWith "2 3" (|* speed "1.5")) $ s "bd ~ sn cp"
153+
```
154+
133155
### stutter
134156
```haskell
135157
Type: stutter :: Integral i => i -> Time -> Pattern a -> Pattern a

0 commit comments

Comments
 (0)