Difference between revisions of "trigger"
From TidalCycles userbase
(Created page with "Type: <syntaxhighlight lang="haskell" inline>trigger :: Show a => a -> Pattern b -> Pattern b</syntaxhighlight> The '''trigger''' function causes the patte...") |
(Add note about fast/slow behaviour) |
||
Line 24: | Line 24: | ||
d2 $ sound "~ arpy*2" | d2 $ sound "~ arpy*2" | ||
+ | </source> | ||
+ | |||
+ | Note that patterns containing [[fast]] or [[slow]] will not be reset. So instead of a pattern such as: | ||
+ | |||
+ | <source> | ||
+ | d1 $ fast 2 $ sound "bd*2 cp:4(5,8,<0 2>)" | ||
+ | # djf (trigger 1 $ range 0.1 0.9 $ slow 2 envL) | ||
+ | </source> | ||
+ | |||
+ | you should use triggers as follows: | ||
+ | |||
+ | <source> | ||
+ | d1 $ (fast 2 $ sound "bd*2 cp:4(5,8,<0 2>)") | ||
+ | # djf (trigger 1 $ range 0.1 0.9 $ slow 2 envL) | ||
</source> | </source> | ||
[[Category:Functions]] | [[Category:Functions]] |
Revision as of 23:31, 23 April 2019
Type: trigger :: Show a => a -> Pattern b -> Pattern b
The trigger function causes the pattern passed to it to be 'reset' every time its evaluated. In the following example, the gain envelope resets each time the pattern is run:
d1 $ sound "bd*2 cp:4(5,8,<0 2>)"
# gain (trigger 1 $ slow 2 envL)
Or similarly with a dj filteR:
d1 $ sound "bd*2 cp:4(5,8,<0 2>)"
# djf (trigger 1 $ range 0.1 0.9 $ slow 2 envL)
The first parameter is the id of the pattern that does the triggering. In the above examples, it's 1
, so in this case d1
is triggering itself.
In this example, running the d2
pattern resets the envelope in the d1
pattern:
d1 $ sound "bd*2 cp:4(5,8,<0 2>)"
# djf (trigger 2 $ range 0.1 0.9 $ slow 2 envL)
d2 $ sound "~ arpy*2"
Note that patterns containing fast or slow will not be reset. So instead of a pattern such as:
d1 $ fast 2 $ sound "bd*2 cp:4(5,8,<0 2>)"
# djf (trigger 1 $ range 0.1 0.9 $ slow 2 envL)
you should use triggers as follows:
d1 $ (fast 2 $ sound "bd*2 cp:4(5,8,<0 2>)")
# djf (trigger 1 $ range 0.1 0.9 $ slow 2 envL)