mirror of
https://codeberg.org/uzu/strudel
synced 2026-07-13 06:19:33 -04:00
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:
@@ -60,6 +60,25 @@ Strudel makes heavy use of chained functions. Here is a more sophisticated examp
|
||||
.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
|
||||
|
||||
The `//` in the example above is a line comment, resulting in the `delay` function being ignored.
|
||||
|
||||
Reference in New Issue
Block a user