Difference between revisions of "sometimes"
From TidalCycles userbase
Line 1: | Line 1: | ||
''See also: [[someCycles]]'' | ''See also: [[someCycles]]'' | ||
− | <syntaxhighlight lang="haskell"> | + | [[Type signature|Type]]: <syntaxhighlight lang="haskell" inline>sometimes :: (Pattern a -> Pattern a) -> Pattern a -> Pattern a</syntaxhighlight> |
− | sometimes :: (Pattern a -> Pattern a) -> Pattern a -> Pattern a | ||
− | </syntaxhighlight> | ||
'''sometimes''' is function, that applies another function to a pattern, around 50% of the time, at random. It takes two inputs, the function to be applied, and the pattern you are applying it to. | '''sometimes''' is function, that applies another function to a pattern, around 50% of the time, at random. It takes two inputs, the function to be applied, and the pattern you are applying it to. |
Revision as of 16:47, 23 November 2018
See also: someCycles
Type: sometimes :: (Pattern a -> Pattern a) -> Pattern a -> Pattern a
sometimes is function, that applies another function to a pattern, around 50% of the time, at random. It takes two inputs, the function to be applied, and the pattern you are applying it to.
For example to distort half the events in a pattern:
d1 $ sometimes (# crush 2) $ n "0 1 [~ 2] 3" # sound "arpy"
sometimes has a number of variants, which apply the function with different likelihood.
function | likelihood |
---|---|
always |
100% |
almostAlways |
90% |
often |
75% |
sometimes |
50% |
rarely |
25% |
almostNever |
10% |
never |
0% |
sometimesBy
If you want to be specific, you can use sometimesBy
and a number, for example
sometimesBy 0.93 (# speed 2)
to apply the speed
control on average 93 times out of a hundred.