Creating Patterns
The following functions will return a pattern. These are the equivalents used by the Mini Notation:
| function | mini |
|---|---|
cat(x, y) | "<x y>" |
seq(x, y) | "x y" |
stack(x, y) | "x,y" |
s_cat([3,x],[2,y]) | "x@3 y@2" |
s_polymeter([a, b, c], [x, y]) | "{a b c, x y}" |
s_polymeterSteps(2, x, y, z) | "{x y z}%2" |
silence | "~" |
cat
slowcatThe given items are concatenated, where each one takes one cycle.
- items (any): The items to concatenate
cat("e5", "b4", ["d5", "c5"]).note()
// "<e5 b4 [d5 c5]>".note()// As a chained function:
s("hh*4").cat(
note("c4(5,8)")
)seq
sequence, fastcatLike cat, but the items are crammed into one cycle.
seq("e5", "b4", ["d5", "c5"]).note()
// "e5 b4 [d5 c5]".note()// As a chained function:
s("hh*4").seq(
note("c4(5,8)")
)stack
polyrhythm, prThe given items are played at the same time at the same length.
stack("g3", "b3", ["e4", "d4"]).note()
// "g3,b3,[e4,d4]".note()// As a chained function:
s("hh*4").stack(
note("c4(5,8)")
)s_cat
timeCat, timecatSequences patterns like seq, but each pattern has a length, relative to the whole.
This length can either be provided as a [length, pattern] pair, or inferred from
the pattern's 'tactus', generally inferred by the mininotation. Has the alias timecat.
s_cat([3,"e3"],[1, "g3"]).note() // the same as "e3@3 g3".note()
s_cat("bd sd cp","hh hh").sound()
// the same as "bd sd cp hh hh".sound()arrange
Allows to arrange multiple patterns together over multiple cycles. Takes a variable number of arrays with two elements specifying the number of cycles and the pattern to use.
arrange( [4, "<c a f e>(3,8)"], [2, "<g a>(5,8)"] ).note()
s_polymeter
pmEXPERIMENTAL - Combines the given lists of patterns with the same pulse, creating polymeters when different sized sequences are used.
// The same as note("{c eb g, c2 g2}")
s_polymeter("c eb g", "c2 g2").note()s_polymeterSteps
Aligns one or more given patterns to the given number of steps per cycle. This relies on patterns having coherent number of steps per cycle,
- steps (number): how many items are placed in one cycle
- patterns (Array.<any>): one or more patterns
// the same as "{c d, e f g}%4"
s_polymeterSteps(4, "c d", "e f g").note()silence
Does absolutely nothing..
silence // "~"
run
A discrete pattern of numbers from 0 to n-1
n(run(4)).scale("C4:pentatonic")
// n("0 1 2 3").scale("C4:pentatonic")binary
Creates a pattern from a binary number.
- n (number): input number to convert to binary
"hh".s().struct(binary(5))
// "hh".s().struct("1 0 1")binaryN
Creates a pattern from a binary number, padded to n bits long.
- n (number): input number to convert to binary
- nBits (number): pattern length, defaults to 16
"hh".s().struct(binaryN(55532, 16))
// "hh".s().struct("1 1 0 1 1 0 0 0 1 1 1 0 1 1 0 0")After Pattern Constructors, letβs see what Time Modifiers are available.