Tag the remaining functions

This commit is contained in:
Václav Volhejn 2026-01-18 12:16:50 +01:00
parent c1fd8c82c6
commit f8750901f0
3 changed files with 15 additions and 2 deletions

View file

@ -1653,6 +1653,7 @@ export const func = curry((a, b) => reify(b).func(a));
/** /**
* Registers a new pattern method. The method is added to the Pattern class + the standalone function is returned from register. * Registers a new pattern method. The method is added to the Pattern class + the standalone function is returned from register.
* *
* @tags functional
* @param {string | string[]} name name of the function, or an array of names to be used as synonyms * @param {string | string[]} name name of the function, or an array of names to be used as synonyms
* @param {function} func function with 1 or more params, where last is the current pattern * @param {function} func function with 1 or more params, where last is the current pattern
* @param {bool} patternify defaults to true; if set to false, you will have more control over the arguments to `func` as they will be * @param {bool} patternify defaults to true; if set to false, you will have more control over the arguments to `func` as they will be
@ -3843,6 +3844,7 @@ export const chebyshev = _distortWithAlg('chebyshev');
* Turns a list of patterns into a single pattern which outputs list-values * Turns a list of patterns into a single pattern which outputs list-values
* *
* @name parray * @name parray
* @tags combiners
* @returns Pattern * @returns Pattern
*/ */
export const parray = (pats) => { export const parray = (pats) => {
@ -3865,6 +3867,7 @@ const _ensureListPattern = (list) => {
* Can also be used to create a new synth via `s('user').partials(...)` * Can also be used to create a new synth via `s('user').partials(...)`
* *
* @name partials * @name partials
* @tags fx, superdough
* @param {number[] | Pattern} magnitudes List of [0, 1] magnitudes for partials. 0th entry is the fundamental harmonic (i.e. DC offset is skipped) * @param {number[] | Pattern} magnitudes List of [0, 1] magnitudes for partials. 0th entry is the fundamental harmonic (i.e. DC offset is skipped)
* @example * @example
* s("user").seg(16).n(irand(8)).scale("A:major") * s("user").seg(16).n(irand(8)).scale("A:major")
@ -3886,6 +3889,7 @@ export const partials = (list) => {
* Rotates the harmonics of one of the core synths ('sine', 'tri', 'saw', 'user', ..) by a list of phases * Rotates the harmonics of one of the core synths ('sine', 'tri', 'saw', 'user', ..) by a list of phases
* *
* @name phases * @name phases
* @tags fx, superdough
* @param {number[] | Pattern} phases List of [0, 1) phases for partials. 0th entry is the fundamental phase (i.e. DC offset is skipped) * @param {number[] | Pattern} phases List of [0, 1) phases for partials. 0th entry is the fundamental phase (i.e. DC offset is skipped)
* @example * @example
* // Phase cancellation * // Phase cancellation

View file

@ -286,7 +286,7 @@ export const getRandsAtTime = (t, n = 1, seed = 0) => {
* precise RNG, try `useRNG('precise')`. * precise RNG, try `useRNG('precise')`.
* *
* @name useRNG * @name useRNG
* @tags generators, internals * @tags generators, math
* @param {string} mod - Mode. One of 'legacy', 'precise' * @param {string} mod - Mode. One of 'legacy', 'precise'
* @example * @example
* useRNG('legacy') * useRNG('legacy')
@ -376,6 +376,7 @@ export const binaryNL = (n, nBits = 16) => {
* Creates a list of random numbers of the given length * Creates a list of random numbers of the given length
* *
* @name randL * @name randL
* @tags generators
* @param {number} n Number of random numbers to sample * @param {number} n Number of random numbers to sample
* @example * @example
* s("saw").seg(16).n(irand(12)).scale("F1:minor") * s("saw").seg(16).n(irand(12)).scale("F1:minor")
@ -434,6 +435,7 @@ export const scramble = register('scramble', (n, pat) => {
/** /**
* Modify a pattern by applying a function to the `randomSeed` control if present * Modify a pattern by applying a function to the `randomSeed` control if present
* *
* @tags math
* @param {Function} func Function from seed (or undefined) to seed (or undefined) * @param {Function} func Function from seed (or undefined) to seed (or undefined)
* @param {Pattern} pat Pattern to update * @param {Pattern} pat Pattern to update
* @returns Pattern * @returns Pattern
@ -453,6 +455,7 @@ export const withSeed = (func, pat) => {
* that use randomness, like `shuffle` and `sometimes`. * that use randomness, like `shuffle` and `sometimes`.
* *
* @name seed * @name seed
* @tags math
* @param {number} n A new seed. Can be any number. * @param {number} n A new seed. Can be any number.
* @example * @example
* $: s("hh*4").degrade(); * $: s("hh*4").degrade();
@ -1031,6 +1034,8 @@ export const keyDown = register('keyDown', function (pat) {
* event durations, from the pattern that it is combined with. * event durations, from the pattern that it is combined with.
* For example `cyclesPer.struct("1 1 [1 1] 1")` would give the same as `"0.25 0.25 [0.125 0.125] 0.25"`. * For example `cyclesPer.struct("1 1 [1 1] 1")` would give the same as `"0.25 0.25 [0.125 0.125] 0.25"`.
* See also its reciprocal, `per`, also known as `perCycle`. * See also its reciprocal, `per`, also known as `perCycle`.
*
* @tags temporal
* @example * @example
* // Shorter events are lower in pitch * // Shorter events are lower in pitch
* sound("saw saw [saw saw] saw") * sound("saw saw [saw saw] saw")
@ -1049,6 +1054,7 @@ export const cyclesPer = new Pattern(function (state) {
* event durations, from the pattern that it is combined with. * event durations, from the pattern that it is combined with.
* For example `per.struct("1 1 [1 1] 1")` would give the same as `"4 4 [8 8] 4"`. * For example `per.struct("1 1 [1 1] 1")` would give the same as `"4 4 [8 8] 4"`.
* See also its reciprocal, `cyclesPer`. * See also its reciprocal, `cyclesPer`.
* @tags temporal
* @synonyms perCycle * @synonyms perCycle
* @example * @example
* // Shorter events are more distorted * // Shorter events are more distorted
@ -1066,6 +1072,7 @@ export const perCycle = per;
* particular, where the event duration halves, the * particular, where the event duration halves, the
* returned value increases by one. `perx.struct("1 1 [1 [1 1]] 1")` would therefore be * returned value increases by one. `perx.struct("1 1 [1 [1 1]] 1")` would therefore be
* the same as `"3 3 [4 [5 5]] 3"`. * the same as `"3 3 [4 [5 5]] 3"`.
* @tags temporal
*/ */
export const perx = new Pattern(function (state) { export const perx = new Pattern(function (state) {
const n = Fraction(1).div(state.span.duration); const n = Fraction(1).div(state.span.duration);

View file

@ -110,7 +110,9 @@ export function getCommonSampleInfo(hapValue, bank) {
return { transpose, url, index, midi, label }; return { transpose, url, index, midi, label };
} }
/** Selects entries from `source` and renames them via `map` */ /** Selects entries from `source` and renames them via `map`
* @tags internals
*/
export const pickAndRename = (source, map) => { export const pickAndRename = (source, map) => {
return Object.fromEntries(Object.entries(map).map(([newKey, oldKey]) => [newKey, source[oldKey]])); return Object.fromEntries(Object.entries(map).map(([newKey, oldKey]) => [newKey, source[oldKey]]));
}; };