Создание Patterns
Следующие функции возвращают pattern. Это эквиваленты, используемые Mini Notation:
| function | mini |
|---|---|
cat(x, y) | "<x y>" |
seq(x, y) | "x y" |
stack(x, y) | "x,y" |
stepcat([3,x],[2,y]) | "x@3 y@2" |
polymeter([a, b, c], [x, y]) | "{a b c, x y}" |
polymeterSteps(2, x, y, z) | "{x y z}%2" |
silence | "~" |
cat
slowcatЗаданные элементы конкатенируются, где каждый занимает один цикл.
- items (any): Элементы для конкатенации
cat("e5", "b4", ["d5", "c5"]).note()
// "<e5 b4 [d5 c5]>".note()// Как цепная функция:
s("hh*4").cat(
note("c4(5,8)")
)seq
sequence, fastcatКак cat, но элементы втиснуты в один цикл.
seq("e5", "b4", ["d5", "c5"]).note()
// "e5 b4 [d5 c5]".note()// Как цепная функция:
s("hh*4").seq(
note("c4(5,8)")
)stack
polyrhythm, prЗаданные элементы воспроизводятся одновременно с одинаковой длительностью.
stack("g3", "b3", ["e4", "d4"]).note()
// "g3,b3,[e4 d4]".note()// Как цепная функция:
s("hh*4").stack(
note("c4(5,8)")
)stepcat
timeCat, timecat'Concatenates' patterns like fastcat, but proportional to a number of steps per cycle.
The steps can either be inferred from the pattern, or provided as a [length, pattern] pair.
Has the alias timecat.
stepcat([3,"e3"],[1, "g3"]).note() // the same as "e3@3 g3".note()
stepcat("bd sd cp","hh hh").sound()
// the same as "bd sd cp hh hh".sound()arrange
Позволяет расположить несколько patterns вместе на протяжении нескольких циклов. Принимает переменное количество массивов с двумя элементами, указывающими количество циклов и используемый pattern.
arrange( [4, "<c a f e>(3,8)"], [2, "<g a>(5,8)"] ).note()
polymeter
pmExperimental
Aligns the steps of the patterns, creating polymeters. The patterns are repeated until they all fit the cycle. For example, in the below the first pattern is repeated twice, and the second is repeated three times, to fit the lowest common multiple of six steps.
// The same as note("{c eb g, c2 g2}%6")
polymeter("c eb g", "c2 g2").note()polymeterSteps
silence
Абсолютно ничего не делает..
silence // "~"
run
Дискретный pattern чисел от 0 до n-1
n(run(4)).scale("C4:pentatonic")
// n("0 1 2 3").scale("C4:pentatonic")binary
Создает двоичный pattern из числа.
- n (number): входное число для преобразования в двоичную систему
"hh".s().struct(binary(5))
// "hh".s().struct("1 0 1")binaryN
Создает двоичный pattern из числа, дополненный до n бит.
- n (number): входное число для преобразования в двоичную систему
- nBits (number): длина pattern, по умолчанию 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")После конструкторов Patterns давайте посмотрим, какие Модификаторы времени доступны.