Annote pattern.mjs and signal.mjs
This commit is contained in:
parent
c754dab1ef
commit
4a395f372d
4 changed files with 198 additions and 7 deletions
|
|
@ -84,6 +84,7 @@ export class Pattern {
|
|||
/**
|
||||
* Returns a new pattern, with the function applied to the value of
|
||||
* each hap. It has the alias `fmap`.
|
||||
* @group functional
|
||||
* @synonyms fmap
|
||||
* @param {Function} func to to apply to the value
|
||||
* @returns Pattern
|
||||
|
|
@ -116,6 +117,7 @@ export class Pattern {
|
|||
* Assumes 'this' is a pattern of functions, and given a function to
|
||||
* resolve wholes, applies a given pattern of values to that
|
||||
* pattern of functions.
|
||||
* @group functional
|
||||
* @param {Function} whole_func
|
||||
* @param {Function} func
|
||||
* @noAutocomplete
|
||||
|
|
@ -153,6 +155,7 @@ export class Pattern {
|
|||
* In this `_appBoth` variant, where timespans of the function and value haps
|
||||
* are not the same but do intersect, the resulting hap has a timespan of the
|
||||
* intersection. This applies to both the part and the whole timespan.
|
||||
* @group functional
|
||||
* @param {Pattern} pat_val
|
||||
* @noAutocomplete
|
||||
* @returns Pattern
|
||||
|
|
@ -180,6 +183,7 @@ export class Pattern {
|
|||
* on. In practice, this means that the pattern structure, including onsets,
|
||||
* are preserved from the pattern of functions (often referred to as the left
|
||||
* hand or inner pattern).
|
||||
* @group functional
|
||||
* @param {Pattern} pat_val
|
||||
* @noAutocomplete
|
||||
* @returns Pattern
|
||||
|
|
@ -213,6 +217,7 @@ export class Pattern {
|
|||
* As with `appLeft`, but `whole` timespans are instead taken from the
|
||||
* pattern of values, i.e. structure is preserved from the right hand/outer
|
||||
* pattern.
|
||||
* @group functional
|
||||
* @param {Pattern} pat_val
|
||||
* @noAutocomplete
|
||||
* @returns Pattern
|
||||
|
|
@ -403,6 +408,7 @@ export class Pattern {
|
|||
/**
|
||||
* Query haps inside the given time span.
|
||||
*
|
||||
* @group internals
|
||||
* @param {Fraction | number} begin from time
|
||||
* @param {Fraction | number} end to time
|
||||
* @returns Hap[]
|
||||
|
|
@ -426,6 +432,7 @@ export class Pattern {
|
|||
* Returns a new pattern, with queries split at cycle boundaries. This makes
|
||||
* some calculations easier to express, as all haps are then constrained to
|
||||
* happen within a cycle.
|
||||
* @group internals
|
||||
* @returns Pattern
|
||||
* @noAutocomplete
|
||||
*/
|
||||
|
|
@ -440,6 +447,7 @@ export class Pattern {
|
|||
/**
|
||||
* Returns a new pattern, where the given function is applied to the query
|
||||
* timespan before passing it to the original pattern.
|
||||
* @group internals
|
||||
* @param {Function} func the function to apply
|
||||
* @returns Pattern
|
||||
* @noAutocomplete
|
||||
|
|
@ -462,6 +470,7 @@ export class Pattern {
|
|||
/**
|
||||
* As with `withQuerySpan`, but the function is applied to both the
|
||||
* begin and end time of the query timespan.
|
||||
* @group internals
|
||||
* @param {Function} func the function to apply
|
||||
* @returns Pattern
|
||||
* @noAutocomplete
|
||||
|
|
@ -474,6 +483,7 @@ export class Pattern {
|
|||
* Similar to `withQuerySpan`, but the function is applied to the timespans
|
||||
* of all haps returned by pattern queries (both `part` timespans, and where
|
||||
* present, `whole` timespans).
|
||||
* @group internals
|
||||
* @param {Function} func
|
||||
* @returns Pattern
|
||||
* @noAutocomplete
|
||||
|
|
@ -485,6 +495,7 @@ export class Pattern {
|
|||
/**
|
||||
* As with `withHapSpan`, but the function is applied to both the
|
||||
* begin and end time of the hap timespans.
|
||||
* @group internals
|
||||
* @param {Function} func the function to apply
|
||||
* @returns Pattern
|
||||
* @noAutocomplete
|
||||
|
|
@ -495,6 +506,7 @@ export class Pattern {
|
|||
|
||||
/**
|
||||
* Returns a new pattern with the given function applied to the list of haps returned by every query.
|
||||
* @group internals
|
||||
* @param {Function} func
|
||||
* @returns Pattern
|
||||
* @noAutocomplete
|
||||
|
|
@ -507,6 +519,7 @@ export class Pattern {
|
|||
|
||||
/**
|
||||
* As with `withHaps`, but applies the function to every hap, rather than every list of haps.
|
||||
* @group internals
|
||||
* @param {Function} func
|
||||
* @returns Pattern
|
||||
* @noAutocomplete
|
||||
|
|
@ -517,6 +530,7 @@ export class Pattern {
|
|||
|
||||
/**
|
||||
* Returns a new pattern with the context field set to every hap set to the given value.
|
||||
* @group internals
|
||||
* @param {*} context
|
||||
* @returns Pattern
|
||||
* @noAutocomplete
|
||||
|
|
@ -527,6 +541,7 @@ export class Pattern {
|
|||
|
||||
/**
|
||||
* Returns a new pattern with the given function applied to the context field of every hap.
|
||||
* @group internals
|
||||
* @param {Function} func
|
||||
* @returns Pattern
|
||||
* @noAutocomplete
|
||||
|
|
@ -542,6 +557,7 @@ export class Pattern {
|
|||
|
||||
/**
|
||||
* Returns a new pattern with the context field of every hap set to an empty object.
|
||||
* @group internals
|
||||
* @returns Pattern
|
||||
* @noAutocomplete
|
||||
*/
|
||||
|
|
@ -552,6 +568,7 @@ export class Pattern {
|
|||
/**
|
||||
* Returns a new pattern with the given location information added to the
|
||||
* context of every hap.
|
||||
* @group internals
|
||||
* @param {Number} start start offset
|
||||
* @param {Number} end end offset
|
||||
* @returns Pattern
|
||||
|
|
@ -575,6 +592,7 @@ export class Pattern {
|
|||
|
||||
/**
|
||||
* Returns a new Pattern, which only returns haps that meet the given test.
|
||||
* @group internals
|
||||
* @param {Function} hap_test - a function which returns false for haps to be removed from the pattern
|
||||
* @returns Pattern
|
||||
* @noAutocomplete
|
||||
|
|
@ -586,6 +604,7 @@ export class Pattern {
|
|||
/**
|
||||
* As with `filterHaps`, but the function is applied to values
|
||||
* inside haps.
|
||||
* @group internals
|
||||
* @param {Function} value_test
|
||||
* @returns Pattern
|
||||
* @noAutocomplete
|
||||
|
|
@ -597,6 +616,7 @@ export class Pattern {
|
|||
/**
|
||||
* Returns a new pattern, with haps containing undefined values removed from
|
||||
* query results.
|
||||
* @group internals
|
||||
* @returns Pattern
|
||||
* @noAutocomplete
|
||||
*/
|
||||
|
|
@ -608,6 +628,7 @@ export class Pattern {
|
|||
* Returns a new pattern, with all haps without onsets filtered out. A hap
|
||||
* with an onset is one with a `whole` timespan that begins at the same time
|
||||
* as its `part` timespan.
|
||||
* @group internals
|
||||
* @returns Pattern
|
||||
* @noAutocomplete
|
||||
*/
|
||||
|
|
@ -621,6 +642,7 @@ export class Pattern {
|
|||
/**
|
||||
* Returns a new pattern, with 'continuous' haps (those without 'whole'
|
||||
* timespans) removed from query results.
|
||||
* @group internals
|
||||
* @returns Pattern
|
||||
* @noAutocomplete
|
||||
*/
|
||||
|
|
@ -632,6 +654,7 @@ export class Pattern {
|
|||
/**
|
||||
* Combines adjacent haps with the same value and whole. Only
|
||||
* intended for use in tests.
|
||||
* @group internals
|
||||
* @noAutocomplete
|
||||
*/
|
||||
defragmentHaps() {
|
||||
|
|
@ -684,6 +707,7 @@ export class Pattern {
|
|||
/**
|
||||
* Queries the pattern for the first cycle, returning Haps. Mainly of use when
|
||||
* debugging a pattern.
|
||||
* @group internals
|
||||
* @param {Boolean} with_context - set to true, otherwise the context field
|
||||
* will be stripped from the resulting haps.
|
||||
* @returns [Hap]
|
||||
|
|
@ -699,6 +723,7 @@ export class Pattern {
|
|||
|
||||
/**
|
||||
* Accessor for a list of values returned by querying the first cycle.
|
||||
* @group internals
|
||||
* @noAutocomplete
|
||||
*/
|
||||
get firstCycleValues() {
|
||||
|
|
@ -707,6 +732,7 @@ export class Pattern {
|
|||
|
||||
/**
|
||||
* More human-readable version of the `firstCycleValues` accessor.
|
||||
* @group internals
|
||||
* @noAutocomplete
|
||||
*/
|
||||
get showFirstCycle() {
|
||||
|
|
@ -718,6 +744,7 @@ export class Pattern {
|
|||
/**
|
||||
* Returns a new pattern, which returns haps sorted in temporal order. Mainly
|
||||
* of use when comparing two patterns for equality, in tests.
|
||||
* @group internals
|
||||
* @returns Pattern
|
||||
* @noAutocomplete
|
||||
*/
|
||||
|
|
@ -732,6 +759,10 @@ export class Pattern {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new pattern with all values parsed as numerals.
|
||||
* @group internals
|
||||
*/
|
||||
asNumber() {
|
||||
return this.fmap(parseNumeral);
|
||||
}
|
||||
|
|
@ -782,6 +813,7 @@ export class Pattern {
|
|||
/**
|
||||
* Layers the result of the given function(s). Like `superimpose`, but without the original pattern:
|
||||
* @name layer
|
||||
* @group combiners
|
||||
* @memberof Pattern
|
||||
* @synonyms apply
|
||||
* @returns Pattern
|
||||
|
|
@ -797,6 +829,7 @@ export class Pattern {
|
|||
/**
|
||||
* Superimposes the result of the given function(s) on top of the original pattern:
|
||||
* @name superimpose
|
||||
* @group combiners
|
||||
* @memberof Pattern
|
||||
* @returns Pattern
|
||||
* @example
|
||||
|
|
@ -856,6 +889,7 @@ export class Pattern {
|
|||
|
||||
/**
|
||||
* Writes the content of the current event to the console (visible in the side menu).
|
||||
* @group visualizers
|
||||
* @name log
|
||||
* @memberof Pattern
|
||||
* @example
|
||||
|
|
@ -870,6 +904,7 @@ export class Pattern {
|
|||
/**
|
||||
* A simplified version of `log` which writes all "values" (various configurable parameters)
|
||||
* within the event to the console (visible in the side menu).
|
||||
* @group visualizers
|
||||
* @name logValues
|
||||
* @memberof Pattern
|
||||
* @example
|
||||
|
|
@ -903,6 +938,7 @@ export class Pattern {
|
|||
* source pattern to be looped, and for an (optional) given function to be
|
||||
* applied. False values result in the corresponding part of the source pattern
|
||||
* to be played unchanged.
|
||||
* @group structure
|
||||
* @name into
|
||||
* @memberof Pattern
|
||||
* @example
|
||||
|
|
@ -942,6 +978,7 @@ Pattern.prototype.collect = function () {
|
|||
|
||||
/**
|
||||
* Selects indices in in stacked notes.
|
||||
* @group transforms
|
||||
* @example
|
||||
* note("<[c,eb,g]!2 [c,f,ab] [d,f,ab]>")
|
||||
* .arpWith(haps => haps[2])
|
||||
|
|
@ -956,6 +993,7 @@ export const arpWith = register('arpWith', (func, pat) => {
|
|||
|
||||
/**
|
||||
* Selects indices in in stacked notes.
|
||||
* @group transforms
|
||||
* @example
|
||||
* note("<[c,eb,g]!2 [c,f,ab] [d,f,ab]>")
|
||||
* .arp("0 [0,2] 1 [0,2]")
|
||||
|
|
@ -1038,6 +1076,7 @@ function _composeOp(a, b, func) {
|
|||
* note("c3 e3 g3".add("<0 5 7 0>"))
|
||||
* // Behind the scenes, the notes are converted to midi numbers:
|
||||
* // note("48 52 55".add("<0 5 7 0>"))
|
||||
* @group transforms
|
||||
*/
|
||||
add: [numeralArgs((a, b) => a + b)], // support string concatenation
|
||||
/**
|
||||
|
|
@ -1150,6 +1189,7 @@ function _composeOp(a, b, func) {
|
|||
/**
|
||||
* Applies the given structure to the pattern:
|
||||
*
|
||||
* @group structure
|
||||
* @example
|
||||
* note("c,eb,g")
|
||||
* .struct("x ~ x ~ ~ x ~ x ~ ~ ~ x ~ x ~ ~")
|
||||
|
|
@ -1164,6 +1204,7 @@ function _composeOp(a, b, func) {
|
|||
/**
|
||||
* Returns silence when mask is 0 or "~"
|
||||
*
|
||||
* @group structure
|
||||
* @example
|
||||
* note("c [eb,g] d [eb,g]").mask("<1 [0 1]>")
|
||||
*/
|
||||
|
|
@ -1176,6 +1217,7 @@ function _composeOp(a, b, func) {
|
|||
/**
|
||||
* Resets the pattern to the start of the cycle for each onset of the reset pattern.
|
||||
*
|
||||
* @group structure
|
||||
* @example
|
||||
* s("[<bd lt> sd]*2, hh*8").reset("<x@3 x(5,8)>")
|
||||
*/
|
||||
|
|
@ -1189,6 +1231,7 @@ function _composeOp(a, b, func) {
|
|||
* Restarts the pattern for each onset of the restart pattern.
|
||||
* While reset will only reset the current cycle, restart will start from cycle 0.
|
||||
*
|
||||
* @group structure
|
||||
* @example
|
||||
* s("[<bd lt> sd]*2, hh*8").restart("<x@3 x(5,8)>")
|
||||
*/
|
||||
|
|
@ -1229,6 +1272,7 @@ export const pm = polymeter;
|
|||
/**
|
||||
* Does absolutely nothing, but with a given metrical 'steps'
|
||||
* @name gap
|
||||
* @group generators
|
||||
* @param {number} steps
|
||||
* @example
|
||||
* gap(3) // "~@3"
|
||||
|
|
@ -1238,6 +1282,7 @@ export const gap = (steps) => new Pattern(() => [], steps);
|
|||
/**
|
||||
* Does absolutely nothing..
|
||||
* @name silence
|
||||
* @group generators
|
||||
* @example
|
||||
* silence // "~"
|
||||
*/
|
||||
|
|
@ -1249,6 +1294,7 @@ export const nothing = gap(0);
|
|||
/**
|
||||
* A discrete value that repeats once per cycle.
|
||||
*
|
||||
* @group generators
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* pure('e4') // "e4"
|
||||
|
|
@ -1290,7 +1336,10 @@ export function reify(thing) {
|
|||
return pure(thing);
|
||||
}
|
||||
|
||||
/** Takes a list of patterns, and returns a pattern of lists.
|
||||
/**
|
||||
* Takes a list of patterns, and returns a pattern of lists.
|
||||
*
|
||||
* @group transforms
|
||||
*/
|
||||
export function sequenceP(pats) {
|
||||
let result = pure([]);
|
||||
|
|
@ -1303,6 +1352,7 @@ export function sequenceP(pats) {
|
|||
/**
|
||||
* The given items are played at the same time at the same length.
|
||||
*
|
||||
* @group structure
|
||||
* @return {Pattern}
|
||||
* @synonyms polyrhythm, pr
|
||||
* @example
|
||||
|
|
@ -1387,6 +1437,7 @@ export function stackBy(by, ...pats) {
|
|||
/**
|
||||
* Concatenation: combines a list of patterns, switching between them successively, one per cycle.
|
||||
*
|
||||
* @group combiners
|
||||
* @return {Pattern}
|
||||
* @synonyms cat
|
||||
* @example
|
||||
|
|
@ -1420,6 +1471,7 @@ export function slowcat(...pats) {
|
|||
}
|
||||
|
||||
/** Concatenation: combines a list of patterns, switching between them successively, one per cycle. Unlike slowcat, this version will skip cycles.
|
||||
* @group combiners
|
||||
* @param {...any} items - The items to concatenate
|
||||
* @return {Pattern}
|
||||
*/
|
||||
|
|
@ -1435,6 +1487,7 @@ export function slowcatPrime(...pats) {
|
|||
|
||||
/** The given items are con**cat**enated, where each one takes one cycle.
|
||||
*
|
||||
* @group combiners
|
||||
* @param {...any} items - The items to concatenate
|
||||
* @synonyms slowcat
|
||||
* @return {Pattern}
|
||||
|
|
@ -1456,6 +1509,7 @@ export function cat(...pats) {
|
|||
* 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.
|
||||
*
|
||||
* @group combiners
|
||||
* @return {Pattern}
|
||||
* @example
|
||||
* arrange(
|
||||
|
|
@ -1473,6 +1527,7 @@ export function arrange(...sections) {
|
|||
* Similarly to `arrange`, allows you to arrange multiple patterns together over multiple cycles.
|
||||
* Unlike `arrange`, you specify a start and stop time for each pattern rather than duration, which
|
||||
* means that patterns can overlap.
|
||||
* @group combiners
|
||||
* @return {Pattern}
|
||||
* @example
|
||||
seqPLoop([0, 2, "bd(3,8)"],
|
||||
|
|
@ -1517,6 +1572,7 @@ export function sequence(...pats) {
|
|||
}
|
||||
|
||||
/** Like **cat**, but the items are crammed into one cycle.
|
||||
* @group combiners
|
||||
* @synonyms sequence, fastcat
|
||||
* @example
|
||||
* seq("e5", "b4", ["d5", "c5"]).note()
|
||||
|
|
@ -1690,6 +1746,7 @@ function stepRegister(name, func, patternify = true, preserveSteps = false, join
|
|||
* Assumes a numerical pattern. Returns a new pattern with all values rounded
|
||||
* to the nearest integer.
|
||||
* @name round
|
||||
* @group math
|
||||
* @memberof Pattern
|
||||
* @returns Pattern
|
||||
* @example
|
||||
|
|
@ -1698,13 +1755,13 @@ function stepRegister(name, func, patternify = true, preserveSteps = false, join
|
|||
export const round = register('round', function (pat) {
|
||||
return pat.asNumber().fmap((v) => Math.round(v));
|
||||
});
|
||||
|
||||
/**
|
||||
* Assumes a numerical pattern. Returns a new pattern with all values set to
|
||||
* their mathematical floor. E.g. `3.7` replaced with to `3`, and `-4.2`
|
||||
* replaced with `-5`.
|
||||
* @name floor
|
||||
* @memberof Pattern
|
||||
* @group math
|
||||
* @returns Pattern
|
||||
* @example
|
||||
* note("42 42.1 42.5 43".floor())
|
||||
|
|
@ -1719,6 +1776,7 @@ export const floor = register('floor', function (pat) {
|
|||
* replaced with `-4`.
|
||||
* @name ceil
|
||||
* @memberof Pattern
|
||||
* @group math
|
||||
* @returns Pattern
|
||||
* @example
|
||||
* note("42 42.1 42.5 43".ceil())
|
||||
|
|
@ -1729,6 +1787,7 @@ export const ceil = register('ceil', function (pat) {
|
|||
/**
|
||||
* Assumes a numerical pattern, containing unipolar values in the range 0 ..
|
||||
* 1. Returns a new pattern with values scaled to the bipolar range -1 .. 1
|
||||
* @group math
|
||||
* @returns Pattern
|
||||
* @noAutocomplete
|
||||
*/
|
||||
|
|
@ -1739,6 +1798,7 @@ export const toBipolar = register('toBipolar', function (pat) {
|
|||
/**
|
||||
* Assumes a numerical pattern, containing bipolar values in the range -1 .. 1
|
||||
* Returns a new pattern with values scaled to the unipolar range 0 .. 1
|
||||
* @group math
|
||||
* @returns Pattern
|
||||
* @noAutocomplete
|
||||
*/
|
||||
|
|
@ -1752,6 +1812,7 @@ export const fromBipolar = register('fromBipolar', function (pat) {
|
|||
* Most useful in combination with continuous patterns.
|
||||
* @name range
|
||||
* @memberof Pattern
|
||||
* @group math
|
||||
* @returns Pattern
|
||||
* @example
|
||||
* s("[bd sd]*2,hh*8")
|
||||
|
|
@ -1767,6 +1828,7 @@ export const range = register('range', function (min, max, pat) {
|
|||
* following an exponential curve.
|
||||
* @name rangex
|
||||
* @memberof Pattern
|
||||
* @group math
|
||||
* @returns Pattern
|
||||
* @example
|
||||
* s("[bd sd]*2,hh*8")
|
||||
|
|
@ -1781,6 +1843,7 @@ export const rangex = register('rangex', function (min, max, pat) {
|
|||
* Returns a new pattern with values scaled to the given min/max range.
|
||||
* @name range2
|
||||
* @memberof Pattern
|
||||
* @group math
|
||||
* @returns Pattern
|
||||
* @example
|
||||
* s("[bd sd]*2,hh*8")
|
||||
|
|
@ -1795,6 +1858,7 @@ export const range2 = register('range2', function (min, max, pat) {
|
|||
* Returns a new pattern with just numbers.
|
||||
* @name ratio
|
||||
* @memberof Pattern
|
||||
* @group math
|
||||
* @returns Pattern
|
||||
* @example
|
||||
* ratio("1, 5:4, 3:2").mul(110)
|
||||
|
|
@ -1813,6 +1877,7 @@ export const ratio = register('ratio', (pat) =>
|
|||
// Structural and temporal transformations
|
||||
|
||||
/** Compress each cycle into the given timespan, leaving a gap
|
||||
* @group structure
|
||||
* @example
|
||||
* cat(
|
||||
* s("bd sd").compress(.25,.75),
|
||||
|
|
@ -1834,6 +1899,7 @@ export const { compressSpan, compressspan } = register(['compressSpan', 'compres
|
|||
|
||||
/**
|
||||
* speeds up a pattern like fast, but rather than it playing multiple times as fast would it instead leaves a gap in the remaining space of the cycle. For example, the following will play the sound pattern "bd sn" only once but compressed into the first half of the cycle, i.e. twice as fast.
|
||||
* @group structure
|
||||
* @name fastGap
|
||||
* @synonyms fastgap
|
||||
* @example
|
||||
|
|
@ -1871,6 +1937,7 @@ export const { fastGap, fastgap } = register(['fastGap', 'fastgap'], function (f
|
|||
|
||||
/**
|
||||
* Similar to `compress`, but doesn't leave gaps, and the 'focus' can be bigger than a cycle
|
||||
* @group structure
|
||||
* @example
|
||||
* s("bd hh sd hh").focus(1/4, 3/4)
|
||||
*/
|
||||
|
|
@ -1888,6 +1955,7 @@ export const { focusSpan, focusspan } = register(['focusSpan', 'focusspan'], fun
|
|||
});
|
||||
|
||||
/** The ply function repeats each event the given number of times.
|
||||
* @group structure
|
||||
* @example
|
||||
* s("bd ~ sd cp").ply("<1 2 3>")
|
||||
*/
|
||||
|
|
@ -1902,6 +1970,7 @@ export const ply = register('ply', function (factor, pat) {
|
|||
/**
|
||||
* Speed up a pattern by the given factor. Used by "*" in mini notation.
|
||||
*
|
||||
* @group structure
|
||||
* @name fast
|
||||
* @synonyms density
|
||||
* @memberof Pattern
|
||||
|
|
@ -1926,6 +1995,7 @@ export const { fast, density } = register(
|
|||
|
||||
/**
|
||||
* Both speeds up the pattern (like 'fast') and the sample playback (like 'speed').
|
||||
* @group structure
|
||||
* @example
|
||||
* s("bd sd:2").hurry("<1 2 4 3>").slow(1.5)
|
||||
*/
|
||||
|
|
@ -1936,6 +2006,7 @@ export const hurry = register('hurry', function (r, pat) {
|
|||
/**
|
||||
* Slow down a pattern over the given number of cycles. Like the "/" operator in mini notation.
|
||||
*
|
||||
* @group structure
|
||||
* @name slow
|
||||
* @synonyms sparsity
|
||||
* @memberof Pattern
|
||||
|
|
@ -1953,6 +2024,7 @@ export const { slow, sparsity } = register(['slow', 'sparsity'], function (facto
|
|||
|
||||
/**
|
||||
* Carries out an operation 'inside' a cycle.
|
||||
* @group structure
|
||||
* @example
|
||||
* "0 1 2 3 4 3 2 1".inside(4, rev).scale('C major').note()
|
||||
* // "0 1 2 3 4 3 2 1".slow(4).rev().fast(4).scale('C major').note()
|
||||
|
|
@ -1963,6 +2035,7 @@ export const inside = register('inside', function (factor, f, pat) {
|
|||
|
||||
/**
|
||||
* Carries out an operation 'outside' a cycle.
|
||||
* @group structure
|
||||
* @example
|
||||
* "<[0 1] 2 [3 4] 5>".outside(4, rev).scale('C major').note()
|
||||
* // "<[0 1] 2 [3 4] 5>".fast(4).rev().slow(4).scale('C major').note()
|
||||
|
|
@ -1973,6 +2046,7 @@ export const outside = register('outside', function (factor, f, pat) {
|
|||
|
||||
/**
|
||||
* Applies the given function every n cycles, starting from the last cycle.
|
||||
* @group structure
|
||||
* @name lastOf
|
||||
* @memberof Pattern
|
||||
* @param {number} n how many cycles
|
||||
|
|
@ -1989,6 +2063,7 @@ export const lastOf = register('lastOf', function (n, func, pat) {
|
|||
|
||||
/**
|
||||
* Applies the given function every n cycles, starting from the first cycle.
|
||||
* @group structure
|
||||
* @name firstOf
|
||||
* @memberof Pattern
|
||||
* @param {number} n how many cycles
|
||||
|
|
@ -2000,6 +2075,7 @@ export const lastOf = register('lastOf', function (n, func, pat) {
|
|||
|
||||
/**
|
||||
* An alias for `firstOf`
|
||||
* @group structure
|
||||
* @name every
|
||||
* @memberof Pattern
|
||||
* @param {number} n how many cycles
|
||||
|
|
@ -2016,8 +2092,8 @@ export const { firstOf, every } = register(['firstOf', 'every'], function (n, fu
|
|||
|
||||
/**
|
||||
* Like layer, but with a single function:
|
||||
* @group structure
|
||||
* @name apply
|
||||
* @memberof Pattern
|
||||
* @example
|
||||
* "<c3 eb3 g3>".scale('C minor').apply(scaleTranspose("0,2,4")).note()
|
||||
*/
|
||||
|
|
@ -2028,6 +2104,7 @@ export const apply = register('apply', function (func, pat) {
|
|||
|
||||
/**
|
||||
* Plays the pattern at the given cycles per minute.
|
||||
* @group structure
|
||||
* @deprecated
|
||||
* @example
|
||||
* s("<bd sd>,hh*2").cpm(90) // = 90 bpm
|
||||
|
|
@ -2040,6 +2117,7 @@ export const cpm = register('cpm', function (cpm, pat) {
|
|||
/**
|
||||
* Nudge a pattern to start earlier in time. Equivalent of Tidal's <~ operator
|
||||
*
|
||||
* @group structure
|
||||
* @name early
|
||||
* @memberof Pattern
|
||||
* @param {number | Pattern} cycles number of cycles to nudge left
|
||||
|
|
@ -2060,6 +2138,7 @@ export const early = register(
|
|||
/**
|
||||
* Nudge a pattern to start later in time. Equivalent of Tidal's ~> operator
|
||||
*
|
||||
* @group structure
|
||||
* @name late
|
||||
* @memberof Pattern
|
||||
* @param {number | Pattern} cycles number of cycles to nudge right
|
||||
|
|
@ -2080,6 +2159,7 @@ export const late = register(
|
|||
/**
|
||||
* Plays a portion of a pattern, specified by the beginning and end of a time span. The new resulting pattern is played over the time period of the original pattern:
|
||||
*
|
||||
* @group structure
|
||||
* @example
|
||||
* s("bd*2 hh*3 [sd bd]*2 perc").zoom(0.25, 0.75)
|
||||
* // s("hh*3 [sd bd]*2") // equivalent
|
||||
|
|
@ -2106,6 +2186,7 @@ export const { zoomArc, zoomarc } = register(['zoomArc', 'zoomarc'], function (a
|
|||
/**
|
||||
* Splits a pattern into the given number of slices, and plays them according to a pattern of slice numbers.
|
||||
* Similar to `slice`, but slices up patterns rather than sound samples.
|
||||
* @group structure
|
||||
* @param {number} number of slices
|
||||
* @param {number} slices to play
|
||||
* @example
|
||||
|
|
@ -2133,6 +2214,7 @@ export const bite = register(
|
|||
|
||||
/**
|
||||
* Selects the given fraction of the pattern and repeats that part to fill the remainder of the cycle.
|
||||
* @group structure
|
||||
* @param {number} fraction fraction to select
|
||||
* @example
|
||||
* s("lt ht mt cp, [hh oh]*2").linger("<1 .5 .25 .125>")
|
||||
|
|
@ -2153,6 +2235,7 @@ export const linger = register(
|
|||
|
||||
/**
|
||||
* Samples the pattern at a rate of n events per cycle. Useful for turning a continuous pattern into a discrete one.
|
||||
* @group structure
|
||||
* @name segment
|
||||
* @synonyms seg
|
||||
* @param {number} segments number of segments per cycle
|
||||
|
|
@ -2165,6 +2248,7 @@ export const { segment, seg } = register(['segment', 'seg'], function (rate, pat
|
|||
|
||||
/**
|
||||
* The function `swingBy x n` breaks each cycle into `n` slices, and then delays events in the second half of each slice by the amount `x`, which is relative to the size of the (half) slice. So if `x` is 0 it does nothing, `0.5` delays for half the note duration, and 1 will wrap around to doing nothing again. The end result is a shuffle or swing-like rhythm
|
||||
* @group structure
|
||||
* @param {number} subdivision
|
||||
* @param {number} offset
|
||||
* @example
|
||||
|
|
@ -2174,6 +2258,7 @@ export const swingBy = register('swingBy', (swing, n, pat) => pat.inside(n, late
|
|||
|
||||
/**
|
||||
* Shorthand for swingBy with 1/3:
|
||||
* @group structure
|
||||
* @param {number} subdivision
|
||||
* @example
|
||||
* s("hh*8").swing(4)
|
||||
|
|
@ -2183,6 +2268,7 @@ export const swing = register('swing', (n, pat) => pat.swingBy(1 / 3, n));
|
|||
|
||||
/**
|
||||
* Swaps 1s and 0s in a binary pattern.
|
||||
* @group structure
|
||||
* @name invert
|
||||
* @synonyms inv
|
||||
* @example
|
||||
|
|
@ -2200,6 +2286,7 @@ export const { invert, inv } = register(
|
|||
|
||||
/**
|
||||
* Applies the given function whenever the given pattern is in a true state.
|
||||
* @group structure
|
||||
* @name when
|
||||
* @memberof Pattern
|
||||
* @param {Pattern} binary_pat
|
||||
|
|
@ -2214,6 +2301,7 @@ export const when = register('when', function (on, func, pat) {
|
|||
|
||||
/**
|
||||
* Superimposes the function result on top of the original pattern, delayed by the given time.
|
||||
* @group structure
|
||||
* @name off
|
||||
* @memberof Pattern
|
||||
* @param {Pattern | number} time offset time
|
||||
|
|
@ -2230,6 +2318,7 @@ export const off = register('off', function (time_pat, func, pat) {
|
|||
* Returns a new pattern where every other cycle is played once, twice as
|
||||
* fast, and offset in time by one quarter of a cycle. Creates a kind of
|
||||
* breakbeat feel.
|
||||
* @group structure
|
||||
* @returns Pattern
|
||||
*/
|
||||
export const brak = register('brak', function (pat) {
|
||||
|
|
@ -2239,6 +2328,7 @@ export const brak = register('brak', function (pat) {
|
|||
/**
|
||||
* Reverse all haps in a pattern
|
||||
*
|
||||
* @group structure
|
||||
* @name rev
|
||||
* @memberof Pattern
|
||||
* @returns Pattern
|
||||
|
|
@ -2272,6 +2362,7 @@ export const rev = register(
|
|||
/** Like press, but allows you to specify the amount by which each
|
||||
* event is shifted. pressBy(0.5) is the same as press, while
|
||||
* pressBy(1/3) shifts each event by a third of its timespan.
|
||||
* @group structure
|
||||
* @example
|
||||
* stack(s("hh*4"),
|
||||
* s("bd mt sd ht").pressBy("<0 0.5 0.25>")
|
||||
|
|
@ -2283,6 +2374,7 @@ export const pressBy = register('pressBy', function (r, pat) {
|
|||
|
||||
/**
|
||||
* Syncopates a rhythm, by shifting each event halfway into its timespan.
|
||||
* @group structure
|
||||
* @example
|
||||
* stack(s("hh*4"),
|
||||
* s("bd mt sd ht").every(4, press)
|
||||
|
|
@ -2294,6 +2386,7 @@ export const press = register('press', function (pat) {
|
|||
|
||||
/**
|
||||
* Silences a pattern.
|
||||
* @group structure
|
||||
* @example
|
||||
* stack(
|
||||
* s("bd").hush(),
|
||||
|
|
@ -2306,6 +2399,7 @@ Pattern.prototype.hush = function () {
|
|||
|
||||
/**
|
||||
* Applies `rev` to a pattern every other cycle, so that the pattern alternates between forwards and backwards.
|
||||
* @group structure
|
||||
* @example
|
||||
* note("c d e g").palindrome()
|
||||
*/
|
||||
|
|
@ -2320,6 +2414,7 @@ export const palindrome = register(
|
|||
|
||||
/**
|
||||
* Jux with adjustable stereo width. 0 = mono, 1 = full stereo.
|
||||
* @group structure
|
||||
* @name juxBy
|
||||
* @synonyms juxby
|
||||
* @example
|
||||
|
|
@ -2341,6 +2436,7 @@ export const { juxBy, juxby } = register(['juxBy', 'juxby'], function (by, func,
|
|||
|
||||
/**
|
||||
* The jux function creates strange stereo effects, by applying a function to a pattern, but only in the right-hand channel.
|
||||
* @group structure
|
||||
* @example
|
||||
* s("bd lt [~ ht] mt cp ~ bd hh").jux(rev)
|
||||
* @example
|
||||
|
|
@ -2354,6 +2450,7 @@ export const jux = register('jux', function (func, pat) {
|
|||
|
||||
/**
|
||||
* Superimpose and offset multiple times, applying the given function each time.
|
||||
* @group structure
|
||||
* @name echoWith
|
||||
* @synonyms echowith, stutWith, stutwith
|
||||
* @param {number} times how many times to repeat
|
||||
|
|
@ -2373,6 +2470,7 @@ export const { echoWith, echowith, stutWith, stutwith } = register(
|
|||
|
||||
/**
|
||||
* Superimpose and offset multiple times, gradually decreasing the velocity
|
||||
* @group structure
|
||||
* @name echo
|
||||
* @memberof Pattern
|
||||
* @returns Pattern
|
||||
|
|
@ -2388,6 +2486,7 @@ export const echo = register('echo', function (times, time, feedback, pat) {
|
|||
|
||||
/**
|
||||
* Deprecated. Like echo, but the last 2 parameters are flipped.
|
||||
* @group structure
|
||||
* @name stut
|
||||
* @param {number} times how many times to repeat
|
||||
* @param {number} feedback velocity multiplicator for each iteration
|
||||
|
|
@ -2409,6 +2508,7 @@ export const applyN = register('applyN', function (n, func, p) {
|
|||
|
||||
/**
|
||||
* The plyWith function repeats each event the given number of times, applying the given function to each event.\n
|
||||
* @group structure
|
||||
* @name plyWith
|
||||
* @synonyms plywith
|
||||
* @param {number} factor how many times to repeat
|
||||
|
|
@ -2431,6 +2531,7 @@ export const plyWith = register(['plyWith', 'plywith'], function (factor, func,
|
|||
/**
|
||||
* The plyForEach function repeats each event the given number of times, applying the given function to each event.
|
||||
* This version of ply uses the iteration index as an argument to the function, similar to echoWith.
|
||||
* @group structure
|
||||
* @name plyForEach
|
||||
* @synonyms plyforeach
|
||||
* @param {number} factor how many times to repeat
|
||||
|
|
@ -2452,6 +2553,7 @@ export const plyForEach = register(['plyForEach', 'plyforeach'], function (facto
|
|||
|
||||
/**
|
||||
* Divides a pattern into a given number of subdivisions, plays the subdivisions in order, but increments the starting subdivision each cycle. The pattern wraps to the first subdivision after the last subdivision is played.
|
||||
* @group structure
|
||||
* @name iter
|
||||
* @memberof Pattern
|
||||
* @returns Pattern
|
||||
|
|
@ -2479,6 +2581,7 @@ export const iter = register(
|
|||
|
||||
/**
|
||||
* Like `iter`, but plays the subdivisions in reverse order. Known as iter' in tidalcycles
|
||||
* @group structure
|
||||
* @name iterBack
|
||||
* @synonyms iterback
|
||||
* @memberof Pattern
|
||||
|
|
@ -2497,6 +2600,7 @@ export const { iterBack, iterback } = register(
|
|||
|
||||
/**
|
||||
* Repeats each cycle the given number of times.
|
||||
* @group structure
|
||||
* @name repeatCycles
|
||||
* @memberof Pattern
|
||||
* @returns Pattern
|
||||
|
|
@ -2520,6 +2624,7 @@ export const { repeatCycles } = register(
|
|||
|
||||
/**
|
||||
* Divides a pattern into a given number of parts, then cycles through those parts in turn, applying the given function to each part in turn (one part per cycle).
|
||||
* @group structure
|
||||
* @name chunk
|
||||
* @synonyms slowChunk, slowchunk
|
||||
* @memberof Pattern
|
||||
|
|
@ -2551,6 +2656,7 @@ export const { chunk, slowchunk, slowChunk } = register(
|
|||
|
||||
/**
|
||||
* Like `chunk`, but cycles through the parts in reverse order. Known as chunk' in tidalcycles
|
||||
* @group structure
|
||||
* @name chunkBack
|
||||
* @synonyms chunkback
|
||||
* @memberof Pattern
|
||||
|
|
@ -2571,6 +2677,7 @@ export const { chunkBack, chunkback } = register(
|
|||
/**
|
||||
* Like `chunk`, but the cycles of the source pattern aren't repeated
|
||||
* for each set of chunks.
|
||||
* @group structure
|
||||
* @name fastChunk
|
||||
* @synonyms fastchunk
|
||||
* @memberof Pattern
|
||||
|
|
@ -2591,6 +2698,7 @@ export const { fastchunk, fastChunk } = register(
|
|||
|
||||
/**
|
||||
* Like `chunk`, but the function is applied to a looped subcycle of the source pattern.
|
||||
* @group structure
|
||||
* @name chunkInto
|
||||
* @synonyms chunkinto
|
||||
* @memberof Pattern
|
||||
|
|
@ -2604,6 +2712,7 @@ export const { chunkinto, chunkInto } = register(['chunkinto', 'chunkInto'], fun
|
|||
|
||||
/**
|
||||
* Like `chunkInto`, but moves backwards through the chunks.
|
||||
* @group structure
|
||||
* @name chunkBackInto
|
||||
* @synonyms chunkbackinto
|
||||
* @memberof Pattern
|
||||
|
|
@ -2634,6 +2743,7 @@ export const bypass = register(
|
|||
/**
|
||||
* Loops the pattern inside an `offset` for `cycles`.
|
||||
* If you think of the entire span of time in cycles as a ribbon, you can cut a single piece and loop it.
|
||||
* @group structure
|
||||
* @name ribbon
|
||||
* @synonyms rib
|
||||
* @param {number} offset start point of loop in cycles
|
||||
|
|
@ -2662,6 +2772,7 @@ export const hsl = register('hsl', (h, s, l, pat) => {
|
|||
/**
|
||||
* Tags each Hap with an identifier. Good for filtering. The function populates Hap.context.tags (Array).
|
||||
* @name tag
|
||||
* @group structure
|
||||
* @noAutocomplete
|
||||
* @param {string} tag anything unique
|
||||
*/
|
||||
|
|
@ -2672,6 +2783,7 @@ Pattern.prototype.tag = function (tag) {
|
|||
/**
|
||||
* Filters haps using the given function
|
||||
* @name filter
|
||||
* @group structure
|
||||
* @param {Function} test function to test Hap
|
||||
* @example
|
||||
* s("hh!7 oh").filter(hap => hap.value.s==='hh')
|
||||
|
|
@ -2681,6 +2793,7 @@ export const filter = register('filter', (test, pat) => pat.withHaps((haps) => h
|
|||
/**
|
||||
* Filters haps by their begin time
|
||||
* @name filterWhen
|
||||
* @group structure
|
||||
* @noAutocomplete
|
||||
* @param {Function} test function to test Hap.whole.begin
|
||||
*/
|
||||
|
|
@ -2689,6 +2802,7 @@ export const filterWhen = register('filterWhen', (test, pat) => pat.filter((h) =
|
|||
/**
|
||||
* Use within to apply a function to only a part of a pattern.
|
||||
* @name within
|
||||
* @group structure
|
||||
* @param {number} start start within cycle (0 - 1)
|
||||
* @param {number} end end within cycle (0 - 1). Must be > start
|
||||
* @param {Function} func function to be applied to the sub-pattern
|
||||
|
|
@ -2763,6 +2877,7 @@ export function _match(span, hap_p) {
|
|||
* *Experimental*
|
||||
*
|
||||
* Speeds a pattern up or down, to fit to the given number of steps per cycle.
|
||||
* @group structure
|
||||
* @example
|
||||
* sound("bd sd cp").pace(4)
|
||||
* // The same as sound("{bd sd cp}%4") or sound("<bd sd cp>*4")
|
||||
|
|
@ -2804,6 +2919,7 @@ export function _polymeterListSteps(steps, ...args) {
|
|||
* *Experimental*
|
||||
*
|
||||
* 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.
|
||||
* @group structure
|
||||
* @synonyms pm
|
||||
* @example
|
||||
* // The same as note("{c eb g, c2 g2}%6")
|
||||
|
|
@ -2836,6 +2952,7 @@ export function polymeter(...args) {
|
|||
* The steps can either be inferred from the pattern, or provided as a [length, pattern] pair.
|
||||
* Has the alias `timecat`.
|
||||
* @name stepcat
|
||||
* @group combiners
|
||||
* @synonyms timeCat, timecat
|
||||
* @return {Pattern}
|
||||
* @example
|
||||
|
|
@ -2893,6 +3010,7 @@ export function stepcat(...timepats) {
|
|||
* Concatenates patterns stepwise, according to an inferred 'steps per cycle'.
|
||||
* Similar to `stepcat`, but if an argument is a list, the whole pattern will alternate between the elements in the list.
|
||||
*
|
||||
* @group combiners
|
||||
* @return {Pattern}
|
||||
* @example
|
||||
* stepalt(["bd cp", "mt"], "bd").sound()
|
||||
|
|
@ -2919,6 +3037,7 @@ export function stepalt(...groups) {
|
|||
*
|
||||
* Takes the given number of steps from a pattern (dropping the rest).
|
||||
* A positive number will take steps from the start of a pattern, and a negative number from the end.
|
||||
* @group structure
|
||||
* @return {Pattern}
|
||||
* @example
|
||||
* "bd cp ht mt".take("2").sound()
|
||||
|
|
@ -2963,6 +3082,7 @@ export const take = stepRegister('take', function (i, pat) {
|
|||
*
|
||||
* Drops the given number of steps from a pattern.
|
||||
* A positive number will drop steps from the start of a pattern, and a negative number from the end.
|
||||
* @group structure
|
||||
* @return {Pattern}
|
||||
* @example
|
||||
* "tha dhi thom nam".drop("1").sound().bank("mridangam")
|
||||
|
|
@ -2991,6 +3111,7 @@ export const drop = stepRegister('drop', function (i, pat) {
|
|||
* `extend` is similar to `fast` in that it increases its density, but it also increases the step count
|
||||
* accordingly. So `stepcat("a b".extend(2), "c d")` would be the same as `"a b a b c d"`, whereas
|
||||
* `stepcat("a b".fast(2), "c d")` would be the same as `"[a b] [a b] c d"`.
|
||||
* @group structure
|
||||
* @example
|
||||
* stepcat(
|
||||
* sound("bd bd - cp").extend(2),
|
||||
|
|
@ -3005,6 +3126,7 @@ export const extend = stepRegister('extend', function (factor, pat) {
|
|||
* *Experimental*
|
||||
*
|
||||
* Expands the step size of the pattern by the given factor.
|
||||
* @group structure
|
||||
* @example
|
||||
* sound("tha dhi thom nam").bank("mridangam").expand("3 2 1 1 2 3").pace(8)
|
||||
*/
|
||||
|
|
@ -3016,6 +3138,7 @@ export const expand = stepRegister('expand', function (factor, pat) {
|
|||
* *Experimental*
|
||||
*
|
||||
* Contracts the step size of the pattern by the given factor. See also `expand`.
|
||||
* @group structure
|
||||
* @example
|
||||
* sound("tha dhi thom nam").bank("mridangam").contract("3 2 1 1 2 3").pace(8)
|
||||
*/
|
||||
|
|
@ -3070,6 +3193,7 @@ export const shrinklist = (amount, pat) => pat.shrinklist(amount);
|
|||
* Progressively shrinks the pattern by 'n' steps until there's nothing left, or if a second value is given (using mininotation list syntax with `:`),
|
||||
* that number of times.
|
||||
* A positive number will progressively drop steps from the start of a pattern, and a negative number from the end.
|
||||
* @group structure
|
||||
* @return {Pattern}
|
||||
* @example
|
||||
* "tha dhi thom nam".shrink("1").sound()
|
||||
|
|
@ -3109,6 +3233,7 @@ export const shrink = register(
|
|||
* Progressively grows the pattern by 'n' steps until the full pattern is played, or if a second value is given (using mininotation list syntax with `:`),
|
||||
* that number of times.
|
||||
* A positive number will progressively grow steps from the start of a pattern, and a negative number from the end.
|
||||
* @group structure
|
||||
* @return {Pattern}
|
||||
* @example
|
||||
* "tha dhi thom nam".grow("1").sound()
|
||||
|
|
@ -3148,7 +3273,8 @@ export const grow = register(
|
|||
* Inserts a pattern into a list of patterns. On the first repetition it will be inserted at the end of the list, then moved backwards through the list
|
||||
* on successive repetitions. The patterns are added together stepwise, with all repetitions taking place over a single cycle. Using `pace` to set the
|
||||
* number of steps per cycle is therefore usually recommended.
|
||||
*
|
||||
*
|
||||
* @group combiners
|
||||
* @return {Pattern}
|
||||
* @example
|
||||
* "[c g]".tour("e f", "e f g", "g f e c").note()
|
||||
|
|
@ -3175,6 +3301,7 @@ Pattern.prototype.tour = function (...many) {
|
|||
* 'zips' together the steps of the provided patterns. This can create a long repetition, taking place over a single, dense cycle.
|
||||
* Using `pace` to set the number of steps per cycle is therefore usually recommended.
|
||||
*
|
||||
* @group combiners
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* zip("e f", "e f g", "g [f e] a f4 c").note()
|
||||
|
|
@ -3226,6 +3353,7 @@ Pattern.prototype.steps = Pattern.prototype.pace;
|
|||
* Cuts each sample into the given number of parts, allowing you to explore a technique known as 'granular synthesis'.
|
||||
* It turns a pattern of samples into a pattern of parts of samples.
|
||||
* @name chop
|
||||
* @group transforms
|
||||
* @memberof Pattern
|
||||
* @returns Pattern
|
||||
* @example
|
||||
|
|
@ -3256,6 +3384,7 @@ export const chop = register('chop', function (n, pat) {
|
|||
/**
|
||||
* Cuts each sample into the given number of parts, triggering progressive portions of each sample at each loop.
|
||||
* @name striate
|
||||
* @group transforms
|
||||
* @memberof Pattern
|
||||
* @returns Pattern
|
||||
* @example
|
||||
|
|
@ -3274,6 +3403,7 @@ export const striate = register('striate', function (n, pat) {
|
|||
/**
|
||||
* Makes the sample fit the given number of cycles by changing the speed.
|
||||
* @name loopAt
|
||||
* @group transforms
|
||||
* @memberof Pattern
|
||||
* @returns Pattern
|
||||
* @example
|
||||
|
|
@ -3292,6 +3422,7 @@ const _loopAt = function (factor, pat, cps = 0.5) {
|
|||
* Chops samples into the given number of slices, triggering those slices with a given pattern of slice numbers.
|
||||
* Instead of a number, it also accepts a list of numbers from 0 to 1 to slice at specific points.
|
||||
* @name slice
|
||||
* @group transforms
|
||||
* @memberof Pattern
|
||||
* @returns Pattern
|
||||
* @example
|
||||
|
|
@ -3327,6 +3458,7 @@ export const slice = register(
|
|||
* make something happen on event time
|
||||
* uses browser timeout which is innacurate for audio tasks
|
||||
* @name onTriggerTime
|
||||
* @group external_io
|
||||
* @memberof Pattern
|
||||
* @returns Pattern
|
||||
* @example
|
||||
|
|
@ -3344,6 +3476,7 @@ Pattern.prototype.onTriggerTime = function (func) {
|
|||
/**
|
||||
* Works the same as slice, but changes the playback speed of each slice to match the duration of its step.
|
||||
* @name splice
|
||||
* @group transforms
|
||||
* @example
|
||||
* samples('github:tidalcycles/dirt-samples')
|
||||
* s("breaks165")
|
||||
|
|
@ -3381,6 +3514,7 @@ export const { loopAt, loopat } = register(['loopAt', 'loopat'], function (facto
|
|||
* Makes the sample fit its event duration. Good for rhythmical loops like drum breaks.
|
||||
* Similar to `loopAt`.
|
||||
* @name fit
|
||||
* @group transforms
|
||||
* @example
|
||||
* samples({ rhodes: 'https://cdn.freesound.org/previews/132/132051_316502-lq.mp3' })
|
||||
* s("rhodes/2").fit()
|
||||
|
|
@ -3406,6 +3540,7 @@ export const fit = register('fit', (pat) =>
|
|||
* given by a global clock and this function will be
|
||||
* deprecated/removed.
|
||||
* @name loopAtCps
|
||||
* @group transforms
|
||||
* @memberof Pattern
|
||||
* @returns Pattern
|
||||
* @example
|
||||
|
|
@ -3432,6 +3567,7 @@ let fadeGain = (p) => (p < 0.5 ? 1 : 1 - (p - 0.5) / 0.5);
|
|||
* - 1 = (no left, full right)
|
||||
*
|
||||
* @name xfade
|
||||
* @group combiners
|
||||
* @example
|
||||
* xfade(s("bd*2"), "<0 .25 .5 .75 1>", s("hh*8"))
|
||||
*/
|
||||
|
|
@ -3453,6 +3589,7 @@ Pattern.prototype.xfade = function (pos, b) {
|
|||
* creates a structure pattern from divisions of a cycle
|
||||
* especially useful for creating rhythms
|
||||
* @name beat
|
||||
* @group structure
|
||||
* @example
|
||||
* s("bd").beat("0,7,10", 16)
|
||||
* @example
|
||||
|
|
@ -3529,6 +3666,7 @@ export const _morph = (from, to, by) => {
|
|||
* sine.slow(8) // slowly morph between the rhythms
|
||||
* )
|
||||
* )
|
||||
* @group structure
|
||||
*/
|
||||
export const morph = (frompat, topat, bypat) => {
|
||||
frompat = reify(frompat);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue