Randomness
This page will present you all the functions that can be used to introduce some randomness in your musical patterns. Each function will be presented following the same model:
- Type signature: how the function is declared on the Haskell side.
- Description: verbal description of the function.
- Examples: a small list of examples that you can copy/paste in your editor.
#
Pseudo-randomisation#
randrand
is an oscillator that generates a pattern of (pseudo-)random, floating point numbers between 0.0
and 1.0
. For example to randomly pan around the stereo field you can:
Or to enjoy a randomised speed from 0.5
to 1.5
, you can add 0.5
to it.
#
irandirand
is similar to rand
, but generates a continuous oscillator of (pseudo-)random integers between 0
to n-1
inclusive. Notably used to pick random samples from a folder.
#
Perlin noise#
perlinperlin
produces 1D Perlin (smooth) noise. It works like rand but smoothly moves between random values each cycle. For example, you can smoothly and randomly change speed:
The perlin
function produces a new random value to move to every cycle. If you want a new random value to be generated more or less frequently, you can use fast
or slow
, respectively:
#
perlinWithperlinWith
allows you to specify a pattern as input to generate random values instead of using the default cycle count:
#
perlin2perlin2
creates 2D noise by allowing you to specify a custom pattern as a second dimension (cycle number remains as the first dimension):
#
perlin2Withperlin2With
is the same as perlinWith
except allows you to provide two functions for 2D noise: