Difference between revisions of "fix"
From TidalCycles userbase
Left adjoint (talk | contribs) |
|||
Line 2: | Line 2: | ||
[[Type signature|Type]]: <source inline>fix :: (ControlPattern -> ControlPattern) -> ControlPattern -> ControlPattern -> ControlPattern</source> | [[Type signature|Type]]: <source inline>fix :: (ControlPattern -> ControlPattern) -> ControlPattern -> ControlPattern -> ControlPattern</source> | ||
− | The '''fix''' function applies another function to matching events in a pattern of controls. | + | The '''fix''' function applies another function to matching events in a pattern of controls. <source inline>fix</source> is [[contrast]] where the false-branching function is set to the identity function <source inline>id</source>. |
For example: | For example: | ||
Line 13: | Line 13: | ||
You can be quite specific, for example <source inline>fix (hurry 2) (s "drum" # n "1")</source> to apply the function <source inline>hurry 2</source> to sample <source inline>1</source> of the <source inline>drum</source> sampleset, and leave the rest as they are. | You can be quite specific, for example <source inline>fix (hurry 2) (s "drum" # n "1")</source> to apply the function <source inline>hurry 2</source> to sample <source inline>1</source> of the <source inline>drum</source> sampleset, and leave the rest as they are. | ||
+ | |||
+ | '''See also: [[contrast]],[[unfix]]''' | ||
[[Category:Functions]] | [[Category:Functions]] | ||
[[Category:Higher-order functions]] | [[Category:Higher-order functions]] | ||
[[Category:Conditional Transformers]] | [[Category:Conditional Transformers]] |
Revision as of 23:18, 24 December 2020
Type: fix :: (ControlPattern -> ControlPattern) -> ControlPattern -> ControlPattern -> ControlPattern
The fix function applies another function to matching events in a pattern of controls. fix
is contrast where the false-branching function is set to the identity function id
.
For example:
d1 $ slow 2 $ fix (# crush 3) (n "[1,4]") $ n "0 1 2 3 4 5 6" # sound "arpy"
The above only adds the crush
control when the n
control is set to either 1
or 4
.
You can be quite specific, for example fix (hurry 2) (s "drum" # n "1")
to apply the function hurry 2
to sample 1
of the drum
sampleset, and leave the rest as they are.