Docs: add example of custom chained function
This adds a subsection to the "Understand/Coding Syntax" documentation that shows a simple example of converting the previous chain of effects into a custom, reusable chained function. There's also a prompt for the reader to experiment.
This commit is contained in:
parent
7eebf3a466
commit
0065db8569
1 changed files with 19 additions and 0 deletions
|
|
@ -60,6 +60,25 @@ Strudel makes heavy use of chained functions. Here is a more sophisticated examp
|
||||||
.room(0.5)`}
|
.room(0.5)`}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
## Write your own chained function
|
||||||
|
|
||||||
|
You can write your own chained function using `register`. Here's the above chain but registered as a reusable, chained function.
|
||||||
|
|
||||||
|
<MiniRepl
|
||||||
|
client:idle
|
||||||
|
tune={`const effectChain = register('effectChain',
|
||||||
|
(pat) => pat
|
||||||
|
.s("sawtooth")
|
||||||
|
.cutoff(500)
|
||||||
|
//.delay(0.5)
|
||||||
|
.room(0.5)
|
||||||
|
);
|
||||||
|
note("a3 c#4 e4 a4").effectChain()
|
||||||
|
`}
|
||||||
|
/>
|
||||||
|
|
||||||
|
Try adding `.rev()` after `effectChain()` to see further effects added.
|
||||||
|
|
||||||
# Comments
|
# Comments
|
||||||
|
|
||||||
The `//` in the example above is a line comment, resulting in the `delay` function being ignored.
|
The `//` in the example above is a line comment, resulting in the `delay` function being ignored.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue