add more synonyms

This commit is contained in:
Felix Roos 2023-01-12 17:40:58 +01:00
parent 68cc109933
commit ee9b89b6d5
5 changed files with 35 additions and 24 deletions

View File

@ -621,14 +621,15 @@ const generic_params = [
/** /**
* Sets the room size of the reverb, see {@link room}. * Sets the room size of the reverb, see {@link room}.
* *
* @name size * @name roomsize
* @synonyms size
* @param {number | Pattern} size between 0 and 10 * @param {number | Pattern} size between 0 and 10
* @example * @example
* s("bd sd").room(.8).size("<0 1 2 4 8>") * s("bd sd").room(.8).roomsize("<0 1 2 4 8>")
* *
*/ */
// TODO: find out why : // TODO: find out why :
// s("bd sd").room(.8).size("<0 .2 .4 .6 .8 [1,0]>").osc() // s("bd sd").room(.8).roomsize("<0 .2 .4 .6 .8 [1,0]>").osc()
// .. does not work. Is it because room is only one effect? // .. does not work. Is it because room is only one effect?
[ [
'f', 'f',

View File

@ -1903,19 +1903,10 @@ export const jux = register('jux', function (func, pat) {
return pat._juxBy(1, func, pat); return pat._juxBy(1, func, pat);
}); });
export const { stutWith, stutwith } = register(['stutWith', 'stutwith'], function (times, time, func, pat) {
return stack(...listRange(0, times - 1).map((i) => func(pat.late(Fraction(time).mul(i)), i)));
});
export const stut = register('stut', function (times, feedback, time, pat) {
return pat._stutWith(times, time, (pat, i) => pat.velocity(Math.pow(feedback, i)));
});
/** /**
* Superimpose and offset multiple times, applying the given function each time. * Superimpose and offset multiple times, applying the given function each time.
* @name echoWith * @name echoWith
* @memberof Pattern * @synonyms echowith, stutWith, stutwith
* @returns Pattern
* @param {number} times how many times to repeat * @param {number} times how many times to repeat
* @param {number} time cycle offset between iterations * @param {number} time cycle offset between iterations
* @param {function} func function to apply, given the pattern and the iteration index * @param {function} func function to apply, given the pattern and the iteration index
@ -1928,6 +1919,9 @@ export const { echoWith, echowith } = register(['echoWith', 'echowith'], functio
return stack(...listRange(0, times - 1).map((i) => func(pat.late(Fraction(time).mul(i)), i))); return stack(...listRange(0, times - 1).map((i) => func(pat.late(Fraction(time).mul(i)), i)));
}); });
export const stutWith = echoWith;
export const stutwith = echoWith;
/** /**
* Superimpose and offset multiple times, gradually decreasing the velocity * Superimpose and offset multiple times, gradually decreasing the velocity
* @name echo * @name echo
@ -1943,6 +1937,19 @@ export const echo = register('echo', function (times, time, feedback, pat) {
return pat._echoWith(times, time, (pat, i) => pat.velocity(Math.pow(feedback, i))); return pat._echoWith(times, time, (pat, i) => pat.velocity(Math.pow(feedback, i)));
}); });
/**
* Deprecated. Like echo, but the last 2 parameters are flipped.
* @name stut
* @param {number} times how many times to repeat
* @param {number} feedback velocity multiplicator for each iteration
* @param {number} time cycle offset between iterations
* @example
* s("bd sd").stut(3, .8, 1/6)
*/
export const stut = register('stut', function (times, feedback, time, pat) {
return pat._stutWith(times, time, (pat, i) => pat.velocity(Math.pow(feedback, i)));
});
/** /**
* 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. * 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.
* @name iter * @name iter
@ -1968,6 +1975,7 @@ export const iter = register('iter', function (times, pat) {
/** /**
* Like `iter`, but plays the subdivisions in reverse order. Known as iter' in tidalcycles * Like `iter`, but plays the subdivisions in reverse order. Known as iter' in tidalcycles
* @name iterBack * @name iterBack
* @synonyms iterback
* @memberof Pattern * @memberof Pattern
* @returns Pattern * @returns Pattern
* @example * @example
@ -1999,6 +2007,7 @@ export const chunk = register('chunk', function (n, func, pat) {
/** /**
* Like `chunk`, but cycles through the parts in reverse order. Known as chunk' in tidalcycles * Like `chunk`, but cycles through the parts in reverse order. Known as chunk' in tidalcycles
* @name chunkBack * @name chunkBack
* @synonyms chunkback
* @memberof Pattern * @memberof Pattern
* @returns Pattern * @returns Pattern
* @example * @example
@ -2011,7 +2020,7 @@ export const { chunkBack, chunkback } = register(['chunkBack', 'chunkback'], fun
// TODO - redefine elsewhere in terms of mask // TODO - redefine elsewhere in terms of mask
export const bypass = register('bypass', function (on, pat) { export const bypass = register('bypass', function (on, pat) {
on = Boolean(parseInt(on)); on = Boolean(parseInt(on));
return on ? silence : this; return on ? silence : pat;
}); });
// sets absolute duration of haps // sets absolute duration of haps
@ -2020,7 +2029,10 @@ export const duration = register('duration', function (value, pat) {
return pat.withHapSpan((span) => new TimeSpan(span.begin, span.begin.add(value))); return pat.withHapSpan((span) => new TimeSpan(span.begin, span.begin.add(value)));
}); });
// TODO - make control? /**
* Sets the color of the hap in visualizations like pianoroll or highlighting.
*/
// TODO: move this to controls https://github.com/tidalcycles/strudel/issues/288
export const { color, colour } = register(['color', 'colour'], function (color, pat) { export const { color, colour } = register(['color', 'colour'], function (color, pat) {
return pat.withContext((context) => ({ ...context, color })); return pat.withContext((context) => ({ ...context, color }));
}); });

View File

@ -78,12 +78,6 @@
"focusspan", "focusspan",
"zoomArc", "zoomArc",
"zoomarc", "zoomarc",
"stutWith",
"stutwith",
"stut",
"echowith",
"iterback",
"chunkback",
"bypass", "bypass",
"duration", "duration",
"color", "color",

View File

@ -27,4 +27,8 @@ import { JsDoc } from '../../docs/JsDoc';
## echoWith ## echoWith
<JsDoc client:idle name="Pattern.echoWith" h={0} /> <JsDoc client:idle name="echoWith" h={0} />
## stut
<JsDoc client:idle name="stut" h={0} />

View File

@ -99,6 +99,6 @@ global effects use the same chain for all events of the same orbit:
<JsDoc client:idle name="room" h={0} /> <JsDoc client:idle name="room" h={0} />
## size / roomsize ## roomsize
<JsDoc client:idle name="size" h={0} /> <JsDoc client:idle name="roomsize" h={0} />