update docs

This commit is contained in:
Jade (Rose) Rowland 2025-03-24 00:09:46 -04:00
parent b192c6823c
commit cbd448e934
3 changed files with 14 additions and 23 deletions

View file

@ -2106,10 +2106,11 @@ 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.
* @param {number} segments number of segments per cycle
* @synonyms seg
* @example
* note(saw.range(40,52).segment(24))
*/
export const segment = register('segment', function (rate, pat) {
export const {segment, seg} = register(['segment', 'seg'], function (rate, pat) {
return pat.struct(pure(true)._fast(rate)).setSteps(rate);
});
@ -2485,16 +2486,21 @@ export const bypass = register(
);
/**
* Loops the pattern inside at `offset` for `cycles`.
* Loops the pattern inside an `offset` for `cycles`.
* If you think of the entire span of time in cycles as a ribbon, you can grab a single piece and loop it.
* @synonym rib
* @param {number} offset start point of loop in cycles
* @param {number} cycles loop length in cycles
* @example
* note("<c d e f>").ribbon(1, 2).fast(2)
* note("<c d e f>").ribbon(1, 2)
* @example
* // Looping a portion of randomness
* note(irand(8).segment(4).scale('C3 minor')).ribbon(1337, 2)
* n(irand(8).segment(4)).scale("c:pentatonic").ribbon(1337, 2)
* @example
* // rhythm generator
* s("bd!16?").ribbon(29,.5)._punchcard()
*/
export const ribbon = register('ribbon', (offset, cycles, pat) => pat.early(offset).restart(pure(1).slow(cycles)));
export const {ribbon, rib} = register(['ribbon', 'rib'], (offset, cycles, pat) => pat.early(offset).restart(pure(1).slow(cycles)));
export const hsla = register('hsla', (h, s, l, a, pat) => {
return pat.color(`hsla(${h}turn,${s * 100}%,${l * 100}%,${a})`);