Concatenation
This page will present you all the functions that can be used to concatenate (e.g. add) things together in various ways. 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.
#
Many cats#
catcat
, (also known as slowcat
, to match with fastcat
defined below) concatenates a list of patterns into a new pattern; each pattern in the list will maintain its original duration. For example:
caution
There is also a slowcat
function, perfectly similar to cat
. This function exists as a mirror of fastcat
.
#
fastcatfastcat
works like cat above, but squashes all the patterns to fit a single cycle.
#
timeCattimeCat
is like fastcat
except that you provide proportionate sizes of the patterns to each other for when they're concatenated into one cycle. The larger the value in the list, the larger relative size the pattern takes in the final loop. If all values are equal then this is equivalent to fastcat
(e.g. the following two code fragments are equivalent).
#
randcatrandcat
is similar to cat
, but rather than playing the given patterns in order, it picks them at random. For example:
#
Append family#
appendappend
combines two patterns into a new pattern, where cycles alternate between the first and second pattern:
It has the alias slowAppend
, in sympathy with fastAppend
, described below.
#
fastAppendfastAppend
works like append described above, but each pair of cycles from the two patterns are squashed to fit a single cycle.
#
wedgewedge
combines two patterns by squashing them into a single cycle. It takes a ratio as the first argument. The ratio determines what percentage of the pattern cycle is taken up by the first pattern. The second pattern fills in the remainder of the pattern cycle. For example:
#
brakbrak
makes a pattern sound a bit like a breakbeat. It does this by every other cycle, squashing the pattern to fit half a cycle, and offsetting it by a quarter of a cycle.
#
flatpatflatpat
takes a pattern of lists and flattens it into a pattern where all the events in each list happen simultaneously. For example, the following code uses flatpat in combination with listToPat to create an alternating pattern of chords.
This code is equivalent to: