From d5a1832f311b820a92bf2a6d71c72f939dba21c8 Mon Sep 17 00:00:00 2001 From: alex Date: Fri, 6 May 2022 15:42:48 +0200 Subject: [PATCH 01/26] document some mathematical pattern methods --- packages/core/pattern.mjs | 94 +++++++++++++++++++++++++++++---------- 1 file changed, 71 insertions(+), 23 deletions(-) diff --git a/packages/core/pattern.mjs b/packages/core/pattern.mjs index 6c4335a3..89ccc654 100644 --- a/packages/core/pattern.mjs +++ b/packages/core/pattern.mjs @@ -67,7 +67,7 @@ export class Pattern { * @param {Function} func the function to apply * @returns Pattern */ - withQueryTime(func) { + withQueryTime(func) { return new Pattern((state) => this.query(state.withSpan((span) => span.withTime(func)))); } @@ -75,7 +75,7 @@ export class Pattern { * Similar to {@link Pattern#withQuerySpan|withQuerySpan}, but the function is applied to the timespans * of all haps returned by pattern queries (both `part` timespans, and where * present, `whole` timespans). - * @param {Function} func + * @param {Function} func * @returns Pattern */ withHapSpan(func) { @@ -88,31 +88,31 @@ export class Pattern { * @param {Function} func the function to apply * @returns Pattern */ - withHapTime(func) { + withHapTime(func) { return this.withHapSpan((span) => span.withTime(func)); } /** * Returns a new pattern with the given function applied to the list of haps returned by every query. - * @param {Function} func + * @param {Function} func * @returns Pattern */ - _withHaps(func) { + _withHaps(func) { return new Pattern((state) => func(this.query(state))); } /** * As with {@link Pattern#_withHaps}, but applies the function to every hap, rather than every list of haps. - * @param {Function} func + * @param {Function} func * @returns Pattern */ - _withHap(func) { + _withHap(func) { return this._withHaps((haps) => haps.map(func)); } /** * Returns a new pattern with the context field set to every hap set to the given value. - * @param {*} context + * @param {*} context * @returns Pattern */ _setContext(context) { @@ -121,7 +121,7 @@ export class Pattern { /** * Returns a new pattern with the given function applied to the context field of every hap. - * @param {Function} func + * @param {Function} func * @returns Pattern */ _withContext(func) { @@ -129,7 +129,7 @@ export class Pattern { } /** - * Returns a new pattern with the context field of every hap set to an empty object. + * Returns a new pattern with the context field of every hap set to an empty object. * @returns Pattern */ _stripContext() { @@ -139,8 +139,8 @@ export class Pattern { /** * Returns a new pattern with the given location information added to the * context of every hap. - * @param {Number} start - * @param {Number} end + * @param {Number} start + * @param {Number} end * @returns Pattern */ withLocation(start, end) { @@ -183,7 +183,7 @@ export class Pattern { /** * Returns a new pattern, with the function applied to the value of * each hap. It has the alias {@link Pattern#fmap|fmap}. - * @param {Function} func + * @param {Function} func * @returns Pattern */ withValue(func) { @@ -193,7 +193,7 @@ export class Pattern { /** * see {@link Pattern#withValue|withValue} */ - fmap(func) { + fmap(func) { return this.withValue(func); } @@ -209,7 +209,7 @@ export class Pattern { /** * As with {@link Pattern#_filterHaps}, but the function is applied to values * inside haps. - * @param {Function} value_test + * @param {Function} value_test * @returns Pattern */ _filterValues(value_test) { @@ -231,7 +231,7 @@ export class Pattern { * as its `part` timespan. * @returns Pattern */ - onsetsOnly() { + onsetsOnly() { // Returns a new pattern that will only return haps where the start // of the 'whole' timespan matches the start of the 'part' // timespan, i.e. the haps that include their 'onset'. @@ -278,12 +278,12 @@ export class Pattern { /** * When this method is called on a pattern of functions, it matches its haps * with those in the given pattern of values. A new pattern is returned, with - * each matching value applied to the corresponding function. + * each matching value applied to the corresponding function. * * 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. - * @param {Pattern} pat_val + * @param {Pattern} pat_val * @returns Pattern */ appBoth(pat_val) { @@ -303,7 +303,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). - * @param {Pattern} pat_val + * @param {Pattern} pat_val * @returns Pattern */ appLeft(pat_val) { @@ -333,7 +333,7 @@ export class Pattern { * As with {@link Pattern#appLeft|appLeft}, but `whole` timespans are instead taken from the * pattern of values, i.e. structure is preserved from the right hand/outer * pattern. - * @param {Pattern} pat_val + * @param {Pattern} pat_val * @returns Pattern */ appRight(pat_val) { @@ -467,35 +467,83 @@ export class Pattern { return result; } + /** + * Assumes a numerical pattern. Returns a new pattern with all values rounded + * to the nearest integer. + * @returns Pattern + */ round() { return this._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`. + * @returns Pattern + */ floor() { return this._asNumber().fmap((v) => Math.floor(v)); } + /** + * Assumes a numerical pattern. Returns a new pattern with all values set to + * their mathematical ceiling. E.g. `3.2` replaced with `4`, and `-4.2` + * replaced with `-4`. + * @returns Pattern + */ ceil() { return this._asNumber().fmap((v) => Math.ceil(v)); } + /** + * 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 + * @returns Pattern + */ _toBipolar() { return this.fmap((x) => x * 2 - 1); } + + /** + * 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 + * @returns Pattern + */ _fromBipolar() { return this.fmap((x) => (x + 1) / 2); } - // Assumes source pattern of numbers in range 0..1 + /** + * Assumes a numerical pattern, containing unipolar values in the range 0 .. + * 1. Returns a new pattern with values scaled to the given min/max range. + * @param {Number} min + * @param {Number} max + * @returns Pattern + */ range(min, max) { return this.mul(max - min).add(min); } + /** + * Assumes a numerical pattern, containing unipolar values in the range 0 .. + * 1. Returns a new pattern with values scaled to the given min/max range, + * following an exponential curve. + * @param {Number} min + * @param {Number} max + * @returns Pattern + */ rangex(min, max) { return this.range(Math.log(min), Math.log(max)).fmap(Math.exp); } - // Assumes source pattern of numbers in range -1..1 + /** + * Assumes a numerical pattern, containing bipolar values in the range -1 .. + * 1. Returns a new pattern with values scaled to the given min/max range. + * @param {Number} min + * @param {Number} max + * @returns Pattern + */ range2(min, max) { return this._fromBipolar().range(min, max); } @@ -979,7 +1027,7 @@ function _composeOp(a, b, func) { } // Make composers -(function() { +(function () { const num = (pat) => pat._asNumber(); const numOrString = (pat) => pat._asNumber(false, true); From f5e5ef86623237d44dd482d3c6424dd541ee5690 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Sat, 7 May 2022 10:27:14 +0200 Subject: [PATCH 02/26] doc: drawLine --- packages/core/drawLine.mjs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/packages/core/drawLine.mjs b/packages/core/drawLine.mjs index 0bfe458c..276303c9 100644 --- a/packages/core/drawLine.mjs +++ b/packages/core/drawLine.mjs @@ -6,6 +6,22 @@ This program is free software: you can redistribute it and/or modify it under th import Fraction, { gcd } from './fraction.mjs'; +/** + * Intended for a debugging, drawLine renders the pattern as a string, where each character represents the same time span. + * Should only be used with single characters as values, otherwise the character slots will be messed up. + * Character legend: + * + * - "|" cycle separator + * - "-" hold previous value + * - "." silence + * + * @param {Pattern} pat pattern to use + * @param {number} chars max number of characters (approximately) + * @returns string + * @example + * const line = drawLine(pattern, 10); // |0--123|0--123 + * console.log(line); + */ function drawLine(pat, chars = 60) { let cycle = 0; let pos = Fraction(0); From 608283ba6574a37b8288630a69d866aa7a64e858 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Sat, 7 May 2022 10:29:16 +0200 Subject: [PATCH 03/26] doc: euclid --- packages/core/euclid.mjs | 59 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/packages/core/euclid.mjs b/packages/core/euclid.mjs index 4e4e3bcf..9cd8b352 100644 --- a/packages/core/euclid.mjs +++ b/packages/core/euclid.mjs @@ -17,10 +17,69 @@ const euclid = (pulses, steps, rotation = 0) => { return b; }; +/** + * Changes the structure of the pattern to form an euclidean rhythm. + * Euclidian rhythms are rhythms obtained using the greatest common divisor of two numbers. + * They were described in 2004 by Godfried Toussaint, a canadian computer scientist. + * Euclidian rhythms are really useful for computer/algorithmic music because they can accurately + * describe a large number of rhythms used in the most important music world traditions. + * + * @param {number} pulses the number of onsets / beats + * @param {number} steps the number of steps to fill + * @param {number} rotation (optional) offset in steps + * @returns Pattern + * @example // The Cuban tresillo pattern. + * "c3".euclid(3,8) + * @example // A thirteenth century Persian rhythm called Khafif-e-ramal. + * "c3".euclid(2,5) + * @example // The archetypal pattern of the Cumbia from Colombia, as well as a Calypso rhythm from Trinidad. + * "c3".euclid(3,4) + * @example // Another thirteenth century Persian rhythm by the name of Khafif-e-ramal, as well as a Rumanian folk-dance rhythm. + * "c3".euclid(3,5,2) + * @example // A Ruchenitza rhythm used in a Bulgarian folk-dance. + * "c3".euclid(3,7) + * @example // The Cuban tresillo pattern. + * "c3".euclid(3,8) + * @example // Another Ruchenitza Bulgarian folk-dance rhythm. + * "c3".euclid(4,7) + * @example // The Aksak rhythm of Turkey. + * "c3".euclid(4,9) + * @example // The metric pattern used by Frank Zappa in his piece titled Outside Now. + * "c3".euclid(4,11) + * @example // Yields the York-Samai pattern, a popular Arab rhythm. + * "c3".euclid(5,6) + * @example // The Nawakhat pattern, another popular Arab rhythm. + * "c3".euclid(5,7) + * @example // The Cuban cinquillo pattern. + * "c3".euclid(5,8) + * @example // A popular Arab rhythm called Agsag-Samai. + * "c3".euclid(5,9) + * @example // The metric pattern used by Moussorgsky in Pictures at an Exhibition. + * "c3".euclid(5,11) + * @example // The Venda clapping pattern of a South African children’s song. + * "c3".euclid(5,12) + * @example // The Bossa-Nova rhythm necklace of Brazil. + * "c3".euclid(5,16) + * @example // A typical rhythm played on the Bendir (frame drum). + * "c3".euclid(7,8) + * @example // A common West African bell pattern. + * "c3".euclid(7,12) + * @example // A Samba rhythm necklace from Brazil. + * "c3".euclid(7,16,14) + * @example // A rhythm necklace used in the Central African Republic. + * "c3".euclid(9,16) + * @example // A rhythm necklace of the Aka Pygmies of Central Africa. + * "c3".euclid(11,24,14) + * @example // Another rhythm necklace of the Aka Pygmies of the upper Sangha. + * "c3".euclid(13,24,5) + */ Pattern.prototype.euclid = function (pulses, steps, rotation = 0) { return this.struct(euclid(pulses, steps, rotation)); }; +/** + * Similar to {@link Pattern#euclid}, but each pulse is held until the next pulse, so there will be no gaps. + */ Pattern.prototype.euclidLegato = function (pulses, steps, rotation = 0) { const bin_pat = euclid(pulses, steps, rotation); const firstOne = bin_pat.indexOf(1); From f2a70396d10987ce870066f6828a2dadaa936cb4 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Fri, 20 May 2022 21:56:55 +0200 Subject: [PATCH 04/26] add autogenerated api doc to bottom of tutorial --- doc.json | 1609 +++++++++++++++++++++++++++++++----- packages/core/drawLine.mjs | 6 +- packages/core/euclid.mjs | 1 + packages/core/pattern.mjs | 20 +- tutorial/ApiDoc.jsx | 45 + tutorial/tutorial.mdx | 11 + 6 files changed, 1477 insertions(+), 215 deletions(-) create mode 100644 tutorial/ApiDoc.jsx diff --git a/doc.json b/doc.json index f30bd098..6306c8d9 100644 --- a/doc.json +++ b/doc.json @@ -1,18 +1,217 @@ { "docs": [ + { + "comment": "/**\n * Intended for a debugging, drawLine renders the pattern as a string, where each character represents the same time span.\n * Should only be used with single characters as values, otherwise the character slots will be messed up.\n * Character legend: \n * \n * - \"|\" cycle separator\n * - \"-\" hold previous value\n * - \".\" silence\n *\n * @param {Pattern} pat pattern to use\n * @param {number} chars max number of characters (approximately)\n * @returns string\n * @example\n * const line = drawLine(\"0 [1 2 3]\", 10); // |0--123|0--123\n * console.log(line);\n */", + "meta": { + "range": [ + 1408, + 2778 + ], + "filename": "drawLine.mjs", + "lineno": 25, + "columnno": 0, + "path": "/home/felix/projects/strudel/packages/core", + "code": { + "id": "astnode100000596", + "name": "drawLine", + "type": "FunctionDeclaration", + "paramnames": [ + "pat", + "chars" + ] + }, + "vars": { + "cycle": "drawLine~cycle", + "pos": "drawLine~pos", + "lines": "drawLine~lines", + "emptyLine": "drawLine~emptyLine", + "haps": "drawLine~haps", + "durations": "drawLine~durations", + "": null, + "charFraction": "drawLine~charFraction", + "totalSlots": "drawLine~totalSlots", + "i": "drawLine~i", + "undefined": null, + "matches": "drawLine~matches", + "missingLines": "drawLine~missingLines" + } + }, + "description": "

Intended for a debugging, drawLine renders the pattern as a string, where each character represents the same time span.\nShould only be used with single characters as values, otherwise the character slots will be messed up.\nCharacter legend:

\n
    \n
  • "|" cycle separator
  • \n
  • "-" hold previous value
  • \n
  • "." silence
  • \n
", + "params": [ + { + "type": { + "names": [ + "Pattern" + ] + }, + "description": "

pattern to use

", + "name": "pat" + }, + { + "type": { + "names": [ + "number" + ] + }, + "description": "

max number of characters (approximately)

", + "name": "chars", + "defaultvalue": 60 + } + ], + "returns": [ + { + "description": "

string

" + } + ], + "examples": [ + "const line = drawLine(\"0 [1 2 3]\", 10); // |0--123|0--123\nconsole.log(line);" + ], + "name": "drawLine", + "longname": "drawLine", + "kind": "function", + "scope": "global", + "___id": "T000002R000010", + "___s": true + }, + { + "comment": "/**\n * Changes the structure of the pattern to form an euclidean rhythm.\n * Euclidian rhythms are rhythms obtained using the greatest common divisor of two numbers.\n * They were described in 2004 by Godfried Toussaint, a canadian computer scientist.\n * Euclidian rhythms are really useful for computer/algorithmic music because they can accurately\n * describe a large number of rhythms used in the most important music world traditions.\n *\n * @memberof Pattern\n * @param {number} pulses the number of onsets / beats\n * @param {number} steps the number of steps to fill\n * @param {number} rotation (optional) offset in steps\n * @returns Pattern\n * @example // The Cuban tresillo pattern.\n * \"c3\".euclid(3,8)\n * @example // A thirteenth century Persian rhythm called Khafif-e-ramal.\n * \"c3\".euclid(2,5)\n * @example // The archetypal pattern of the Cumbia from Colombia, as well as a Calypso rhythm from Trinidad.\n * \"c3\".euclid(3,4)\n * @example // Another thirteenth century Persian rhythm by the name of Khafif-e-ramal, as well as a Rumanian folk-dance rhythm.\n * \"c3\".euclid(3,5,2)\n * @example // A Ruchenitza rhythm used in a Bulgarian folk-dance.\n * \"c3\".euclid(3,7)\n * @example // The Cuban tresillo pattern.\n * \"c3\".euclid(3,8)\n * @example // Another Ruchenitza Bulgarian folk-dance rhythm.\n * \"c3\".euclid(4,7)\n * @example // The Aksak rhythm of Turkey.\n * \"c3\".euclid(4,9)\n * @example // The metric pattern used by Frank Zappa in his piece titled Outside Now.\n * \"c3\".euclid(4,11)\n * @example // Yields the York-Samai pattern, a popular Arab rhythm.\n * \"c3\".euclid(5,6)\n * @example // The Nawakhat pattern, another popular Arab rhythm.\n * \"c3\".euclid(5,7)\n * @example // The Cuban cinquillo pattern.\n * \"c3\".euclid(5,8)\n * @example // A popular Arab rhythm called Agsag-Samai.\n * \"c3\".euclid(5,9)\n * @example // The metric pattern used by Moussorgsky in Pictures at an Exhibition.\n * \"c3\".euclid(5,11)\n * @example // The Venda clapping pattern of a South African children’s song.\n * \"c3\".euclid(5,12)\n * @example // The Bossa-Nova rhythm necklace of Brazil.\n * \"c3\".euclid(5,16)\n * @example // A typical rhythm played on the Bendir (frame drum).\n * \"c3\".euclid(7,8)\n * @example // A common West African bell pattern.\n * \"c3\".euclid(7,12)\n * @example // A Samba rhythm necklace from Brazil.\n * \"c3\".euclid(7,16,14)\n * @example // A rhythm necklace used in the Central African Republic.\n * \"c3\".euclid(9,16)\n * @example // A rhythm necklace of the Aka Pygmies of Central Africa.\n * \"c3\".euclid(11,24,14)\n * @example // Another rhythm necklace of the Aka Pygmies of the upper Sangha.\n * \"c3\".euclid(13,24,5)\n */", + "meta": { + "range": [ + 3722, + 3846 + ], + "filename": "euclid.mjs", + "lineno": 77, + "columnno": 0, + "path": "/home/felix/projects/strudel/packages/core", + "code": { + "id": "astnode100000894", + "name": "Pattern.prototype.euclid", + "type": "FunctionExpression", + "paramnames": [ + "pulses", + "steps", + "rotation" + ] + } + }, + "description": "

Changes the structure of the pattern to form an euclidean rhythm.\nEuclidian rhythms are rhythms obtained using the greatest common divisor of two numbers.\nThey were described in 2004 by Godfried Toussaint, a canadian computer scientist.\nEuclidian rhythms are really useful for computer/algorithmic music because they can accurately\ndescribe a large number of rhythms used in the most important music world traditions.

", + "memberof": "Pattern", + "params": [ + { + "type": { + "names": [ + "number" + ] + }, + "description": "

the number of onsets / beats

", + "name": "pulses" + }, + { + "type": { + "names": [ + "number" + ] + }, + "description": "

the number of steps to fill

", + "name": "steps" + }, + { + "type": { + "names": [ + "number" + ] + }, + "description": "

(optional) offset in steps

", + "name": "rotation" + } + ], + "returns": [ + { + "description": "

Pattern

" + } + ], + "examples": [ + "// The Cuban tresillo pattern.\n\"c3\".euclid(3,8)", + "// A thirteenth century Persian rhythm called Khafif-e-ramal.\n\"c3\".euclid(2,5)", + "// The archetypal pattern of the Cumbia from Colombia, as well as a Calypso rhythm from Trinidad.\n\"c3\".euclid(3,4)", + "// Another thirteenth century Persian rhythm by the name of Khafif-e-ramal, as well as a Rumanian folk-dance rhythm.\n\"c3\".euclid(3,5,2)", + "// A Ruchenitza rhythm used in a Bulgarian folk-dance.\n\"c3\".euclid(3,7)", + "// The Cuban tresillo pattern.\n\"c3\".euclid(3,8)", + "// Another Ruchenitza Bulgarian folk-dance rhythm.\n\"c3\".euclid(4,7)", + "// The Aksak rhythm of Turkey.\n\"c3\".euclid(4,9)", + "// The metric pattern used by Frank Zappa in his piece titled Outside Now.\n\"c3\".euclid(4,11)", + "// Yields the York-Samai pattern, a popular Arab rhythm.\n\"c3\".euclid(5,6)", + "// The Nawakhat pattern, another popular Arab rhythm.\n\"c3\".euclid(5,7)", + "// The Cuban cinquillo pattern.\n\"c3\".euclid(5,8)", + "// A popular Arab rhythm called Agsag-Samai.\n\"c3\".euclid(5,9)", + "// The metric pattern used by Moussorgsky in Pictures at an Exhibition.\n\"c3\".euclid(5,11)", + "// The Venda clapping pattern of a South African children’s song.\n\"c3\".euclid(5,12)", + "// The Bossa-Nova rhythm necklace of Brazil.\n\"c3\".euclid(5,16)", + "// A typical rhythm played on the Bendir (frame drum).\n\"c3\".euclid(7,8)", + "// A common West African bell pattern.\n\"c3\".euclid(7,12)", + "// A Samba rhythm necklace from Brazil.\n\"c3\".euclid(7,16,14)", + "// A rhythm necklace used in the Central African Republic.\n\"c3\".euclid(9,16)", + "// A rhythm necklace of the Aka Pygmies of Central Africa.\n\"c3\".euclid(11,24,14)", + "// Another rhythm necklace of the Aka Pygmies of the upper Sangha.\n\"c3\".euclid(13,24,5)" + ], + "name": "euclid", + "longname": "Pattern#euclid", + "kind": "function", + "scope": "instance", + "___id": "T000002R000034", + "___s": true + }, + { + "comment": "/**\n * Similar to {@link Pattern#euclid}, but each pulse is held until the next pulse, so there will be no gaps.\n */", + "meta": { + "range": [ + 3966, + 4337 + ], + "filename": "euclid.mjs", + "lineno": 84, + "columnno": 0, + "path": "/home/felix/projects/strudel/packages/core", + "code": { + "id": "astnode100000918", + "name": "Pattern.prototype.euclidLegato", + "type": "FunctionExpression", + "paramnames": [ + "pulses", + "steps", + "rotation" + ] + }, + "vars": { + "bin_pat": "Pattern#euclidLegato~bin_pat", + "firstOne": "Pattern#euclidLegato~firstOne", + "gapless": "Pattern#euclidLegato~gapless", + "": null + } + }, + "description": "

Similar to {@link Pattern#euclid}, but each pulse is held until the next pulse, so there will be no gaps.

", + "name": "euclidLegato", + "longname": "Pattern#euclidLegato", + "kind": "function", + "memberof": "Pattern", + "scope": "instance", + "___id": "T000002R000035", + "___s": true + }, { "comment": "/** @class Class representing a pattern. */", "meta": { "range": [ 1178, - 27040 + 31003 ], "filename": "pattern.mjs", "lineno": 17, "columnno": 0, - "path": "/Users/felix/projects/strudel/packages/core", + "path": "/home/felix/projects/strudel/packages/core", "code": { - "id": "astnode100001837", + "id": "astnode100005731", "name": "exports.Pattern", "type": "ClassDeclaration" } @@ -35,22 +234,22 @@ "name": "query" } ], - "___id": "T000002R000098", + "___id": "T000002R000495", "___s": true }, { - "comment": "/**\n * query events insude the tiven time span\n *\n * @param {Fraction | number} begin from time\n * @param {Fraction | number} end to time\n * @returns Hap[]\n * @example\n * const pattern = sequence('a', ['b', 'c']);\n * const events = pattern.queryArc(0, 1);\n */", + "comment": "/**\n * query haps insude the tiven time span\n *\n * @param {Fraction | number} begin from time\n * @param {Fraction | number} end to time\n * @returns Hap[]\n * @example\n * const pattern = sequence('a', ['b', 'c']);\n * const haps = pattern.queryArc(0, 1);\n */", "meta": { "range": [ - 1642, - 1728 + 1638, + 1724 ], "filename": "pattern.mjs", "lineno": 36, "columnno": 2, - "path": "/Users/felix/projects/strudel/packages/core", + "path": "/home/felix/projects/strudel/packages/core", "code": { - "id": "astnode100001852", + "id": "astnode100005746", "name": "Pattern#queryArc", "type": "MethodDefinition", "paramnames": [ @@ -62,7 +261,7 @@ "": null } }, - "description": "

query events insude the tiven time span

", + "description": "

query haps insude the tiven time span

", "params": [ { "type": { @@ -91,29 +290,29 @@ } ], "examples": [ - "const pattern = sequence('a', ['b', 'c']);\nconst events = pattern.queryArc(0, 1);" + "const pattern = sequence('a', ['b', 'c']);\nconst haps = pattern.queryArc(0, 1);" ], "name": "queryArc", "longname": "Pattern#queryArc", "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000100", + "___id": "T000002R000497", "___s": true }, { - "comment": "/**\n * Returns a new pattern, with queries split at cycle boundaries. This makes\n * some calculations easier to express, as all events are then constrained to\n * happen within a cycle.\n * @returns Pattern\n */", + "comment": "/**\n * Returns a new pattern, with queries split at cycle boundaries. This makes\n * some calculations easier to express, as all haps are then constrained to\n * happen within a cycle.\n * @returns Pattern\n */", "meta": { "range": [ - 1953, - 2154 + 1947, + 2148 ], "filename": "pattern.mjs", "lineno": 46, "columnno": 2, - "path": "/Users/felix/projects/strudel/packages/core", + "path": "/home/felix/projects/strudel/packages/core", "code": { - "id": "astnode100001869", + "id": "astnode100005763", "name": "Pattern#_splitQueries", "type": "MethodDefinition", "paramnames": [] @@ -122,7 +321,7 @@ "": null } }, - "description": "

Returns a new pattern, with queries split at cycle boundaries. This makes\nsome calculations easier to express, as all events are then constrained to\nhappen within a cycle.

", + "description": "

Returns a new pattern, with queries split at cycle boundaries. This makes\nsome calculations easier to express, as all haps are then constrained to\nhappen within a cycle.

", "returns": [ { "description": "

Pattern

" @@ -134,22 +333,22 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000101", + "___id": "T000002R000498", "___s": true }, { "comment": "/**\n * Returns a new pattern, where the given function is applied to the query\n * timespan before passing it to the original pattern.\n * @param {Function} func the function to apply\n * @returns Pattern\n */", "meta": { "range": [ - 2376, - 2470 + 2370, + 2464 ], "filename": "pattern.mjs", "lineno": 60, "columnno": 2, - "path": "/Users/felix/projects/strudel/packages/core", + "path": "/home/felix/projects/strudel/packages/core", "code": { - "id": "astnode100001909", + "id": "astnode100005803", "name": "Pattern#withQuerySpan", "type": "MethodDefinition", "paramnames": [ @@ -182,22 +381,22 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000104", + "___id": "T000002R000501", "___s": true }, { - "comment": "/**\n * As with {@link Pattern#withQuerySpan|withQuerySpan}, but the function is applied to both the\n * begin and end time of the query timespan.\n * @param {Function} func the function to apply\n * @returns Pattern\n */", + "comment": "/**\n * As with {@link Pattern#withQuerySpan}, but the function is applied to both the\n * begin and end time of the query timespan.\n * @param {Function} func the function to apply\n * @returns Pattern\n */", "meta": { "range": [ - 2704, - 2823 + 2683, + 2802 ], "filename": "pattern.mjs", "lineno": 70, - "columnno": 3, - "path": "/Users/felix/projects/strudel/packages/core", + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", "code": { - "id": "astnode100001928", + "id": "astnode100005822", "name": "Pattern#withQueryTime", "type": "MethodDefinition", "paramnames": [ @@ -208,7 +407,7 @@ "": null } }, - "description": "

As with {@link Pattern#withQuerySpan|withQuerySpan}, but the function is applied to both the\nbegin and end time of the query timespan.

", + "description": "

As with {@link Pattern#withQuerySpan}, but the function is applied to both the\nbegin and end time of the query timespan.

", "params": [ { "type": { @@ -230,23 +429,23 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000105", + "___id": "T000002R000502", "___s": true }, { - "comment": "/**\n * Similar to {@link Pattern#withQuerySpan|withQuerySpan}, but the function is applied to the timespans\n * of all haps returned by pattern queries (both `part` timespans, and where\n * present, `whole` timespans).\n * @param {Function} func \n * @returns Pattern\n */", + "comment": "/**\n * Similar to {@link Pattern#withQuerySpan}, but the function is applied to the timespans\n * of all haps returned by pattern queries (both `part` timespans, and where\n * present, `whole` timespans).\n * @param {Function} func\n * @returns Pattern\n */", "meta": { "range": [ - 3109, - 3221 + 3073, + 3183 ], "filename": "pattern.mjs", "lineno": 81, "columnno": 2, - "path": "/Users/felix/projects/strudel/packages/core", + "path": "/home/felix/projects/strudel/packages/core", "code": { - "id": "astnode100001953", - "name": "Pattern#withEventSpan", + "id": "astnode100005847", + "name": "Pattern#withHapSpan", "type": "MethodDefinition", "paramnames": [ "func" @@ -256,7 +455,7 @@ "": null } }, - "description": "

Similar to {@link Pattern#withQuerySpan|withQuerySpan}, but the function is applied to the timespans\nof all haps returned by pattern queries (both part timespans, and where\npresent, whole timespans).

", + "description": "

Similar to {@link Pattern#withQuerySpan}, but the function is applied to the timespans\nof all haps returned by pattern queries (both part timespans, and where\npresent, whole timespans).

", "params": [ { "type": { @@ -272,28 +471,28 @@ "description": "

Pattern

" } ], - "name": "withEventSpan", - "longname": "Pattern#withEventSpan", + "name": "withHapSpan", + "longname": "Pattern#withHapSpan", "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000106", + "___id": "T000002R000503", "___s": true }, { - "comment": "/**\n * As with {@link Pattern#withEventSpan|withEventSpan}, but the function is applied to both the\n * begin and end time of the hap timespans.\n * @param {Function} func the function to apply\n * @returns Pattern\n */", + "comment": "/**\n * As with {@link Pattern#withHapSpan}, but the function is applied to both the\n * begin and end time of the hap timespans.\n * @param {Function} func the function to apply\n * @returns Pattern\n */", "meta": { "range": [ - 3454, - 3654 + 3399, + 3482 ], "filename": "pattern.mjs", "lineno": 91, - "columnno": 3, - "path": "/Users/felix/projects/strudel/packages/core", + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", "code": { - "id": "astnode100001978", - "name": "Pattern#withEventTime", + "id": "astnode100005872", + "name": "Pattern#withHapTime", "type": "MethodDefinition", "paramnames": [ "func" @@ -303,7 +502,7 @@ "": null } }, - "description": "

As with {@link Pattern#withEventSpan|withEventSpan}, but the function is applied to both the\nbegin and end time of the hap timespans.

", + "description": "

As with {@link Pattern#withHapSpan}, but the function is applied to both the\nbegin and end time of the hap timespans.

", "params": [ { "type": { @@ -320,27 +519,307 @@ "description": "

Pattern

" } ], - "name": "withEventTime", - "longname": "Pattern#withEventTime", + "name": "withHapTime", + "longname": "Pattern#withHapTime", "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000107", + "___id": "T000002R000504", "___s": true }, { - "comment": "/**\n * Returns a new pattern, with the function applied to the value of\n * each event. It has the alias {@link Pattern#fmap|fmap}.\n * @param {Function} func \n * @returns Pattern\n */", + "comment": "/**\n * Returns a new pattern with the given function applied to the list of haps returned by every query.\n * @param {Function} func\n * @returns Pattern\n */", "meta": { "range": [ - 5493, - 5602 + 3652, + 3733 ], "filename": "pattern.mjs", - "lineno": 160, + "lineno": 100, "columnno": 2, - "path": "/Users/felix/projects/strudel/packages/core", + "path": "/home/felix/projects/strudel/packages/core", "code": { - "id": "astnode100002295", + "id": "astnode100005889", + "name": "Pattern#_withHaps", + "type": "MethodDefinition", + "paramnames": [ + "func" + ] + }, + "vars": { + "": null + } + }, + "description": "

Returns a new pattern with the given function applied to the list of haps returned by every query.

", + "params": [ + { + "type": { + "names": [ + "function" + ] + }, + "name": "func" + } + ], + "returns": [ + { + "description": "

Pattern

" + } + ], + "name": "_withHaps", + "longname": "Pattern#_withHaps", + "kind": "function", + "memberof": "Pattern", + "scope": "instance", + "___id": "T000002R000505", + "___s": true + }, + { + "comment": "/**\n * As with {@link Pattern#_withHaps}, but applies the function to every hap, rather than every list of haps.\n * @param {Function} func\n * @returns Pattern\n */", + "meta": { + "range": [ + 3910, + 3983 + ], + "filename": "pattern.mjs", + "lineno": 109, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": { + "id": "astnode100005906", + "name": "Pattern#_withHap", + "type": "MethodDefinition", + "paramnames": [ + "func" + ] + }, + "vars": { + "": null + } + }, + "description": "

As with {@link Pattern#_withHaps}, but applies the function to every hap, rather than every list of haps.

", + "params": [ + { + "type": { + "names": [ + "function" + ] + }, + "name": "func" + } + ], + "returns": [ + { + "description": "

Pattern

" + } + ], + "name": "_withHap", + "longname": "Pattern#_withHap", + "kind": "function", + "memberof": "Pattern", + "scope": "instance", + "___id": "T000002R000506", + "___s": true + }, + { + "comment": "/**\n * Returns a new pattern with the context field set to every hap set to the given value.\n * @param {*} context\n * @returns Pattern\n */", + "meta": { + "range": [ + 4136, + 4222 + ], + "filename": "pattern.mjs", + "lineno": 118, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": { + "id": "astnode100005923", + "name": "Pattern#_setContext", + "type": "MethodDefinition", + "paramnames": [ + "context" + ] + }, + "vars": { + "": null + } + }, + "description": "

Returns a new pattern with the context field set to every hap set to the given value.

", + "params": [ + { + "type": { + "names": [ + "*" + ] + }, + "name": "context" + } + ], + "returns": [ + { + "description": "

Pattern

" + } + ], + "name": "_setContext", + "longname": "Pattern#_setContext", + "kind": "function", + "memberof": "Pattern", + "scope": "instance", + "___id": "T000002R000507", + "___s": true + }, + { + "comment": "/**\n * Returns a new pattern with the given function applied to the context field of every hap.\n * @param {Function} func\n * @returns Pattern\n */", + "meta": { + "range": [ + 4382, + 4476 + ], + "filename": "pattern.mjs", + "lineno": 127, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": { + "id": "astnode100005940", + "name": "Pattern#_withContext", + "type": "MethodDefinition", + "paramnames": [ + "func" + ] + }, + "vars": { + "": null + } + }, + "description": "

Returns a new pattern with the given function applied to the context field of every hap.

", + "params": [ + { + "type": { + "names": [ + "function" + ] + }, + "name": "func" + } + ], + "returns": [ + { + "description": "

Pattern

" + } + ], + "name": "_withContext", + "longname": "Pattern#_withContext", + "kind": "function", + "memberof": "Pattern", + "scope": "instance", + "___id": "T000002R000508", + "___s": true + }, + { + "comment": "/**\n * Returns a new pattern with the context field of every hap set to an empty object.\n * @returns Pattern\n */", + "meta": { + "range": [ + 4601, + 4677 + ], + "filename": "pattern.mjs", + "lineno": 135, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": { + "id": "astnode100005961", + "name": "Pattern#_stripContext", + "type": "MethodDefinition", + "paramnames": [] + }, + "vars": { + "": null + } + }, + "description": "

Returns a new pattern with the context field of every hap set to an empty object.

", + "returns": [ + { + "description": "

Pattern

" + } + ], + "name": "_stripContext", + "longname": "Pattern#_stripContext", + "kind": "function", + "memberof": "Pattern", + "scope": "instance", + "params": [], + "___id": "T000002R000509", + "___s": true + }, + { + "comment": "/**\n * Returns a new pattern with the given location information added to the\n * context of every hap.\n * @param {Number} start\n * @param {Number} end\n * @returns Pattern\n */", + "meta": { + "range": [ + 4870, + 5222 + ], + "filename": "pattern.mjs", + "lineno": 146, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": { + "id": "astnode100005977", + "name": "Pattern#withLocation", + "type": "MethodDefinition", + "paramnames": [ + "start", + "end" + ] + }, + "vars": { + "": null + } + }, + "description": "

Returns a new pattern with the given location information added to the\ncontext of every hap.

", + "params": [ + { + "type": { + "names": [ + "Number" + ] + }, + "name": "start" + }, + { + "type": { + "names": [ + "Number" + ] + }, + "name": "end" + } + ], + "returns": [ + { + "description": "

Pattern

" + } + ], + "name": "withLocation", + "longname": "Pattern#withLocation", + "kind": "function", + "memberof": "Pattern", + "scope": "instance", + "___id": "T000002R000510", + "___s": true + }, + { + "comment": "/**\n * Returns a new pattern, with the function applied to the value of\n * each hap. It has the alias {@link Pattern#fmap}.\n * @param {Function} func\n * @returns Pattern\n */", + "meta": { + "range": [ + 6237, + 6346 + ], + "filename": "pattern.mjs", + "lineno": 189, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": { + "id": "astnode100006189", "name": "Pattern#withValue", "type": "MethodDefinition", "paramnames": [ @@ -351,7 +830,7 @@ "": null } }, - "description": "

Returns a new pattern, with the function applied to the value of\neach event. It has the alias {@link Pattern#fmap|fmap}.

", + "description": "

Returns a new pattern, with the function applied to the value of\neach hap. It has the alias {@link Pattern#fmap}.

", "params": [ { "type": { @@ -372,22 +851,22 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000147", + "___id": "T000002R000544", "___s": true }, { - "comment": "/**\n * see {@link Pattern#withValue|withValue}\n */", + "comment": "/**\n * see {@link Pattern#withValue}\n */", "meta": { "range": [ - 5664, - 5713 + 6397, + 6446 ], "filename": "pattern.mjs", - "lineno": 167, - "columnno": 3, - "path": "/Users/felix/projects/strudel/packages/core", + "lineno": 196, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", "code": { - "id": "astnode100002320", + "id": "astnode100006214", "name": "Pattern#fmap", "type": "MethodDefinition", "paramnames": [ @@ -398,29 +877,160 @@ "": null } }, - "description": "

see {@link Pattern#withValue|withValue}

", + "description": "

see {@link Pattern#withValue}

", "name": "fmap", "longname": "Pattern#fmap", "kind": "function", "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000148", + "___id": "T000002R000545", + "___s": true + }, + { + "comment": "/**\n * Returns a new Pattern, which only returns haps that meet the given test.\n * @param {Function} hap_test - a function which returns false for haps to be removed from the pattern\n * @returns Pattern\n */", + "meta": { + "range": [ + 6667, + 6765 + ], + "filename": "pattern.mjs", + "lineno": 205, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": { + "id": "astnode100006225", + "name": "Pattern#_filterHaps", + "type": "MethodDefinition", + "paramnames": [ + "hap_test" + ] + }, + "vars": { + "": null + } + }, + "description": "

Returns a new Pattern, which only returns haps that meet the given test.

", + "params": [ + { + "type": { + "names": [ + "function" + ] + }, + "description": "

a function which returns false for haps to be removed from the pattern

", + "name": "hap_test" + } + ], + "returns": [ + { + "description": "

Pattern

" + } + ], + "name": "_filterHaps", + "longname": "Pattern#_filterHaps", + "kind": "function", + "memberof": "Pattern", + "scope": "instance", + "___id": "T000002R000546", + "___s": true + }, + { + "comment": "/**\n * As with {@link Pattern#_filterHaps}, but the function is applied to values\n * inside haps.\n * @param {Function} value_test\n * @returns Pattern\n */", + "meta": { + "range": [ + 6935, + 7059 + ], + "filename": "pattern.mjs", + "lineno": 215, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": { + "id": "astnode100006244", + "name": "Pattern#_filterValues", + "type": "MethodDefinition", + "paramnames": [ + "value_test" + ] + }, + "vars": { + "": null + } + }, + "description": "

As with {@link Pattern#_filterHaps}, but the function is applied to values\ninside haps.

", + "params": [ + { + "type": { + "names": [ + "function" + ] + }, + "name": "value_test" + } + ], + "returns": [ + { + "description": "

Pattern

" + } + ], + "name": "_filterValues", + "longname": "Pattern#_filterValues", + "kind": "function", + "memberof": "Pattern", + "scope": "instance", + "___id": "T000002R000547", + "___s": true + }, + { + "comment": "/**\n * Returns a new pattern, with haps containing undefined values removed from\n * query results.\n * @returns Pattern\n */", + "meta": { + "range": [ + 7196, + 7279 + ], + "filename": "pattern.mjs", + "lineno": 224, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": { + "id": "astnode100006269", + "name": "Pattern#_removeUndefineds", + "type": "MethodDefinition", + "paramnames": [] + }, + "vars": { + "": null + } + }, + "description": "

Returns a new pattern, with haps containing undefined values removed from\nquery results.

", + "returns": [ + { + "description": "

Pattern

" + } + ], + "name": "_removeUndefineds", + "longname": "Pattern#_removeUndefineds", + "kind": "function", + "memberof": "Pattern", + "scope": "instance", + "params": [], + "___id": "T000002R000548", "___s": true }, { "comment": "/**\n * Returns a new pattern, with all haps without onsets filtered out. A hap\n * with an onset is one with a `whole` timespan that begins at the same time\n * as its `part` timespan.\n * @returns Pattern\n */", "meta": { "range": [ - 6260, - 6532 + 7502, + 7768 ], "filename": "pattern.mjs", - "lineno": 189, - "columnno": 3, - "path": "/Users/felix/projects/strudel/packages/core", + "lineno": 234, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", "code": { - "id": "astnode100002389", + "id": "astnode100006283", "name": "Pattern#onsetsOnly", "type": "MethodDefinition", "paramnames": [] @@ -441,22 +1051,58 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000152", + "___id": "T000002R000549", "___s": true }, { - "comment": "/**\n * When this method is called on a pattern of functions, it matches its haps\n * with those in the given pattern of values. A new pattern is returned, with\n * each matching value applied to the corresponding function. \n *\n * In this `appBoth` variant, where timespans of the function and value haps\n * are not the same but do intersect, the resulting hap has a timespan of the\n * intersection. This applies to both the part and the whole timespan.\n * @param {Pattern} pat_val \n * @returns Pattern\n */", + "comment": "/**\n * Returns a new pattern, with 'continuous' haps (those without 'whole'\n * timespans) removed from query results.\n * @returns Pattern\n */", "meta": { "range": [ - 8156, - 8437 + 7924, + 8059 ], "filename": "pattern.mjs", - "lineno": 239, + "lineno": 246, "columnno": 2, - "path": "/Users/felix/projects/strudel/packages/core", + "path": "/home/felix/projects/strudel/packages/core", "code": { - "id": "astnode100002525", + "id": "astnode100006298", + "name": "Pattern#discreteOnly", + "type": "MethodDefinition", + "paramnames": [] + }, + "vars": { + "": null + } + }, + "description": "

Returns a new pattern, with 'continuous' haps (those without 'whole'\ntimespans) removed from query results.

", + "returns": [ + { + "description": "

Pattern

" + } + ], + "name": "discreteOnly", + "longname": "Pattern#discreteOnly", + "kind": "function", + "memberof": "Pattern", + "scope": "instance", + "params": [], + "___id": "T000002R000550", + "___s": true + }, + { + "comment": "/**\n * When this method is called on a pattern of functions, it matches its haps\n * with those in the given pattern of values. A new pattern is returned, with\n * each matching value applied to the corresponding function.\n *\n * In this `appBoth` variant, where timespans of the function and value haps\n * are not the same but do intersect, the resulting hap has a timespan of the\n * intersection. This applies to both the part and the whole timespan.\n * @param {Pattern} pat_val\n * @returns Pattern\n */", + "meta": { + "range": [ + 9502, + 9783 + ], + "filename": "pattern.mjs", + "lineno": 289, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": { + "id": "astnode100006419", "name": "Pattern#appBoth", "type": "MethodDefinition", "paramnames": [ @@ -488,22 +1134,22 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000161", + "___id": "T000002R000558", "___s": true }, { - "comment": "/**\n * As with {@link Pattern#appBoth|appBoth}, but the `whole` timespan is not the intersection,\n * but the timespan from the function of patterns that this method is called\n * on. In practice, this means that the pattern structure, including onsets,\n * are preserved from the pattern of functions (often referred to as the left\n * hand or inner pattern).\n * @param {Pattern} pat_val \n * @returns Pattern\n */", + "comment": "/**\n * As with {@link Pattern#appBoth}, but the `whole` timespan is not the intersection,\n * but the timespan from the function of patterns that this method is called\n * on. In practice, this means that the pattern structure, including onsets,\n * are preserved from the pattern of functions (often referred to as the left\n * hand or inner pattern).\n * @param {Pattern} pat_val\n * @returns Pattern\n */", "meta": { "range": [ - 8869, - 9617 + 10206, + 10950 ], "filename": "pattern.mjs", - "lineno": 259, + "lineno": 309, "columnno": 2, - "path": "/Users/felix/projects/strudel/packages/core", + "path": "/home/felix/projects/strudel/packages/core", "code": { - "id": "astnode100002561", + "id": "astnode100006455", "name": "Pattern#appLeft", "type": "MethodDefinition", "paramnames": [ @@ -514,7 +1160,7 @@ "": null } }, - "description": "

As with {@link Pattern#appBoth|appBoth}, but the whole timespan is not the intersection,\nbut the timespan from the function of patterns that this method is called\non. In practice, this means that the pattern structure, including onsets,\nare preserved from the pattern of functions (often referred to as the left\nhand or inner pattern).

", + "description": "

As with {@link Pattern#appBoth}, but the whole timespan is not the intersection,\nbut the timespan from the function of patterns that this method is called\non. In practice, this means that the pattern structure, including onsets,\nare preserved from the pattern of functions (often referred to as the left\nhand or inner pattern).

", "params": [ { "type": { @@ -535,22 +1181,22 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000163", + "___id": "T000002R000560", "___s": true }, { - "comment": "/**\n * As with {@link Pattern#appLeft|appLeft}, but `whole` timespans are instead taken from the\n * pattern of values, i.e. structure is preserved from the right hand/outer\n * pattern.\n * @param {Pattern} pat_val \n * @returns Pattern\n */", + "comment": "/**\n * As with {@link Pattern#appLeft}, but `whole` timespans are instead taken from the\n * pattern of values, i.e. structure is preserved from the right hand/outer\n * pattern.\n * @param {Pattern} pat_val\n * @returns Pattern\n */", "meta": { "range": [ - 9873, - 10618 + 11197, + 11942 ], "filename": "pattern.mjs", - "lineno": 289, + "lineno": 339, "columnno": 2, - "path": "/Users/felix/projects/strudel/packages/core", + "path": "/home/felix/projects/strudel/packages/core", "code": { - "id": "astnode100002671", + "id": "astnode100006565", "name": "Pattern#appRight", "type": "MethodDefinition", "paramnames": [ @@ -561,7 +1207,7 @@ "": null } }, - "description": "

As with {@link Pattern#appLeft|appLeft}, but whole timespans are instead taken from the\npattern of values, i.e. structure is preserved from the right hand/outer\npattern.

", + "description": "

As with {@link Pattern#appLeft}, but whole timespans are instead taken from the\npattern of values, i.e. structure is preserved from the right hand/outer\npattern.

", "params": [ { "type": { @@ -582,22 +1228,553 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000175", + "___id": "T000002R000572", + "___s": true + }, + { + "comment": "/**\n * Queries the pattern for the first cycle, returning Haps. Mainly of use when\n * debugging a pattern.\n * @param {Boolean} with_context - set to true, otherwise the context field\n * will be stripped from the resulting haps.\n * @returns [Hap]\n */", + "meta": { + "range": [ + 12210, + 12409 + ], + "filename": "pattern.mjs", + "lineno": 369, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": { + "id": "astnode100006675", + "name": "Pattern#firstCycle", + "type": "MethodDefinition", + "paramnames": [ + "with_context" + ] + }, + "vars": { + "": null + } + }, + "description": "

Queries the pattern for the first cycle, returning Haps. Mainly of use when\ndebugging a pattern.

", + "params": [ + { + "type": { + "names": [ + "Boolean" + ] + }, + "description": "

set to true, otherwise the context field\nwill be stripped from the resulting haps.

", + "name": "with_context", + "defaultvalue": false + } + ], + "returns": [ + { + "description": "

[Hap]

" + } + ], + "name": "firstCycle", + "longname": "Pattern#firstCycle", + "kind": "function", + "memberof": "Pattern", + "scope": "instance", + "___id": "T000002R000584", + "___s": true + }, + { + "comment": "/**\n * Accessor for a list of values returned by querying the first cycle.\n */", + "meta": { + "range": [ + 12498, + 12581 + ], + "filename": "pattern.mjs", + "lineno": 380, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": { + "id": "astnode100006712", + "name": "Pattern#_firstCycleValues", + "type": "MethodDefinition", + "paramnames": [] + }, + "vars": { + "": null + } + }, + "description": "

Accessor for a list of values returned by querying the first cycle.

", + "name": "_firstCycleValues", + "longname": "Pattern#_firstCycleValues", + "kind": "member", + "memberof": "Pattern", + "scope": "instance", + "params": [], + "___id": "T000002R000587", + "___s": true + }, + { + "comment": "/**\n * More human-readable version of the {@link Pattern#_firstCycleValues} accessor.\n */", + "meta": { + "range": [ + 12681, + 12845 + ], + "filename": "pattern.mjs", + "lineno": 387, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": { + "id": "astnode100006729", + "name": "Pattern#_showFirstCycle", + "type": "MethodDefinition", + "paramnames": [] + }, + "vars": { + "": null + } + }, + "description": "

More human-readable version of the {@link Pattern#_firstCycleValues} accessor.

", + "name": "_showFirstCycle", + "longname": "Pattern#_showFirstCycle", + "kind": "member", + "memberof": "Pattern", + "scope": "instance", + "params": [], + "___id": "T000002R000588", + "___s": true + }, + { + "comment": "/**\n * Returns a new pattern, which returns haps sorted in temporal order. Mainly\n * of use when comparing two patterns for equality, in tests.\n * @returns Pattern\n */", + "meta": { + "range": [ + 13027, + 13302 + ], + "filename": "pattern.mjs", + "lineno": 398, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": { + "id": "astnode100006767", + "name": "Pattern#_sortHapsByPart", + "type": "MethodDefinition", + "paramnames": [] + }, + "vars": { + "": null + } + }, + "description": "

Returns a new pattern, which returns haps sorted in temporal order. Mainly\nof use when comparing two patterns for equality, in tests.

", + "returns": [ + { + "description": "

Pattern

" + } + ], + "name": "_sortHapsByPart", + "longname": "Pattern#_sortHapsByPart", + "kind": "function", + "memberof": "Pattern", + "scope": "instance", + "params": [], + "___id": "T000002R000589", + "___s": true + }, + { + "comment": "/**\n * Assumes a numerical pattern. Returns a new pattern with all values rounded\n * to the nearest integer.\n * @returns Pattern\n */", + "meta": { + "range": [ + 15210, + 15279 + ], + "filename": "pattern.mjs", + "lineno": 471, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": { + "id": "astnode100007154", + "name": "Pattern#round", + "type": "MethodDefinition", + "paramnames": [] + }, + "vars": { + "": null + } + }, + "description": "

Assumes a numerical pattern. Returns a new pattern with all values rounded\nto the nearest integer.

", + "returns": [ + { + "description": "

Pattern

" + } + ], + "name": "round", + "longname": "Pattern#round", + "kind": "function", + "memberof": "Pattern", + "scope": "instance", + "params": [], + "___id": "T000002R000608", + "___s": true + }, + { + "comment": "/**\n * Assumes a numerical pattern. Returns a new pattern with all values set to\n * their mathematical floor. E.g. `3.7` replaced with to `3`, and `-4.2`\n * replaced with `-5`.\n * @returns Pattern\n */", + "meta": { + "range": [ + 15496, + 15565 + ], + "filename": "pattern.mjs", + "lineno": 481, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": { + "id": "astnode100007173", + "name": "Pattern#floor", + "type": "MethodDefinition", + "paramnames": [] + }, + "vars": { + "": null + } + }, + "description": "

Assumes a numerical pattern. Returns a new pattern with all values set to\ntheir mathematical floor. E.g. 3.7 replaced with to 3, and -4.2\nreplaced with -5.

", + "returns": [ + { + "description": "

Pattern

" + } + ], + "name": "floor", + "longname": "Pattern#floor", + "kind": "function", + "memberof": "Pattern", + "scope": "instance", + "params": [], + "___id": "T000002R000609", + "___s": true + }, + { + "comment": "/**\n * Assumes a numerical pattern. Returns a new pattern with all values set to\n * their mathematical ceiling. E.g. `3.2` replaced with `4`, and `-4.2`\n * replaced with `-4`.\n * @returns Pattern\n */", + "meta": { + "range": [ + 15781, + 15848 + ], + "filename": "pattern.mjs", + "lineno": 491, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": { + "id": "astnode100007192", + "name": "Pattern#ceil", + "type": "MethodDefinition", + "paramnames": [] + }, + "vars": { + "": null + } + }, + "description": "

Assumes a numerical pattern. Returns a new pattern with all values set to\ntheir mathematical ceiling. E.g. 3.2 replaced with 4, and -4.2\nreplaced with -4.

", + "returns": [ + { + "description": "

Pattern

" + } + ], + "name": "ceil", + "longname": "Pattern#ceil", + "kind": "function", + "memberof": "Pattern", + "scope": "instance", + "params": [], + "___id": "T000002R000610", + "___s": true + }, + { + "comment": "/**\n * Assumes a numerical pattern, containing unipolar values in the range 0 ..\n * 1. Returns a new pattern with values scaled to the bipolar range -1 .. 1\n * @returns Pattern\n */", + "meta": { + "range": [ + 16043, + 16101 + ], + "filename": "pattern.mjs", + "lineno": 500, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": { + "id": "astnode100007211", + "name": "Pattern#_toBipolar", + "type": "MethodDefinition", + "paramnames": [] + }, + "vars": { + "": null + } + }, + "description": "

Assumes a numerical pattern, containing unipolar values in the range 0 ..

\n
    \n
  1. Returns a new pattern with values scaled to the bipolar range -1 .. 1
  2. \n
", + "returns": [ + { + "description": "

Pattern

" + } + ], + "name": "_toBipolar", + "longname": "Pattern#_toBipolar", + "kind": "function", + "memberof": "Pattern", + "scope": "instance", + "params": [], + "___id": "T000002R000611", + "___s": true + }, + { + "comment": "/**\n * Assumes a numerical pattern, containing bipolar values in the range -1 ..\n * 1. Returns a new pattern with values scaled to the unipolar range 0 .. 1\n * @returns Pattern\n */", + "meta": { + "range": [ + 16296, + 16358 + ], + "filename": "pattern.mjs", + "lineno": 509, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": { + "id": "astnode100007227", + "name": "Pattern#_fromBipolar", + "type": "MethodDefinition", + "paramnames": [] + }, + "vars": { + "": null + } + }, + "description": "

Assumes a numerical pattern, containing bipolar values in the range -1 ..

\n
    \n
  1. Returns a new pattern with values scaled to the unipolar range 0 .. 1
  2. \n
", + "returns": [ + { + "description": "

Pattern

" + } + ], + "name": "_fromBipolar", + "longname": "Pattern#_fromBipolar", + "kind": "function", + "memberof": "Pattern", + "scope": "instance", + "params": [], + "___id": "T000002R000612", + "___s": true + }, + { + "comment": "/**\n * Assumes a numerical pattern, containing unipolar values in the range 0 ..\n * 1. Returns a new pattern with values scaled to the given min/max range.\n * @param {Number} min\n * @param {Number} max\n * @returns Pattern\n */", + "meta": { + "range": [ + 16602, + 16664 + ], + "filename": "pattern.mjs", + "lineno": 520, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": { + "id": "astnode100007243", + "name": "Pattern#range", + "type": "MethodDefinition", + "paramnames": [ + "min", + "max" + ] + }, + "vars": { + "": null + } + }, + "description": "

Assumes a numerical pattern, containing unipolar values in the range 0 ..

\n
    \n
  1. Returns a new pattern with values scaled to the given min/max range.
  2. \n
", + "params": [ + { + "type": { + "names": [ + "Number" + ] + }, + "name": "min" + }, + { + "type": { + "names": [ + "Number" + ] + }, + "name": "max" + } + ], + "returns": [ + { + "description": "

Pattern

" + } + ], + "name": "range", + "longname": "Pattern#range", + "kind": "function", + "memberof": "Pattern", + "scope": "instance", + "___id": "T000002R000613", + "___s": true + }, + { + "comment": "/**\n * Assumes a numerical pattern, containing unipolar values in the range 0 ..\n * 1. Returns a new pattern with values scaled to the given min/max range,\n * following an exponential curve.\n * @param {Number} min\n * @param {Number} max\n * @returns Pattern\n */", + "meta": { + "range": [ + 16945, + 17035 + ], + "filename": "pattern.mjs", + "lineno": 532, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": { + "id": "astnode100007261", + "name": "Pattern#rangex", + "type": "MethodDefinition", + "paramnames": [ + "min", + "max" + ] + }, + "vars": { + "": null + } + }, + "description": "

Assumes a numerical pattern, containing unipolar values in the range 0 ..

\n
    \n
  1. Returns a new pattern with values scaled to the given min/max range,\nfollowing an exponential curve.
  2. \n
", + "params": [ + { + "type": { + "names": [ + "Number" + ] + }, + "name": "min" + }, + { + "type": { + "names": [ + "Number" + ] + }, + "name": "max" + } + ], + "returns": [ + { + "description": "

Pattern

" + } + ], + "name": "rangex", + "longname": "Pattern#rangex", + "kind": "function", + "memberof": "Pattern", + "scope": "instance", + "___id": "T000002R000614", + "___s": true + }, + { + "comment": "/**\n * Assumes a numerical pattern, containing bipolar values in the range -1 ..\n * 1. Returns a new pattern with values scaled to the given min/max range.\n * @param {Number} min\n * @param {Number} max\n * @returns Pattern\n */", + "meta": { + "range": [ + 17279, + 17349 + ], + "filename": "pattern.mjs", + "lineno": 543, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": { + "id": "astnode100007288", + "name": "Pattern#range2", + "type": "MethodDefinition", + "paramnames": [ + "min", + "max" + ] + }, + "vars": { + "": null + } + }, + "description": "

Assumes a numerical pattern, containing bipolar values in the range -1 ..

\n
    \n
  1. Returns a new pattern with values scaled to the given min/max range.
  2. \n
", + "params": [ + { + "type": { + "names": [ + "Number" + ] + }, + "name": "min" + }, + { + "type": { + "names": [ + "Number" + ] + }, + "name": "max" + } + ], + "returns": [ + { + "description": "

Pattern

" + } + ], + "name": "range2", + "longname": "Pattern#range2", + "kind": "function", + "memberof": "Pattern", + "scope": "instance", + "___id": "T000002R000615", + "___s": true + }, + { + "comment": "/**\n * Returns a new pattern where every other cycle is played once, twice as\n * fast, and offset in time by one quarter of a cycle. Creates a kind of\n * breakbeat feel.\n * @returns Pattern\n */", + "meta": { + "range": [ + 27227, + 27323 + ], + "filename": "pattern.mjs", + "lineno": 883, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": { + "id": "astnode100008779", + "name": "Pattern#brak", + "type": "MethodDefinition", + "paramnames": [] + }, + "vars": { + "": null + } + }, + "description": "

Returns a new pattern where every other cycle is played once, twice as\nfast, and offset in time by one quarter of a cycle. Creates a kind of\nbreakbeat feel.

", + "returns": [ + { + "description": "

Pattern

" + } + ], + "name": "brak", + "longname": "Pattern#brak", + "kind": "function", + "memberof": "Pattern", + "scope": "instance", + "params": [], + "___id": "T000002R000712", "___s": true }, { "comment": "/** A discrete value that repeats once per cycle:\n *\n * @param {any} value - The value to repeat\n * @returns {Pattern}\n * @example\n * pure('e4')\n */", "meta": { "range": [ - 31120, - 31324 + 35084, + 35288 ], "filename": "pattern.mjs", - "lineno": 1044, + "lineno": 1181, "columnno": 0, - "path": "/Users/felix/projects/strudel/packages/core", + "path": "/home/felix/projects/strudel/packages/core", "code": { - "id": "astnode100006158", + "id": "astnode100010127", "name": "exports.pure", "type": "FunctionDeclaration", "paramnames": [ @@ -633,22 +1810,22 @@ "longname": "pure", "kind": "function", "scope": "global", - "___id": "T000002R000429", + "___id": "T000002R000830", "___s": true }, { "comment": "/** The given items are played at the same time at the same length:\n *\n * @param {...any} items - The items to stack\n * @return {Pattern}\n * @example\n * stack(g3, b3, [e4, d4])\n */", "meta": { "range": [ - 31837, - 32110 + 35801, + 36074 ], "filename": "pattern.mjs", - "lineno": 1071, + "lineno": 1208, "columnno": 0, - "path": "/Users/felix/projects/strudel/packages/core", + "path": "/home/felix/projects/strudel/packages/core", "code": { - "id": "astnode100006219", + "id": "astnode100010188", "name": "exports.stack", "type": "FunctionDeclaration", "paramnames": [ @@ -685,22 +1862,22 @@ "longname": "stack", "kind": "function", "scope": "global", - "___id": "T000002R000436", + "___id": "T000002R000837", "___s": true }, { "comment": "/** Concatenation: combines a list of patterns, switching between them successively, one per cycle:\n *\n * synonyms: {@link cat}\n *\n * @param {...any} items - The items to concatenate\n * @return {Pattern}\n * @example\n * slowcat(e5, b4, [d5, c5])\n *\n */", "meta": { "range": [ - 32364, - 33277 + 36328, + 37239 ], "filename": "pattern.mjs", - "lineno": 1088, + "lineno": 1225, "columnno": 0, - "path": "/Users/felix/projects/strudel/packages/core", + "path": "/home/felix/projects/strudel/packages/core", "code": { - "id": "astnode100006269", + "id": "astnode100010238", "name": "exports.slowcat", "type": "FunctionDeclaration", "paramnames": [ @@ -737,22 +1914,22 @@ "longname": "slowcat", "kind": "function", "scope": "global", - "___id": "T000002R000440", + "___id": "T000002R000841", "___s": true }, { "comment": "/** Concatenation: combines a list of patterns, switching between them successively, one per cycle. Unlike slowcat, this version will skip cycles.\n * @param {...any} items - The items to concatenate\n * @return {Pattern}\n */", "meta": { "range": [ - 33503, - 33775 + 37465, + 37737 ], "filename": "pattern.mjs", - "lineno": 1113, + "lineno": 1250, "columnno": 0, - "path": "/Users/felix/projects/strudel/packages/core", + "path": "/home/felix/projects/strudel/packages/core", "code": { - "id": "astnode100006396", + "id": "astnode100010365", "name": "exports.slowcatPrime", "type": "FunctionDeclaration", "paramnames": [ @@ -786,22 +1963,22 @@ "longname": "slowcatPrime", "kind": "function", "scope": "global", - "___id": "T000002R000448", + "___id": "T000002R000849", "___s": true }, { "comment": "/** Concatenation: as with {@link slowcat}, but squashes a cycle from each pattern into one cycle\n *\n * Synonyms: {@link seq}, {@link sequence}\n *\n * @param {...any} items - The items to concatenate\n * @return {Pattern}\n * @example\n * fastcat(e5, b4, [d5, c5])\n * sequence(e5, b4, [d5, c5])\n * seq(e5, b4, [d5, c5])\n */", "meta": { "range": [ - 34097, - 34179 + 38059, + 38141 ], "filename": "pattern.mjs", - "lineno": 1134, + "lineno": 1271, "columnno": 0, - "path": "/Users/felix/projects/strudel/packages/core", + "path": "/home/felix/projects/strudel/packages/core", "code": { - "id": "astnode100006451", + "id": "astnode100010420", "name": "exports.fastcat", "type": "FunctionDeclaration", "paramnames": [ @@ -838,22 +2015,22 @@ "longname": "fastcat", "kind": "function", "scope": "global", - "___id": "T000002R000454", + "___id": "T000002R000855", "___s": true }, { "comment": "/** See {@link slowcat} */", "meta": { "range": [ - 34208, - 34267 + 38170, + 38229 ], "filename": "pattern.mjs", - "lineno": 1139, + "lineno": 1276, "columnno": 0, - "path": "/Users/felix/projects/strudel/packages/core", + "path": "/home/felix/projects/strudel/packages/core", "code": { - "id": "astnode100006468", + "id": "astnode100010437", "name": "exports.cat", "type": "FunctionDeclaration", "paramnames": [ @@ -866,22 +2043,22 @@ "longname": "cat", "kind": "function", "scope": "global", - "___id": "T000002R000456", + "___id": "T000002R000857", "___s": true }, { "comment": "/** Like {@link fastcat}, but where each step has a temporal weight:\n * @param {...Array} items - The items to concatenate\n * @return {Pattern}\n * @example\n * timeCat([3,e3],[1, g3])\n */", "meta": { "range": [ - 34456, - 34815 + 38418, + 38777 ], "filename": "pattern.mjs", - "lineno": 1149, + "lineno": 1286, "columnno": 0, - "path": "/Users/felix/projects/strudel/packages/core", + "path": "/home/felix/projects/strudel/packages/core", "code": { - "id": "astnode100006479", + "id": "astnode100010448", "name": "exports.timeCat", "type": "FunctionDeclaration", "paramnames": [ @@ -918,22 +2095,22 @@ "longname": "timeCat", "kind": "function", "scope": "global", - "___id": "T000002R000458", + "___id": "T000002R000859", "___s": true }, { "comment": "/** See {@link fastcat} */", "meta": { "range": [ - 34844, - 34908 + 38806, + 38870 ], "filename": "pattern.mjs", - "lineno": 1162, + "lineno": 1299, "columnno": 0, - "path": "/Users/felix/projects/strudel/packages/core", + "path": "/home/felix/projects/strudel/packages/core", "code": { - "id": "astnode100006565", + "id": "astnode100010534", "name": "exports.sequence", "type": "FunctionDeclaration", "paramnames": [ @@ -946,22 +2123,22 @@ "longname": "sequence", "kind": "function", "scope": "global", - "___id": "T000002R000465", + "___id": "T000002R000866", "___s": true }, { "comment": "/** See {@link fastcat} */", "meta": { "range": [ - 34937, - 34996 + 38899, + 38958 ], "filename": "pattern.mjs", - "lineno": 1167, + "lineno": 1304, "columnno": 0, - "path": "/Users/felix/projects/strudel/packages/core", + "path": "/home/felix/projects/strudel/packages/core", "code": { - "id": "astnode100006576", + "id": "astnode100010545", "name": "exports.seq", "type": "FunctionDeclaration", "paramnames": [ @@ -974,63 +2151,89 @@ "longname": "seq", "kind": "function", "scope": "global", - "___id": "T000002R000467", + "___id": "T000002R000868", "___s": true }, { "kind": "package", "longname": "package:undefined", "files": [ - "/Users/felix/projects/strudel/packages/core/controls.mjs", - "/Users/felix/projects/strudel/packages/core/drawLine.mjs", - "/Users/felix/projects/strudel/packages/core/euclid.mjs", - "/Users/felix/projects/strudel/packages/core/fraction.mjs", - "/Users/felix/projects/strudel/packages/core/gist.js", - "/Users/felix/projects/strudel/packages/core/hap.mjs", - "/Users/felix/projects/strudel/packages/core/index.mjs", - "/Users/felix/projects/strudel/packages/core/pattern.mjs", - "/Users/felix/projects/strudel/packages/core/signal.mjs", - "/Users/felix/projects/strudel/packages/core/speak.mjs", - "/Users/felix/projects/strudel/packages/core/state.mjs", - "/Users/felix/projects/strudel/packages/core/test/drawLine.test.mjs", - "/Users/felix/projects/strudel/packages/core/test/fraction.test.mjs", - "/Users/felix/projects/strudel/packages/core/test/pattern.test.mjs", - "/Users/felix/projects/strudel/packages/core/test/util.test.mjs", - "/Users/felix/projects/strudel/packages/core/test/value.test.mjs", - "/Users/felix/projects/strudel/packages/core/timespan.mjs", - "/Users/felix/projects/strudel/packages/core/util.mjs", - "/Users/felix/projects/strudel/packages/core/value.mjs", - "/Users/felix/projects/strudel/packages/embed/embed.js", - "/Users/felix/projects/strudel/packages/eval/evaluate.mjs", - "/Users/felix/projects/strudel/packages/eval/shapeshifter.mjs", - "/Users/felix/projects/strudel/packages/eval/test/evaluate.test.mjs", - "/Users/felix/projects/strudel/packages/eval/test/shapeshifter.test.mjs", - "/Users/felix/projects/strudel/packages/midi/midi.mjs", - "/Users/felix/projects/strudel/packages/mini/krill-parser.js", - "/Users/felix/projects/strudel/packages/mini/mini.mjs", - "/Users/felix/projects/strudel/packages/mini/test/mini.test.mjs", - "/Users/felix/projects/strudel/packages/osc/osc.mjs", - "/Users/felix/projects/strudel/packages/osc/server.js", - "/Users/felix/projects/strudel/packages/osc/tidal-sniffer.js", - "/Users/felix/projects/strudel/packages/serial/serial.mjs", - "/Users/felix/projects/strudel/packages/tonal/test/tonal.test.mjs", - "/Users/felix/projects/strudel/packages/tonal/tonal.mjs", - "/Users/felix/projects/strudel/packages/tonal/voicings.mjs", - "/Users/felix/projects/strudel/packages/tone/draw.mjs", - "/Users/felix/projects/strudel/packages/tone/pianoroll.mjs", - "/Users/felix/projects/strudel/packages/tone/test/tone.test.mjs", - "/Users/felix/projects/strudel/packages/tone/tone.mjs", - "/Users/felix/projects/strudel/packages/tone/ui.mjs", - "/Users/felix/projects/strudel/packages/webaudio/clockworker.mjs", - "/Users/felix/projects/strudel/packages/webaudio/index.mjs", - "/Users/felix/projects/strudel/packages/webaudio/scheduler.mjs", - "/Users/felix/projects/strudel/packages/webaudio/webaudio.mjs", - "/Users/felix/projects/strudel/packages/xen/test/xen.test.mjs", - "/Users/felix/projects/strudel/packages/xen/tune.mjs", - "/Users/felix/projects/strudel/packages/xen/tunejs.js", - "/Users/felix/projects/strudel/packages/xen/xen.mjs" + "/home/felix/projects/strudel/packages/core/controls.mjs", + "/home/felix/projects/strudel/packages/core/drawLine.mjs", + "/home/felix/projects/strudel/packages/core/euclid.mjs", + "/home/felix/projects/strudel/packages/core/fraction.mjs", + "/home/felix/projects/strudel/packages/core/gist.js", + "/home/felix/projects/strudel/packages/core/hap.mjs", + "/home/felix/projects/strudel/packages/core/index.mjs", + "/home/felix/projects/strudel/packages/core/out/scripts/linenumber.js", + "/home/felix/projects/strudel/packages/core/out/scripts/prettify/lang-css.js", + "/home/felix/projects/strudel/packages/core/out/scripts/prettify/prettify.js", + "/home/felix/projects/strudel/packages/core/pattern.mjs", + "/home/felix/projects/strudel/packages/core/signal.mjs", + "/home/felix/projects/strudel/packages/core/speak.mjs", + "/home/felix/projects/strudel/packages/core/state.mjs", + "/home/felix/projects/strudel/packages/core/test/drawLine.test.mjs", + "/home/felix/projects/strudel/packages/core/test/fraction.test.mjs", + "/home/felix/projects/strudel/packages/core/test/pattern.test.mjs", + "/home/felix/projects/strudel/packages/core/test/util.test.mjs", + "/home/felix/projects/strudel/packages/core/test/value.test.mjs", + "/home/felix/projects/strudel/packages/core/timespan.mjs", + "/home/felix/projects/strudel/packages/core/util.mjs", + "/home/felix/projects/strudel/packages/core/value.mjs", + "/home/felix/projects/strudel/packages/embed/embed.js", + "/home/felix/projects/strudel/packages/eval/evaluate.mjs", + "/home/felix/projects/strudel/packages/eval/index.mjs", + "/home/felix/projects/strudel/packages/eval/shapeshifter.mjs", + "/home/felix/projects/strudel/packages/eval/test/evaluate.test.mjs", + "/home/felix/projects/strudel/packages/eval/test/shapeshifter.test.mjs", + "/home/felix/projects/strudel/packages/midi/index.mjs", + "/home/felix/projects/strudel/packages/midi/midi.mjs", + "/home/felix/projects/strudel/packages/mini/index.mjs", + "/home/felix/projects/strudel/packages/mini/krill-parser.js", + "/home/felix/projects/strudel/packages/mini/mini.mjs", + "/home/felix/projects/strudel/packages/mini/test/mini.test.mjs", + "/home/felix/projects/strudel/packages/osc/osc.mjs", + "/home/felix/projects/strudel/packages/osc/server.js", + "/home/felix/projects/strudel/packages/osc/tidal-sniffer.js", + "/home/felix/projects/strudel/packages/react/dist/index.cjs.js", + "/home/felix/projects/strudel/packages/react/dist/index.es.js", + "/home/felix/projects/strudel/packages/react/postcss.config.js", + "/home/felix/projects/strudel/packages/react/src/App.jsx", + "/home/felix/projects/strudel/packages/react/src/components/CodeMirror6.jsx", + "/home/felix/projects/strudel/packages/react/src/components/MiniRepl.jsx", + "/home/felix/projects/strudel/packages/react/src/cx.js", + "/home/felix/projects/strudel/packages/react/src/hooks/useCycle.mjs", + "/home/felix/projects/strudel/packages/react/src/hooks/useHighlighting.mjs", + "/home/felix/projects/strudel/packages/react/src/hooks/usePostMessage.mjs", + "/home/felix/projects/strudel/packages/react/src/hooks/useRepl.mjs", + "/home/felix/projects/strudel/packages/react/src/hooks/useWebMidi.mjs", + "/home/felix/projects/strudel/packages/react/src/index.js", + "/home/felix/projects/strudel/packages/react/src/main.jsx", + "/home/felix/projects/strudel/packages/react/src/themes/material-palenight.js", + "/home/felix/projects/strudel/packages/react/tailwind.config.js", + "/home/felix/projects/strudel/packages/react/vite.config.js", + "/home/felix/projects/strudel/packages/serial/serial.mjs", + "/home/felix/projects/strudel/packages/tonal/index.mjs", + "/home/felix/projects/strudel/packages/tonal/test/tonal.test.mjs", + "/home/felix/projects/strudel/packages/tonal/tonal.mjs", + "/home/felix/projects/strudel/packages/tonal/voicings.mjs", + "/home/felix/projects/strudel/packages/tone/draw.mjs", + "/home/felix/projects/strudel/packages/tone/index.mjs", + "/home/felix/projects/strudel/packages/tone/pianoroll.mjs", + "/home/felix/projects/strudel/packages/tone/test/tone.test.mjs", + "/home/felix/projects/strudel/packages/tone/tone.mjs", + "/home/felix/projects/strudel/packages/tone/ui.mjs", + "/home/felix/projects/strudel/packages/webaudio/clockworker.mjs", + "/home/felix/projects/strudel/packages/webaudio/index.mjs", + "/home/felix/projects/strudel/packages/webaudio/scheduler.mjs", + "/home/felix/projects/strudel/packages/webaudio/webaudio.mjs", + "/home/felix/projects/strudel/packages/xen/index.mjs", + "/home/felix/projects/strudel/packages/xen/test/xen.test.mjs", + "/home/felix/projects/strudel/packages/xen/tune.mjs", + "/home/felix/projects/strudel/packages/xen/tunejs.js", + "/home/felix/projects/strudel/packages/xen/xen.mjs" ], - "___id": "T000002R012553", + "___id": "T000002R013973", "___s": true } ] diff --git a/packages/core/drawLine.mjs b/packages/core/drawLine.mjs index 276303c9..68c3be86 100644 --- a/packages/core/drawLine.mjs +++ b/packages/core/drawLine.mjs @@ -9,8 +9,8 @@ import Fraction, { gcd } from './fraction.mjs'; /** * Intended for a debugging, drawLine renders the pattern as a string, where each character represents the same time span. * Should only be used with single characters as values, otherwise the character slots will be messed up. - * Character legend: - * + * Character legend: + * * - "|" cycle separator * - "-" hold previous value * - "." silence @@ -19,7 +19,7 @@ import Fraction, { gcd } from './fraction.mjs'; * @param {number} chars max number of characters (approximately) * @returns string * @example - * const line = drawLine(pattern, 10); // |0--123|0--123 + * const line = drawLine("0 [1 2 3]", 10); // |0--123|0--123 * console.log(line); */ function drawLine(pat, chars = 60) { diff --git a/packages/core/euclid.mjs b/packages/core/euclid.mjs index 9cd8b352..c95b3409 100644 --- a/packages/core/euclid.mjs +++ b/packages/core/euclid.mjs @@ -24,6 +24,7 @@ const euclid = (pulses, steps, rotation = 0) => { * Euclidian rhythms are really useful for computer/algorithmic music because they can accurately * describe a large number of rhythms used in the most important music world traditions. * + * @memberof Pattern * @param {number} pulses the number of onsets / beats * @param {number} steps the number of steps to fill * @param {number} rotation (optional) offset in steps diff --git a/packages/core/pattern.mjs b/packages/core/pattern.mjs index 2eee37f6..0ee73875 100644 --- a/packages/core/pattern.mjs +++ b/packages/core/pattern.mjs @@ -62,7 +62,7 @@ export class Pattern { } /** - * As with {@link Pattern#withQuerySpan|withQuerySpan}, but the function is applied to both the + * As with {@link Pattern#withQuerySpan}, but the function is applied to both the * begin and end time of the query timespan. * @param {Function} func the function to apply * @returns Pattern @@ -72,7 +72,7 @@ export class Pattern { } /** - * Similar to {@link Pattern#withQuerySpan|withQuerySpan}, but the function is applied to the timespans + * Similar to {@link Pattern#withQuerySpan}, but the function is applied to the timespans * of all haps returned by pattern queries (both `part` timespans, and where * present, `whole` timespans). * @param {Function} func @@ -83,7 +83,7 @@ export class Pattern { } /** - * As with {@link Pattern#withHapSpan|withHapSpan}, but the function is applied to both the + * As with {@link Pattern#withHapSpan}, but the function is applied to both the * begin and end time of the hap timespans. * @param {Function} func the function to apply * @returns Pattern @@ -182,7 +182,7 @@ export class Pattern { /** * Returns a new pattern, with the function applied to the value of - * each hap. It has the alias {@link Pattern#fmap|fmap}. + * each hap. It has the alias {@link Pattern#fmap}. * @param {Function} func * @returns Pattern */ @@ -191,7 +191,7 @@ export class Pattern { } /** - * see {@link Pattern#withValue|withValue} + * see {@link Pattern#withValue} */ fmap(func) { return this.withValue(func); @@ -298,7 +298,7 @@ export class Pattern { } /** - * As with {@link Pattern#appBoth|appBoth}, but the `whole` timespan is not the intersection, + * As with {@link Pattern#appBoth}, but the `whole` timespan is not the intersection, * but the timespan from the function of patterns that this method is called * on. In practice, this means that the pattern structure, including onsets, * are preserved from the pattern of functions (often referred to as the left @@ -330,7 +330,7 @@ export class Pattern { } /** - * As with {@link Pattern#appLeft|appLeft}, but `whole` timespans are instead taken from the + * As with {@link Pattern#appLeft}, but `whole` timespans are instead taken from the * pattern of values, i.e. structure is preserved from the right hand/outer * pattern. * @param {Pattern} pat_val @@ -1022,8 +1022,10 @@ export class Pattern { return this._withContext((context) => ({ ...context, velocity: (context.velocity || 1) * velocity })); } - _loopAt(factor,cps=1) { - return this.speed((1/factor)*cps).unit("c").slow(factor) + _loopAt(factor, cps = 1) { + return this.speed((1 / factor) * cps) + .unit('c') + .slow(factor); } } diff --git a/tutorial/ApiDoc.jsx b/tutorial/ApiDoc.jsx new file mode 100644 index 00000000..1408f9ec --- /dev/null +++ b/tutorial/ApiDoc.jsx @@ -0,0 +1,45 @@ +import React, { Fragment } from 'react'; +import { docs } from '../doc.json'; +import { MiniRepl } from './MiniRepl'; + +function ApiDoc() { + console.log('docJson', docs); + return ( +
+ {docs + .filter((item) => !item.name?.startsWith('_') && item.kind !== 'package') + .map((item, i) => ( + + {' '} +

+ {item.memberof && item.memberof !== item.name ? `${item.memberof}.` : ''} + {item.name} +

+
{ + // console.log(_, 'a', a, 'b', b); + return `${a}${b ? `#${b}` : ''}`; + }), + }} + /> +
    + {item.params?.map((param, i) => ( +
  • + {param.name} ({param.type?.names?.join('|')}): {param.description?.replace(/(<([^>]+)>)/gi, '')} +
  • + ))} +
+ {item.examples?.length &&

Examples

} +
+ {item.examples?.map((example, k) => ( + + ))} +
+ + ))} +
+ ); +} + +export default ApiDoc; diff --git a/tutorial/tutorial.mdx b/tutorial/tutorial.mdx index 503b682a..fc01f03a 100644 --- a/tutorial/tutorial.mdx +++ b/tutorial/tutorial.mdx @@ -693,3 +693,14 @@ If you want to contribute in another way, either - [fork strudel repo on GitHub](https://github.com/tidalcycles/strudel) - [Join the Discord Channel](https://discord.gg/remJ6gQA) - [play with the Strudel REPL](https://strudel.tidalcycles.org/) + +import ApiDoc from './ApiDoc'; + +
+
+ +# API Docs + +The following Chapter is the technical API documentation. It is autogenerated from the jsdoc comments in the source files. + + From 6b26f999e4b63657f8b94b0865f6fbac8764a618 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Fri, 20 May 2022 22:15:05 +0200 Subject: [PATCH 05/26] autogenerate doc on build tutorial --- doc.json | 13 ++++++------- packages/core/drawLine.mjs | 2 +- tutorial/ApiDoc.jsx | 3 ++- tutorial/package.json | 7 ++++--- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/doc.json b/doc.json index 6306c8d9..692ba029 100644 --- a/doc.json +++ b/doc.json @@ -1,11 +1,11 @@ { "docs": [ { - "comment": "/**\n * Intended for a debugging, drawLine renders the pattern as a string, where each character represents the same time span.\n * Should only be used with single characters as values, otherwise the character slots will be messed up.\n * Character legend: \n * \n * - \"|\" cycle separator\n * - \"-\" hold previous value\n * - \".\" silence\n *\n * @param {Pattern} pat pattern to use\n * @param {number} chars max number of characters (approximately)\n * @returns string\n * @example\n * const line = drawLine(\"0 [1 2 3]\", 10); // |0--123|0--123\n * console.log(line);\n */", + "comment": "/**\n * Intended for a debugging, drawLine renders the pattern as a string, where each character represents the same time span.\n * Should only be used with single characters as values, otherwise the character slots will be messed up.\n * Character legend:\n *\n * - \"|\" cycle separator\n * - \"-\" hold previous value\n * - \".\" silence\n *\n * @param {Pattern} pattern the pattern to use\n * @param {number} chars max number of characters (approximately)\n * @returns string\n * @example\n * const line = drawLine(\"0 [1 2 3]\", 10); // |0--123|0--123\n * console.log(line);\n */", "meta": { "range": [ - 1408, - 2778 + 1414, + 2784 ], "filename": "drawLine.mjs", "lineno": 25, @@ -44,8 +44,8 @@ "Pattern" ] }, - "description": "

pattern to use

", - "name": "pat" + "description": "

the pattern to use

", + "name": "pattern" }, { "type": { @@ -54,8 +54,7 @@ ] }, "description": "

max number of characters (approximately)

", - "name": "chars", - "defaultvalue": 60 + "name": "chars" } ], "returns": [ diff --git a/packages/core/drawLine.mjs b/packages/core/drawLine.mjs index 68c3be86..da424236 100644 --- a/packages/core/drawLine.mjs +++ b/packages/core/drawLine.mjs @@ -15,7 +15,7 @@ import Fraction, { gcd } from './fraction.mjs'; * - "-" hold previous value * - "." silence * - * @param {Pattern} pat pattern to use + * @param {Pattern} pattern the pattern to use * @param {number} chars max number of characters (approximately) * @returns string * @example diff --git a/tutorial/ApiDoc.jsx b/tutorial/ApiDoc.jsx index 1408f9ec..2d642ff1 100644 --- a/tutorial/ApiDoc.jsx +++ b/tutorial/ApiDoc.jsx @@ -3,7 +3,7 @@ import { docs } from '../doc.json'; import { MiniRepl } from './MiniRepl'; function ApiDoc() { - console.log('docJson', docs); + // console.log('docJson', docs); return (
{docs @@ -23,6 +23,7 @@ function ApiDoc() { }), }} /> +

Parameters

    {item.params?.map((param, i) => (
  • diff --git a/tutorial/package.json b/tutorial/package.json index 5a524a84..0a5dd3d6 100644 --- a/tutorial/package.json +++ b/tutorial/package.json @@ -3,10 +3,11 @@ "private": true, "version": "0.0.0", "scripts": { - "dev": "vite", + "dev": "npm run jsdoc-json && vite", "start": "vite", - "build": "vite build", - "preview": "vite preview" + "build": "npm run jsdoc-json && vite build", + "preview": "vite preview", + "jsdoc-json": "jsdoc ../packages/ --template ../node_modules/jsdoc-json --destination ../doc.json -c ../jsdoc.config.json" }, "type": "module", "dependencies": { From f2b5dcf4661406e8dacbc9be00da7cb483a759fd Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Sat, 21 May 2022 21:52:45 +0200 Subject: [PATCH 06/26] tonal jsdoc --- doc.json | 115 ++++++++++++++++++++++++++++++++++++++- packages/tonal/tonal.mjs | 65 ++++++++++++++++++++++ 2 files changed, 179 insertions(+), 1 deletion(-) diff --git a/doc.json b/doc.json index 692ba029..279769bc 100644 --- a/doc.json +++ b/doc.json @@ -2153,6 +2153,119 @@ "___id": "T000002R000868", "___s": true }, + { + "comment": "/**\n * Change the pitch of each value by the given amount. Expects numbers or note strings as values.\n * The amount can be given as a number of semitones or as a string in interval short notation.\n * If you don't care about enharmonic correctness, just use numbers. Otherwise, pass the interval of\n * the form: ST where S is the degree number and T the type of interval with\n *\n * - M = major\n * - m = minor\n * - P = perfect\n * - A = augmented\n * - d = diminished\n *\n * Examples intervals:\n *\n * - 1P = unison = 0\n * - 3M = major third\n * - 3m = minor third\n * - 4P = perfect fourth\n * - 4A = augmented fourth\n * - 5P = perfect fifth\n * - 5d = diminished fifth\n *\n * @param {string | number} amount Either number of semitones or interval string.\n * @returns Pattern\n * @memberof Pattern\n * @name transpose\n * @example\n * \"c2 c3\".fast(2).transpose(\"<0 -2 5 3>\".slow(2)).transpose(0)\n * @example\n * \"c2 c3\".fast(2).transpose(\"<1P -2M 4P 3m>\".slow(2)).transpose(0)\n */", + "meta": { + "filename": "tonal.mjs", + "lineno": 45, + "columnno": 0, + "path": "/home/felix/projects/strudel/packages/tonal", + "code": {} + }, + "description": "

    Change the pitch of each value by the given amount. Expects numbers or note strings as values.\nThe amount can be given as a number of semitones or as a string in interval short notation.\nIf you don't care about enharmonic correctness, just use numbers. Otherwise, pass the interval of\nthe form: ST where S is the degree number and T the type of interval with

    \n
      \n
    • M = major
    • \n
    • m = minor
    • \n
    • P = perfect
    • \n
    • A = augmented
    • \n
    • d = diminished
    • \n
    \n

    Examples intervals:

    \n
      \n
    • 1P = unison = 0
    • \n
    • 3M = major third
    • \n
    • 3m = minor third
    • \n
    • 4P = perfect fourth
    • \n
    • 4A = augmented fourth
    • \n
    • 5P = perfect fifth
    • \n
    • 5d = diminished fifth
    • \n
    ", + "params": [ + { + "type": { + "names": [ + "string", + "number" + ] + }, + "description": "

    Either number of semitones or interval string.

    ", + "name": "amount" + } + ], + "returns": [ + { + "description": "

    Pattern

    " + } + ], + "memberof": "Pattern", + "name": "transpose", + "examples": [ + "\"c2 c3\".fast(2).transpose(\"<0 -2 5 3>\".slow(2)).transpose(0)", + "\"c2 c3\".fast(2).transpose(\"<1P -2M 4P 3m>\".slow(2)).transpose(0)" + ], + "scope": "static", + "longname": "Pattern.transpose", + "kind": "member", + "___id": "T000002R003677", + "___s": true + }, + { + "comment": "/**\n * Transposes notes inside the scale by the number of steps.\n * Expected to be called on a Pattern which already has a {@link Pattern#scale}\n *\n * @memberof Pattern\n * @name scaleTranspose\n * @param {offset} offset number of steps inside the scale\n * @returns Pattern\n * @example\n * \"-8 [2,4,6]\"\n * .scale('C4 bebop major')\n * .scaleTranspose(\"<0 -1 -2 -3 -4 -5 -6 -4>\")\n */", + "meta": { + "filename": "tonal.mjs", + "lineno": 98, + "columnno": 0, + "path": "/home/felix/projects/strudel/packages/tonal", + "code": {} + }, + "description": "

    Transposes notes inside the scale by the number of steps.\nExpected to be called on a Pattern which already has a {@link Pattern#scale}

    ", + "memberof": "Pattern", + "name": "scaleTranspose", + "params": [ + { + "type": { + "names": [ + "offset" + ] + }, + "description": "

    number of steps inside the scale

    ", + "name": "offset" + } + ], + "returns": [ + { + "description": "

    Pattern

    " + } + ], + "examples": [ + "\"-8 [2,4,6]\"\n.scale('C4 bebop major')\n.scaleTranspose(\"<0 -1 -2 -3 -4 -5 -6 -4>\")" + ], + "scope": "static", + "longname": "Pattern.scaleTranspose", + "kind": "member", + "___id": "T000002R003681", + "___s": true + }, + { + "comment": "/**\n * Turns numbers into notes in the scale (zero indexed). Also sets scale for other scale operations, like {@link Pattern#scaleTranspose}.\n *\n * The scale name has the form \"TO? N\" wher\n *\n * - T = Tonic\n * - O = Octave (optional, defaults to 3)\n * - N = Name of scale, available names can be found [here](https://github.com/tonaljs/tonal/blob/main/packages/scale-type/data.ts).\n *\n * @memberof Pattern\n * @name scale\n * @param {string} scale Name of scale\n * @returns Pattern\n * @example \n * \"0 2 4 6 4 2\"\n * .scale(seq('C2 major', 'C2 minor').slow(2))\n */", + "meta": { + "filename": "tonal.mjs", + "lineno": 124, + "columnno": 0, + "path": "/home/felix/projects/strudel/packages/tonal", + "code": {} + }, + "description": "

    Turns numbers into notes in the scale (zero indexed). Also sets scale for other scale operations, like {@link Pattern#scaleTranspose}.

    \n

    The scale name has the form "TO? N" wher

    \n
      \n
    • T = Tonic
    • \n
    • O = Octave (optional, defaults to 3)
    • \n
    • N = Name of scale, available names can be found here.
    • \n
    ", + "memberof": "Pattern", + "name": "scale", + "params": [ + { + "type": { + "names": [ + "string" + ] + }, + "description": "

    Name of scale

    ", + "name": "scale" + } + ], + "returns": [ + { + "description": "

    Pattern

    " + } + ], + "examples": [ + "\"0 2 4 6 4 2\"\n.scale(seq('C2 major', 'C2 minor').slow(2))" + ], + "scope": "static", + "longname": "Pattern.scale", + "kind": "member", + "___id": "T000002R003683", + "___s": true + }, { "kind": "package", "longname": "package:undefined", @@ -2232,7 +2345,7 @@ "/home/felix/projects/strudel/packages/xen/tunejs.js", "/home/felix/projects/strudel/packages/xen/xen.mjs" ], - "___id": "T000002R013973", + "___id": "T000002R013976", "___s": true } ] diff --git a/packages/tonal/tonal.mjs b/packages/tonal/tonal.mjs index 05979d5e..6b82255b 100644 --- a/packages/tonal/tonal.mjs +++ b/packages/tonal/tonal.mjs @@ -42,6 +42,38 @@ function scaleOffset(scale, offset, note) { } // Pattern.prototype._transpose = function (intervalOrSemitones: string | number) { +/** + * Change the pitch of each value by the given amount. Expects numbers or note strings as values. + * The amount can be given as a number of semitones or as a string in interval short notation. + * If you don't care about enharmonic correctness, just use numbers. Otherwise, pass the interval of + * the form: ST where S is the degree number and T the type of interval with + * + * - M = major + * - m = minor + * - P = perfect + * - A = augmented + * - d = diminished + * + * Examples intervals: + * + * - 1P = unison = 0 + * - 3M = major third + * - 3m = minor third + * - 4P = perfect fourth + * - 4A = augmented fourth + * - 5P = perfect fifth + * - 5d = diminished fifth + * + * @param {string | number} amount Either number of semitones or interval string. + * @returns Pattern + * @memberof Pattern + * @name transpose + * @example + * "c2 c3".fast(2).transpose("<0 -2 5 3>".slow(2)).transpose(0) + * @example + * "c2 c3".fast(2).transpose("<1P -2M 4P 3m>".slow(2)).transpose(0) + */ + Pattern.prototype._transpose = function (intervalOrSemitones) { return this._withHap((hap) => { const interval = !isNaN(Number(intervalOrSemitones)) @@ -63,6 +95,20 @@ Pattern.prototype._transpose = function (intervalOrSemitones) { // e.g. `stack(c3).superimpose(transpose(slowcat(7, 5)))` or // or even `stack(c3).superimpose(transpose.slowcat(7, 5))` or +/** + * Transposes notes inside the scale by the number of steps. + * Expected to be called on a Pattern which already has a {@link Pattern#scale} + * + * @memberof Pattern + * @name scaleTranspose + * @param {offset} offset number of steps inside the scale + * @returns Pattern + * @example + * "-8 [2,4,6]" + * .scale('C4 bebop major') + * .scaleTranspose("<0 -1 -2 -3 -4 -5 -6 -4>") + */ + Pattern.prototype._scaleTranspose = function (offset /* : number | string */) { return this._withHap((hap) => { if (!hap.context.scale) { @@ -74,6 +120,25 @@ Pattern.prototype._scaleTranspose = function (offset /* : number | string */) { return hap.withValue(() => scaleOffset(hap.context.scale, Number(offset), hap.value)); }); }; + +/** + * Turns numbers into notes in the scale (zero indexed). Also sets scale for other scale operations, like {@link Pattern#scaleTranspose}. + * + * The scale name has the form "TO? N" wher + * + * - T = Tonic + * - O = Octave (optional, defaults to 3) + * - N = Name of scale, available names can be found [here](https://github.com/tonaljs/tonal/blob/main/packages/scale-type/data.ts). + * + * @memberof Pattern + * @name scale + * @param {string} scale Name of scale + * @returns Pattern + * @example + * "0 2 4 6 4 2" + * .scale(seq('C2 major', 'C2 minor').slow(2)) + */ + Pattern.prototype._scale = function (scale /* : string */) { return this._withHap((hap) => { let note = hap.value; From a9f5bd679d3668687433d69a893f3dd279b826f3 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Sat, 21 May 2022 21:57:37 +0200 Subject: [PATCH 07/26] jsdoc voicings --- doc.json | 43 ++++++++++++++++++++++++++++++++++--- packages/tonal/tonal.mjs | 2 +- packages/tonal/voicings.mjs | 12 +++++++++++ 3 files changed, 53 insertions(+), 4 deletions(-) diff --git a/doc.json b/doc.json index 279769bc..cf49972a 100644 --- a/doc.json +++ b/doc.json @@ -2154,7 +2154,7 @@ "___s": true }, { - "comment": "/**\n * Change the pitch of each value by the given amount. Expects numbers or note strings as values.\n * The amount can be given as a number of semitones or as a string in interval short notation.\n * If you don't care about enharmonic correctness, just use numbers. Otherwise, pass the interval of\n * the form: ST where S is the degree number and T the type of interval with\n *\n * - M = major\n * - m = minor\n * - P = perfect\n * - A = augmented\n * - d = diminished\n *\n * Examples intervals:\n *\n * - 1P = unison = 0\n * - 3M = major third\n * - 3m = minor third\n * - 4P = perfect fourth\n * - 4A = augmented fourth\n * - 5P = perfect fifth\n * - 5d = diminished fifth\n *\n * @param {string | number} amount Either number of semitones or interval string.\n * @returns Pattern\n * @memberof Pattern\n * @name transpose\n * @example\n * \"c2 c3\".fast(2).transpose(\"<0 -2 5 3>\".slow(2)).transpose(0)\n * @example\n * \"c2 c3\".fast(2).transpose(\"<1P -2M 4P 3m>\".slow(2)).transpose(0)\n */", + "comment": "/**\n * Change the pitch of each value by the given amount. Expects numbers or note strings as values.\n * The amount can be given as a number of semitones or as a string in interval short notation.\n * If you don't care about enharmonic correctness, just use numbers. Otherwise, pass the interval of\n * the form: ST where S is the degree number and T the type of interval with\n *\n * - M = major\n * - m = minor\n * - P = perfect\n * - A = augmented\n * - d = diminished\n *\n * Examples intervals:\n *\n * - 1P = unison\n * - 3M = major third\n * - 3m = minor third\n * - 4P = perfect fourth\n * - 4A = augmented fourth\n * - 5P = perfect fifth\n * - 5d = diminished fifth\n *\n * @param {string | number} amount Either number of semitones or interval string.\n * @returns Pattern\n * @memberof Pattern\n * @name transpose\n * @example\n * \"c2 c3\".fast(2).transpose(\"<0 -2 5 3>\".slow(2)).transpose(0)\n * @example\n * \"c2 c3\".fast(2).transpose(\"<1P -2M 4P 3m>\".slow(2)).transpose(0)\n */", "meta": { "filename": "tonal.mjs", "lineno": 45, @@ -2162,7 +2162,7 @@ "path": "/home/felix/projects/strudel/packages/tonal", "code": {} }, - "description": "

    Change the pitch of each value by the given amount. Expects numbers or note strings as values.\nThe amount can be given as a number of semitones or as a string in interval short notation.\nIf you don't care about enharmonic correctness, just use numbers. Otherwise, pass the interval of\nthe form: ST where S is the degree number and T the type of interval with

    \n
      \n
    • M = major
    • \n
    • m = minor
    • \n
    • P = perfect
    • \n
    • A = augmented
    • \n
    • d = diminished
    • \n
    \n

    Examples intervals:

    \n
      \n
    • 1P = unison = 0
    • \n
    • 3M = major third
    • \n
    • 3m = minor third
    • \n
    • 4P = perfect fourth
    • \n
    • 4A = augmented fourth
    • \n
    • 5P = perfect fifth
    • \n
    • 5d = diminished fifth
    • \n
    ", + "description": "

    Change the pitch of each value by the given amount. Expects numbers or note strings as values.\nThe amount can be given as a number of semitones or as a string in interval short notation.\nIf you don't care about enharmonic correctness, just use numbers. Otherwise, pass the interval of\nthe form: ST where S is the degree number and T the type of interval with

    \n
      \n
    • M = major
    • \n
    • m = minor
    • \n
    • P = perfect
    • \n
    • A = augmented
    • \n
    • d = diminished
    • \n
    \n

    Examples intervals:

    \n
      \n
    • 1P = unison
    • \n
    • 3M = major third
    • \n
    • 3m = minor third
    • \n
    • 4P = perfect fourth
    • \n
    • 4A = augmented fourth
    • \n
    • 5P = perfect fifth
    • \n
    • 5d = diminished fifth
    • \n
    ", "params": [ { "type": { @@ -2266,6 +2266,43 @@ "___id": "T000002R003683", "___s": true }, + { + "comment": "/**\n * Turns chord symbols into voicings, using the smoothest voice leading possible.\n * Uses [chord-voicings package](https://github.com/felixroos/chord-voicings#chord-voicings).\n *\n * @name voicings\n * @memberof Pattern\n * @param {range} range note range for possible voicings (optional, defaults to `['F3', 'A4']`)\n * @returns Pattern\n * @example\n * stack(\"\".voicings(), \"\")\n */", + "meta": { + "filename": "voicings.mjs", + "lineno": 34, + "columnno": 0, + "path": "/home/felix/projects/strudel/packages/tonal", + "code": {} + }, + "description": "

    Turns chord symbols into voicings, using the smoothest voice leading possible.\nUses chord-voicings package.

    ", + "name": "voicings", + "memberof": "Pattern", + "params": [ + { + "type": { + "names": [ + "range" + ] + }, + "description": "

    note range for possible voicings (optional, defaults to ['F3', 'A4'])

    ", + "name": "range" + } + ], + "returns": [ + { + "description": "

    Pattern

    " + } + ], + "examples": [ + "stack(\"\".voicings(), \"\")" + ], + "scope": "static", + "longname": "Pattern.voicings", + "kind": "member", + "___id": "T000002R003708", + "___s": true + }, { "kind": "package", "longname": "package:undefined", @@ -2345,7 +2382,7 @@ "/home/felix/projects/strudel/packages/xen/tunejs.js", "/home/felix/projects/strudel/packages/xen/xen.mjs" ], - "___id": "T000002R013976", + "___id": "T000002R013977", "___s": true } ] diff --git a/packages/tonal/tonal.mjs b/packages/tonal/tonal.mjs index 6b82255b..10140e78 100644 --- a/packages/tonal/tonal.mjs +++ b/packages/tonal/tonal.mjs @@ -56,7 +56,7 @@ function scaleOffset(scale, offset, note) { * * Examples intervals: * - * - 1P = unison = 0 + * - 1P = unison * - 3M = major third * - 3m = minor third * - 4P = perfect fourth diff --git a/packages/tonal/voicings.mjs b/packages/tonal/voicings.mjs index 5859c3bc..046fa02b 100644 --- a/packages/tonal/voicings.mjs +++ b/packages/tonal/voicings.mjs @@ -31,6 +31,18 @@ Pattern.prototype.fmapNested = function (func) { ); }; +/** + * Turns chord symbols into voicings, using the smoothest voice leading possible. + * Uses [chord-voicings package](https://github.com/felixroos/chord-voicings#chord-voicings). + * + * @name voicings + * @memberof Pattern + * @param {range} range note range for possible voicings (optional, defaults to `['F3', 'A4']`) + * @returns Pattern + * @example + * stack("".voicings(), "") + */ + Pattern.prototype.voicings = function (range) { let lastVoicing; if (!range?.length) { From a8672ec432fbc76d80f37022d73740aa01daaca9 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Sat, 21 May 2022 22:51:42 +0200 Subject: [PATCH 08/26] fix repl imports --- repl/src/App.jsx | 1 + tutorial/MiniRepl.jsx | 3 +++ 2 files changed, 4 insertions(+) diff --git a/repl/src/App.jsx b/repl/src/App.jsx index 354fdce8..3480a27d 100644 --- a/repl/src/App.jsx +++ b/repl/src/App.jsx @@ -22,6 +22,7 @@ evalScope( import('@strudel.cycles/midi'), import('@strudel.cycles/xen'), import('@strudel.cycles/webaudio'), + import('@strudel.cycles/osc'), ); const initialUrl = window.location.href; diff --git a/tutorial/MiniRepl.jsx b/tutorial/MiniRepl.jsx index 866e1c7f..a01a2f8b 100644 --- a/tutorial/MiniRepl.jsx +++ b/tutorial/MiniRepl.jsx @@ -1,6 +1,7 @@ import { Tone } from '@strudel.cycles/tone'; import { evalScope } from '@strudel.cycles/eval'; import { MiniRepl as _MiniRepl } from '@strudel.cycles/react'; +import controls from '@strudel.cycles/core/controls.mjs'; export const defaultSynth = new Tone.PolySynth().chain(new Tone.Gain(0.5), Tone.Destination).set({ oscillator: { type: 'triangle' }, @@ -11,6 +12,7 @@ export const defaultSynth = new Tone.PolySynth().chain(new Tone.Gain(0.5), Tone. evalScope( Tone, + controls, import('@strudel.cycles/core'), import('@strudel.cycles/tone'), import('@strudel.cycles/tonal'), @@ -18,6 +20,7 @@ evalScope( import('@strudel.cycles/midi'), import('@strudel.cycles/xen'), import('@strudel.cycles/webaudio'), + import('@strudel.cycles/osc'), ); export function MiniRepl({ tune }) { From 987cc6376480487bd2e1e1de8903151083a6c64c Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Sat, 21 May 2022 22:51:56 +0200 Subject: [PATCH 09/26] test control doc --- doc.json | 138 +++++++++++++++++++++++-------------- packages/core/controls.mjs | 9 +++ tutorial/ApiDoc.jsx | 2 +- 3 files changed, 95 insertions(+), 54 deletions(-) diff --git a/doc.json b/doc.json index cf49972a..cd4e29d1 100644 --- a/doc.json +++ b/doc.json @@ -1,5 +1,37 @@ { "docs": [ + { + "comment": "/**\n * Short for sound. Currently only supported with osc / superdirt.\n *\n * @name s\n * @param {string | Pattern} sound The sound / pattern of sounds to pick\n * @example\n * s(\"bd hh\").osc()\n *\n */", + "meta": { + "filename": "controls.mjs", + "lineno": 11, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": {} + }, + "description": "

    Short for sound. Currently only supported with osc / superdirt.

    ", + "name": "s", + "params": [ + { + "type": { + "names": [ + "string", + "Pattern" + ] + }, + "description": "

    The sound / pattern of sounds to pick

    ", + "name": "sound" + } + ], + "examples": [ + "s(\"bd hh\").osc()" + ], + "longname": "s", + "kind": "member", + "scope": "global", + "___id": "T000002R000004", + "___s": true + }, { "comment": "/**\n * Intended for a debugging, drawLine renders the pattern as a string, where each character represents the same time span.\n * Should only be used with single characters as values, otherwise the character slots will be messed up.\n * Character legend:\n *\n * - \"|\" cycle separator\n * - \"-\" hold previous value\n * - \".\" silence\n *\n * @param {Pattern} pattern the pattern to use\n * @param {number} chars max number of characters (approximately)\n * @returns string\n * @example\n * const line = drawLine(\"0 [1 2 3]\", 10); // |0--123|0--123\n * console.log(line);\n */", "meta": { @@ -69,7 +101,7 @@ "longname": "drawLine", "kind": "function", "scope": "global", - "___id": "T000002R000010", + "___id": "T000002R000011", "___s": true }, { @@ -158,7 +190,7 @@ "longname": "Pattern#euclid", "kind": "function", "scope": "instance", - "___id": "T000002R000034", + "___id": "T000002R000035", "___s": true }, { @@ -195,7 +227,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000035", + "___id": "T000002R000036", "___s": true }, { @@ -233,7 +265,7 @@ "name": "query" } ], - "___id": "T000002R000495", + "___id": "T000002R000496", "___s": true }, { @@ -296,7 +328,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000497", + "___id": "T000002R000498", "___s": true }, { @@ -332,7 +364,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000498", + "___id": "T000002R000499", "___s": true }, { @@ -380,7 +412,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000501", + "___id": "T000002R000502", "___s": true }, { @@ -428,7 +460,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000502", + "___id": "T000002R000503", "___s": true }, { @@ -475,7 +507,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000503", + "___id": "T000002R000504", "___s": true }, { @@ -523,7 +555,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000504", + "___id": "T000002R000505", "___s": true }, { @@ -570,7 +602,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000505", + "___id": "T000002R000506", "___s": true }, { @@ -617,7 +649,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000506", + "___id": "T000002R000507", "___s": true }, { @@ -664,7 +696,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000507", + "___id": "T000002R000508", "___s": true }, { @@ -711,7 +743,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000508", + "___id": "T000002R000509", "___s": true }, { @@ -747,7 +779,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000509", + "___id": "T000002R000510", "___s": true }, { @@ -803,7 +835,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000510", + "___id": "T000002R000511", "___s": true }, { @@ -850,7 +882,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000544", + "___id": "T000002R000545", "___s": true }, { @@ -883,7 +915,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000545", + "___id": "T000002R000546", "___s": true }, { @@ -931,7 +963,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000546", + "___id": "T000002R000547", "___s": true }, { @@ -978,7 +1010,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000547", + "___id": "T000002R000548", "___s": true }, { @@ -1014,7 +1046,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000548", + "___id": "T000002R000549", "___s": true }, { @@ -1050,7 +1082,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000549", + "___id": "T000002R000550", "___s": true }, { @@ -1086,7 +1118,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000550", + "___id": "T000002R000551", "___s": true }, { @@ -1133,7 +1165,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000558", + "___id": "T000002R000559", "___s": true }, { @@ -1180,7 +1212,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000560", + "___id": "T000002R000561", "___s": true }, { @@ -1227,7 +1259,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000572", + "___id": "T000002R000573", "___s": true }, { @@ -1276,7 +1308,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000584", + "___id": "T000002R000585", "___s": true }, { @@ -1307,7 +1339,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000587", + "___id": "T000002R000588", "___s": true }, { @@ -1338,7 +1370,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000588", + "___id": "T000002R000589", "___s": true }, { @@ -1374,7 +1406,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000589", + "___id": "T000002R000590", "___s": true }, { @@ -1410,7 +1442,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000608", + "___id": "T000002R000609", "___s": true }, { @@ -1446,7 +1478,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000609", + "___id": "T000002R000610", "___s": true }, { @@ -1482,7 +1514,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000610", + "___id": "T000002R000611", "___s": true }, { @@ -1518,7 +1550,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000611", + "___id": "T000002R000612", "___s": true }, { @@ -1554,7 +1586,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000612", + "___id": "T000002R000613", "___s": true }, { @@ -1610,7 +1642,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000613", + "___id": "T000002R000614", "___s": true }, { @@ -1666,7 +1698,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000614", + "___id": "T000002R000615", "___s": true }, { @@ -1722,7 +1754,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000615", + "___id": "T000002R000616", "___s": true }, { @@ -1758,7 +1790,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000712", + "___id": "T000002R000713", "___s": true }, { @@ -1809,7 +1841,7 @@ "longname": "pure", "kind": "function", "scope": "global", - "___id": "T000002R000830", + "___id": "T000002R000831", "___s": true }, { @@ -1861,7 +1893,7 @@ "longname": "stack", "kind": "function", "scope": "global", - "___id": "T000002R000837", + "___id": "T000002R000838", "___s": true }, { @@ -1913,7 +1945,7 @@ "longname": "slowcat", "kind": "function", "scope": "global", - "___id": "T000002R000841", + "___id": "T000002R000842", "___s": true }, { @@ -1962,7 +1994,7 @@ "longname": "slowcatPrime", "kind": "function", "scope": "global", - "___id": "T000002R000849", + "___id": "T000002R000850", "___s": true }, { @@ -2014,7 +2046,7 @@ "longname": "fastcat", "kind": "function", "scope": "global", - "___id": "T000002R000855", + "___id": "T000002R000856", "___s": true }, { @@ -2042,7 +2074,7 @@ "longname": "cat", "kind": "function", "scope": "global", - "___id": "T000002R000857", + "___id": "T000002R000858", "___s": true }, { @@ -2094,7 +2126,7 @@ "longname": "timeCat", "kind": "function", "scope": "global", - "___id": "T000002R000859", + "___id": "T000002R000860", "___s": true }, { @@ -2122,7 +2154,7 @@ "longname": "sequence", "kind": "function", "scope": "global", - "___id": "T000002R000866", + "___id": "T000002R000867", "___s": true }, { @@ -2150,7 +2182,7 @@ "longname": "seq", "kind": "function", "scope": "global", - "___id": "T000002R000868", + "___id": "T000002R000869", "___s": true }, { @@ -2189,7 +2221,7 @@ "scope": "static", "longname": "Pattern.transpose", "kind": "member", - "___id": "T000002R003677", + "___id": "T000002R003678", "___s": true }, { @@ -2226,7 +2258,7 @@ "scope": "static", "longname": "Pattern.scaleTranspose", "kind": "member", - "___id": "T000002R003681", + "___id": "T000002R003682", "___s": true }, { @@ -2263,7 +2295,7 @@ "scope": "static", "longname": "Pattern.scale", "kind": "member", - "___id": "T000002R003683", + "___id": "T000002R003684", "___s": true }, { @@ -2300,7 +2332,7 @@ "scope": "static", "longname": "Pattern.voicings", "kind": "member", - "___id": "T000002R003708", + "___id": "T000002R003709", "___s": true }, { @@ -2382,7 +2414,7 @@ "/home/felix/projects/strudel/packages/xen/tunejs.js", "/home/felix/projects/strudel/packages/xen/xen.mjs" ], - "___id": "T000002R013977", + "___id": "T000002R013978", "___s": true } ] diff --git a/packages/core/controls.mjs b/packages/core/controls.mjs index 5b09766d..4093eccf 100644 --- a/packages/core/controls.mjs +++ b/packages/core/controls.mjs @@ -8,6 +8,15 @@ import { Pattern, sequence } from './pattern.mjs'; const controls = {}; const generic_params = [ + /** + * Short for sound. Currently only supported with osc / superdirt. + * + * @name s + * @param {string | Pattern} sound The sound / pattern of sounds to pick + * @example + * s("bd hh").osc() + * + */ ['s', 's', 'sound'], //['s', 'toArg', 'for internal sound routing'], // ["f", "from", "for internal sound routing"), diff --git a/tutorial/ApiDoc.jsx b/tutorial/ApiDoc.jsx index 2d642ff1..c3ef7e96 100644 --- a/tutorial/ApiDoc.jsx +++ b/tutorial/ApiDoc.jsx @@ -23,7 +23,7 @@ function ApiDoc() { }), }} /> -

    Parameters

    + {!!item.params?.length &&

    Parameters

    }
      {item.params?.map((param, i) => (
    • From 68a3842c8c3f0d4b355a4d453527490dda86c7cd Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Sun, 22 May 2022 08:35:45 +0200 Subject: [PATCH 10/26] document more controls --- doc.json | 238 ++++++++++++++++++++++++++++--------- packages/core/controls.mjs | 42 ++++++- 2 files changed, 223 insertions(+), 57 deletions(-) diff --git a/doc.json b/doc.json index cd4e29d1..2c90c62c 100644 --- a/doc.json +++ b/doc.json @@ -1,7 +1,7 @@ { "docs": [ { - "comment": "/**\n * Short for sound. Currently only supported with osc / superdirt.\n *\n * @name s\n * @param {string | Pattern} sound The sound / pattern of sounds to pick\n * @example\n * s(\"bd hh\").osc()\n *\n */", + "comment": "/**\n * Select a sound / sample by name. Currently only supported by osc / superdirt.\n *\n * @name s\n * @param {string | Pattern} sound The sound / pattern of sounds to pick\n * @example\n * s(\"bd hh\").osc()\n *\n */", "meta": { "filename": "controls.mjs", "lineno": 11, @@ -9,7 +9,7 @@ "path": "/home/felix/projects/strudel/packages/core", "code": {} }, - "description": "

      Short for sound. Currently only supported with osc / superdirt.

      ", + "description": "

      Select a sound / sample by name. Currently only supported by osc / superdirt.

      ", "name": "s", "params": [ { @@ -32,6 +32,134 @@ "___id": "T000002R000004", "___s": true }, + { + "comment": "/**\n * A pattern of numbers that speed up (or slow down) samples while they play. Currently only supported by osc / superdirt.\n *\n * @name accelerate\n * @param {number | Pattern} amount acceleration.\n * @example\n * s(\"bd\").accelerate(\"<1 2 1 4>\").osc()\n *\n */", + "meta": { + "filename": "controls.mjs", + "lineno": 24, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": {} + }, + "description": "

      A pattern of numbers that speed up (or slow down) samples while they play. Currently only supported by osc / superdirt.

      ", + "name": "accelerate", + "params": [ + { + "type": { + "names": [ + "number", + "Pattern" + ] + }, + "description": "

      acceleration.

      ", + "name": "amount" + } + ], + "examples": [ + "s(\"bd\").accelerate(\"<1 2 1 4>\").osc()" + ], + "longname": "accelerate", + "kind": "member", + "scope": "global", + "___id": "T000002R000005", + "___s": true + }, + { + "comment": "/**\n * Like {@link gain}, but linear.\n *\n * @name amp\n * @param {number | Pattern} amount gain.\n * @example\n * s(\"bd*8\").amp(\".1*2 .5 .1*2 .5 .1 .5\").osc()\n *\n */", + "meta": { + "filename": "controls.mjs", + "lineno": 34, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": {} + }, + "description": "

      Like {@link gain}, but linear.

      ", + "name": "amp", + "params": [ + { + "type": { + "names": [ + "number", + "Pattern" + ] + }, + "description": "

      gain.

      ", + "name": "amount" + } + ], + "examples": [ + "s(\"bd*8\").amp(\".1*2 .5 .1*2 .5 .1 .5\").osc()" + ], + "longname": "amp", + "kind": "member", + "scope": "global", + "___id": "T000002R000006", + "___s": true + }, + { + "comment": "/**\n * A pattern of numbers to specify the attack time of an envelope applied to each sample.\n *\n * @name attack\n * @param {number | Pattern} attack time in seconds.\n * @example\n * n(\"c5 e5\").s('superpiano').attack(\"<0 .1>\").osc()\n *\n */", + "meta": { + "filename": "controls.mjs", + "lineno": 45, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": {} + }, + "description": "

      A pattern of numbers to specify the attack time of an envelope applied to each sample.

      ", + "name": "attack", + "params": [ + { + "type": { + "names": [ + "number", + "Pattern" + ] + }, + "description": "

      time in seconds.

      ", + "name": "attack" + } + ], + "examples": [ + "n(\"c5 e5\").s('superpiano').attack(\"<0 .1>\").osc()" + ], + "longname": "attack", + "kind": "member", + "scope": "global", + "___id": "T000002R000007", + "___s": true + }, + { + "comment": "/**\n * Sets the center frequency of the band-pass filter.\n *\n * @name bandf\n * @param {number | Pattern} frequency center frequency\n * @example\n * s(\"bd sd\").bandf(\"<1000 2000 4000 8000>\").osc()\n *\n */", + "meta": { + "filename": "controls.mjs", + "lineno": 60, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": {} + }, + "description": "

      Sets the center frequency of the band-pass filter.

      ", + "name": "bandf", + "params": [ + { + "type": { + "names": [ + "number", + "Pattern" + ] + }, + "description": "

      center frequency

      ", + "name": "frequency" + } + ], + "examples": [ + "s(\"bd sd\").bandf(\"<1000 2000 4000 8000>\").osc()" + ], + "longname": "bandf", + "kind": "member", + "scope": "global", + "___id": "T000002R000008", + "___s": true + }, { "comment": "/**\n * Intended for a debugging, drawLine renders the pattern as a string, where each character represents the same time span.\n * Should only be used with single characters as values, otherwise the character slots will be messed up.\n * Character legend:\n *\n * - \"|\" cycle separator\n * - \"-\" hold previous value\n * - \".\" silence\n *\n * @param {Pattern} pattern the pattern to use\n * @param {number} chars max number of characters (approximately)\n * @returns string\n * @example\n * const line = drawLine(\"0 [1 2 3]\", 10); // |0--123|0--123\n * console.log(line);\n */", "meta": { @@ -101,7 +229,7 @@ "longname": "drawLine", "kind": "function", "scope": "global", - "___id": "T000002R000011", + "___id": "T000002R000015", "___s": true }, { @@ -190,7 +318,7 @@ "longname": "Pattern#euclid", "kind": "function", "scope": "instance", - "___id": "T000002R000035", + "___id": "T000002R000039", "___s": true }, { @@ -227,7 +355,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000036", + "___id": "T000002R000040", "___s": true }, { @@ -265,7 +393,7 @@ "name": "query" } ], - "___id": "T000002R000496", + "___id": "T000002R000500", "___s": true }, { @@ -328,7 +456,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000498", + "___id": "T000002R000502", "___s": true }, { @@ -364,7 +492,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000499", + "___id": "T000002R000503", "___s": true }, { @@ -412,7 +540,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000502", + "___id": "T000002R000506", "___s": true }, { @@ -460,7 +588,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000503", + "___id": "T000002R000507", "___s": true }, { @@ -507,7 +635,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000504", + "___id": "T000002R000508", "___s": true }, { @@ -555,7 +683,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000505", + "___id": "T000002R000509", "___s": true }, { @@ -602,7 +730,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000506", + "___id": "T000002R000510", "___s": true }, { @@ -649,7 +777,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000507", + "___id": "T000002R000511", "___s": true }, { @@ -696,7 +824,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000508", + "___id": "T000002R000512", "___s": true }, { @@ -743,7 +871,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000509", + "___id": "T000002R000513", "___s": true }, { @@ -779,7 +907,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000510", + "___id": "T000002R000514", "___s": true }, { @@ -835,7 +963,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000511", + "___id": "T000002R000515", "___s": true }, { @@ -882,7 +1010,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000545", + "___id": "T000002R000549", "___s": true }, { @@ -915,7 +1043,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000546", + "___id": "T000002R000550", "___s": true }, { @@ -963,7 +1091,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000547", + "___id": "T000002R000551", "___s": true }, { @@ -1010,7 +1138,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000548", + "___id": "T000002R000552", "___s": true }, { @@ -1046,7 +1174,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000549", + "___id": "T000002R000553", "___s": true }, { @@ -1082,7 +1210,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000550", + "___id": "T000002R000554", "___s": true }, { @@ -1118,7 +1246,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000551", + "___id": "T000002R000555", "___s": true }, { @@ -1165,7 +1293,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000559", + "___id": "T000002R000563", "___s": true }, { @@ -1212,7 +1340,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000561", + "___id": "T000002R000565", "___s": true }, { @@ -1259,7 +1387,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000573", + "___id": "T000002R000577", "___s": true }, { @@ -1308,7 +1436,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000585", + "___id": "T000002R000589", "___s": true }, { @@ -1339,7 +1467,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000588", + "___id": "T000002R000592", "___s": true }, { @@ -1370,7 +1498,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000589", + "___id": "T000002R000593", "___s": true }, { @@ -1406,7 +1534,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000590", + "___id": "T000002R000594", "___s": true }, { @@ -1442,7 +1570,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000609", + "___id": "T000002R000613", "___s": true }, { @@ -1478,7 +1606,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000610", + "___id": "T000002R000614", "___s": true }, { @@ -1514,7 +1642,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000611", + "___id": "T000002R000615", "___s": true }, { @@ -1550,7 +1678,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000612", + "___id": "T000002R000616", "___s": true }, { @@ -1586,7 +1714,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000613", + "___id": "T000002R000617", "___s": true }, { @@ -1642,7 +1770,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000614", + "___id": "T000002R000618", "___s": true }, { @@ -1698,7 +1826,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000615", + "___id": "T000002R000619", "___s": true }, { @@ -1754,7 +1882,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000616", + "___id": "T000002R000620", "___s": true }, { @@ -1790,7 +1918,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000713", + "___id": "T000002R000717", "___s": true }, { @@ -1841,7 +1969,7 @@ "longname": "pure", "kind": "function", "scope": "global", - "___id": "T000002R000831", + "___id": "T000002R000835", "___s": true }, { @@ -1893,7 +2021,7 @@ "longname": "stack", "kind": "function", "scope": "global", - "___id": "T000002R000838", + "___id": "T000002R000842", "___s": true }, { @@ -1945,7 +2073,7 @@ "longname": "slowcat", "kind": "function", "scope": "global", - "___id": "T000002R000842", + "___id": "T000002R000846", "___s": true }, { @@ -1994,7 +2122,7 @@ "longname": "slowcatPrime", "kind": "function", "scope": "global", - "___id": "T000002R000850", + "___id": "T000002R000854", "___s": true }, { @@ -2046,7 +2174,7 @@ "longname": "fastcat", "kind": "function", "scope": "global", - "___id": "T000002R000856", + "___id": "T000002R000860", "___s": true }, { @@ -2074,7 +2202,7 @@ "longname": "cat", "kind": "function", "scope": "global", - "___id": "T000002R000858", + "___id": "T000002R000862", "___s": true }, { @@ -2126,7 +2254,7 @@ "longname": "timeCat", "kind": "function", "scope": "global", - "___id": "T000002R000860", + "___id": "T000002R000864", "___s": true }, { @@ -2154,7 +2282,7 @@ "longname": "sequence", "kind": "function", "scope": "global", - "___id": "T000002R000867", + "___id": "T000002R000871", "___s": true }, { @@ -2182,7 +2310,7 @@ "longname": "seq", "kind": "function", "scope": "global", - "___id": "T000002R000869", + "___id": "T000002R000873", "___s": true }, { @@ -2221,7 +2349,7 @@ "scope": "static", "longname": "Pattern.transpose", "kind": "member", - "___id": "T000002R003678", + "___id": "T000002R003682", "___s": true }, { @@ -2258,7 +2386,7 @@ "scope": "static", "longname": "Pattern.scaleTranspose", "kind": "member", - "___id": "T000002R003682", + "___id": "T000002R003686", "___s": true }, { @@ -2295,7 +2423,7 @@ "scope": "static", "longname": "Pattern.scale", "kind": "member", - "___id": "T000002R003684", + "___id": "T000002R003688", "___s": true }, { @@ -2332,7 +2460,7 @@ "scope": "static", "longname": "Pattern.voicings", "kind": "member", - "___id": "T000002R003709", + "___id": "T000002R003713", "___s": true }, { @@ -2414,7 +2542,7 @@ "/home/felix/projects/strudel/packages/xen/tunejs.js", "/home/felix/projects/strudel/packages/xen/xen.mjs" ], - "___id": "T000002R013978", + "___id": "T000002R013982", "___s": true } ] diff --git a/packages/core/controls.mjs b/packages/core/controls.mjs index 4093eccf..83c75455 100644 --- a/packages/core/controls.mjs +++ b/packages/core/controls.mjs @@ -9,7 +9,7 @@ import { Pattern, sequence } from './pattern.mjs'; const controls = {}; const generic_params = [ /** - * Short for sound. Currently only supported with osc / superdirt. + * Select a sound / sample by name. Currently only supported by osc / superdirt. * * @name s * @param {string | Pattern} sound The sound / pattern of sounds to pick @@ -21,14 +21,52 @@ const generic_params = [ //['s', 'toArg', 'for internal sound routing'], // ["f", "from", "for internal sound routing"), //['f', 'to', 'for internal sound routing'], + /** + * A pattern of numbers that speed up (or slow down) samples while they play. Currently only supported by osc / superdirt. + * + * @name accelerate + * @param {number | Pattern} amount acceleration. + * @example + * s("bd").accelerate("<1 2 1 4>").osc() + * + */ ['f', 'accelerate', 'a pattern of numbers that speed up (or slow down) samples while they play.'], + /** + * Like {@link gain}, but linear. + * + * @name amp + * @param {number | Pattern} amount gain. + * @example + * s("bd*8").amp(".1*2 .5 .1*2 .5 .1 .5").osc() + * + */ ['f', 'amp', 'like @gain@, but linear.'], + // TODO: find out why 0 does not work, and it generally seems not right + /** + * A pattern of numbers to specify the attack time of an envelope applied to each sample. + * + * @name attack + * @param {number | Pattern} attack time in seconds. + * @example + * n("c5 e5").s('superpiano').attack("<0 .1>").osc() + * + */ [ 'f', 'attack', 'a pattern of numbers to specify the attack time (in seconds) of an envelope applied to each sample.', ], - ['f', 'bandf', 'a pattern of numbers from 0 to 1. Sets the center frequency of the band-pass filter.'], + // TODO: in tidal, it seems to be normalized + /** + * Sets the center frequency of the band-pass filter. + * + * @name bandf + * @param {number | Pattern} frequency center frequency + * @example + * s("bd sd").bandf("<1000 2000 4000 8000>").osc() + * + */ + ['f', 'bandf', 'A pattern of numbers from 0 to 1. Sets the center frequency of the band-pass filter.'], ['f', 'bandq', 'a pattern of anumbers from 0 to 1. Sets the q-factor of the band-pass filter.'], [ 'f', From 58104b5a3a24c91c3f8e6d5f5cc0b82287d3101a Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Sun, 22 May 2022 11:53:29 +0200 Subject: [PATCH 11/26] document more controls --- doc.json | 439 +++++++++++++++++++++++++++++++------ packages/core/controls.mjs | 114 +++++++++- 2 files changed, 491 insertions(+), 62 deletions(-) diff --git a/doc.json b/doc.json index 2c90c62c..2ffe2425 100644 --- a/doc.json +++ b/doc.json @@ -1,7 +1,7 @@ { "docs": [ { - "comment": "/**\n * Select a sound / sample by name. Currently only supported by osc / superdirt.\n *\n * @name s\n * @param {string | Pattern} sound The sound / pattern of sounds to pick\n * @example\n * s(\"bd hh\").osc()\n *\n */", + "comment": "/**\n * Select a sound / sample by name. Currently only supported by osc / superdirt.\n * See default sounds here: https://tidalcycles.org/docs/configuration/Audio%20Samples/default_library\n *\n * @name s\n * @param {string | Pattern} sound The sound / pattern of sounds to pick\n * @example\n * s(\"bd hh\").osc()\n *\n */", "meta": { "filename": "controls.mjs", "lineno": 11, @@ -9,7 +9,7 @@ "path": "/home/felix/projects/strudel/packages/core", "code": {} }, - "description": "

      Select a sound / sample by name. Currently only supported by osc / superdirt.

      ", + "description": "

      Select a sound / sample by name. Currently only supported by osc / superdirt.\nSee default sounds here: https://tidalcycles.org/docs/configuration/Audio%20Samples/default_library

      ", "name": "s", "params": [ { @@ -33,10 +33,10 @@ "___s": true }, { - "comment": "/**\n * A pattern of numbers that speed up (or slow down) samples while they play. Currently only supported by osc / superdirt.\n *\n * @name accelerate\n * @param {number | Pattern} amount acceleration.\n * @example\n * s(\"bd\").accelerate(\"<1 2 1 4>\").osc()\n *\n */", + "comment": "/**\n * A pattern of numbers that speed up (or slow down) samples while they play. Currently only supported by osc / superdirt.\n *\n * @name accelerate\n * @param {number | Pattern} amount acceleration.\n * @example\n * s(\"sax\").accelerate(\"<0 1 2 4 8 16>\").slow(2).osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 24, + "lineno": 25, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -56,7 +56,7 @@ } ], "examples": [ - "s(\"bd\").accelerate(\"<1 2 1 4>\").osc()" + "s(\"sax\").accelerate(\"<0 1 2 4 8 16>\").slow(2).osc()" ], "longname": "accelerate", "kind": "member", @@ -68,7 +68,7 @@ "comment": "/**\n * Like {@link gain}, but linear.\n *\n * @name amp\n * @param {number | Pattern} amount gain.\n * @example\n * s(\"bd*8\").amp(\".1*2 .5 .1*2 .5 .1 .5\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 34, + "lineno": 35, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -100,7 +100,7 @@ "comment": "/**\n * A pattern of numbers to specify the attack time of an envelope applied to each sample.\n *\n * @name attack\n * @param {number | Pattern} attack time in seconds.\n * @example\n * n(\"c5 e5\").s('superpiano').attack(\"<0 .1>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 45, + "lineno": 46, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -132,7 +132,7 @@ "comment": "/**\n * Sets the center frequency of the band-pass filter.\n *\n * @name bandf\n * @param {number | Pattern} frequency center frequency\n * @example\n * s(\"bd sd\").bandf(\"<1000 2000 4000 8000>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 60, + "lineno": 61, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -160,6 +160,323 @@ "___id": "T000002R000008", "___s": true }, + { + "comment": "/**\n * Sets the q-factor of the band-pass filter\n *\n * @name bandq\n * @param {number | Pattern} q q factor\n * @example\n * s(\"bd sd\").bandf(\"<1000 2000 4000 8000>\").bandq(\"<.2 .9>\").osc()\n *\n */", + "meta": { + "filename": "controls.mjs", + "lineno": 72, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": {} + }, + "description": "

      Sets the q-factor of the band-pass filter

      ", + "name": "bandq", + "params": [ + { + "type": { + "names": [ + "number", + "Pattern" + ] + }, + "description": "

      q factor

      ", + "name": "q" + } + ], + "examples": [ + "s(\"bd sd\").bandf(\"<1000 2000 4000 8000>\").bandq(\"<.2 .9>\").osc()" + ], + "longname": "bandq", + "kind": "member", + "scope": "global", + "___id": "T000002R000009", + "___s": true + }, + { + "comment": "/**\n * a pattern of numbers from 0 to 1. Skips the beginning of each sample, e.g. `0.25` to cut off the first quarter from each sample.\n *\n * @name begin\n * @param {number | Pattern} amount between 0 and 1, where 1 is the length of the sample\n * @example\n * s(\"rave\").begin(\"<0 .25 .5 .75>\").osc()\n *\n */", + "meta": { + "filename": "controls.mjs", + "lineno": 82, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": {} + }, + "description": "

      a pattern of numbers from 0 to 1. Skips the beginning of each sample, e.g. 0.25 to cut off the first quarter from each sample.

      ", + "name": "begin", + "params": [ + { + "type": { + "names": [ + "number", + "Pattern" + ] + }, + "description": "

      between 0 and 1, where 1 is the length of the sample

      ", + "name": "amount" + } + ], + "examples": [ + "s(\"rave\").begin(\"<0 .25 .5 .75>\").osc()" + ], + "longname": "begin", + "kind": "member", + "scope": "global", + "___id": "T000002R000010", + "___s": true + }, + { + "comment": "/**\n * a pattern of numbers from 0 to 1. Skips the beginning of each sample, e.g. `0.25` to cut off the first quarter from each sample.\n *\n * @name legato\n * @param {number | Pattern} duration between 0 and 1, where 1 is the length of the whole hap time\n * @example\n * \"c4 eb4 g4 bb4\".legato(\"<0.125 .25 .5 .75 1 2 4>\")\n *\n */", + "meta": { + "filename": "controls.mjs", + "lineno": 97, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": {} + }, + "description": "

      a pattern of numbers from 0 to 1. Skips the beginning of each sample, e.g. 0.25 to cut off the first quarter from each sample.

      ", + "name": "legato", + "params": [ + { + "type": { + "names": [ + "number", + "Pattern" + ] + }, + "description": "

      between 0 and 1, where 1 is the length of the whole hap time

      ", + "name": "duration" + } + ], + "examples": [ + "\"c4 eb4 g4 bb4\".legato(\"<0.125 .25 .5 .75 1 2 4>\")" + ], + "longname": "legato", + "kind": "member", + "scope": "global", + "___id": "T000002R000011", + "___s": true + }, + { + "comment": "/**\n * bit crusher effect.\n *\n * @name crush\n * @param {number | Pattern} depth between 1 (for drastic reduction in bit-depth) to 16 (for barely no reduction).\n * @example\n * s(\",hh*3,jvbass*2\").fast(2).crush(\"<16 8 7 6 5 4 3 2>\").osc()\n *\n */", + "meta": { + "filename": "controls.mjs", + "lineno": 108, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": {} + }, + "description": "

      bit crusher effect.

      ", + "name": "crush", + "params": [ + { + "type": { + "names": [ + "number", + "Pattern" + ] + }, + "description": "

      between 1 (for drastic reduction in bit-depth) to 16 (for barely no reduction).

      ", + "name": "depth" + } + ], + "examples": [ + "s(\",hh*3,jvbass*2\").fast(2).crush(\"<16 8 7 6 5 4 3 2>\").osc()" + ], + "longname": "crush", + "kind": "member", + "scope": "global", + "___id": "T000002R000012", + "___s": true + }, + { + "comment": "/**\n * fake-resampling for lowering the sample rate\n *\n * @name coarse\n * @param {number | Pattern} factor 1 for original 2 for half, 3 for a third and so on.\n * @example\n * s(\"xmas\").coarse(\"<1 4 8 16 32>\").osc()\n *\n */", + "meta": { + "filename": "controls.mjs", + "lineno": 122, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": {} + }, + "description": "

      fake-resampling for lowering the sample rate

      ", + "name": "coarse", + "params": [ + { + "type": { + "names": [ + "number", + "Pattern" + ] + }, + "description": "

      1 for original 2 for half, 3 for a third and so on.

      ", + "name": "factor" + } + ], + "examples": [ + "s(\"xmas\").coarse(\"<1 4 8 16 32>\").osc()" + ], + "longname": "coarse", + "kind": "member", + "scope": "global", + "___id": "T000002R000013", + "___s": true + }, + { + "comment": "/**\n * choose the channel the pattern is sent to in superdirt\n *\n * @name channel\n * @param {number | Pattern} channel channel number\n *\n */", + "meta": { + "filename": "controls.mjs", + "lineno": 137, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": {} + }, + "description": "

      choose the channel the pattern is sent to in superdirt

      ", + "name": "channel", + "params": [ + { + "type": { + "names": [ + "number", + "Pattern" + ] + }, + "description": "

      channel number

      ", + "name": "channel" + } + ], + "longname": "channel", + "kind": "member", + "scope": "global", + "___id": "T000002R000014", + "___s": true + }, + { + "comment": "/**\n * In the style of classic drum-machines, `cut` will stop a playing sample as soon as another samples with in same cutgroup is to be played. An example would be an open hi-hat followed by a closed one, essentially muting the open.\n *\n * @name cut\n * @param {number | Pattern} group cut group number\n * @example\n * s(\"bd sax\").cut(1).osc()\n *\n */", + "meta": { + "filename": "controls.mjs", + "lineno": 145, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": {} + }, + "description": "

      In the style of classic drum-machines, cut will stop a playing sample as soon as another samples with in same cutgroup is to be played. An example would be an open hi-hat followed by a closed one, essentially muting the open.

      ", + "name": "cut", + "params": [ + { + "type": { + "names": [ + "number", + "Pattern" + ] + }, + "description": "

      cut group number

      ", + "name": "group" + } + ], + "examples": [ + "s(\"bd sax\").cut(1).osc()" + ], + "longname": "cut", + "kind": "member", + "scope": "global", + "___id": "T000002R000015", + "___s": true + }, + { + "comment": "/**\n * Applies the cutoff frequency of the low-pass filter.\n *\n * @name cutoff\n * @param {number | Pattern} frequency audible between 0 and 20000\n * @example\n * s(\"bd,hh*2,<~ sd>\").fast(2).cutoff(\"<4000 2000 1000 500 200 100>\").osc()\n *\n */", + "meta": { + "filename": "controls.mjs", + "lineno": 159, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": {} + }, + "description": "

      Applies the cutoff frequency of the low-pass filter.

      ", + "name": "cutoff", + "params": [ + { + "type": { + "names": [ + "number", + "Pattern" + ] + }, + "description": "

      audible between 0 and 20000

      ", + "name": "frequency" + } + ], + "examples": [ + "s(\"bd,hh*2,<~ sd>\").fast(2).cutoff(\"<4000 2000 1000 500 200 100>\").osc()" + ], + "longname": "cutoff", + "kind": "member", + "scope": "global", + "___id": "T000002R000016", + "___s": true + }, + { + "comment": "/** \n * Set detune of oscillators. Works only with some synths, see tidal doc\n *\n * @name detune\n * @param {number | Pattern} amount between 0 and 1\n * @example\n * n(\"0 3 7\").s('superzow').octave(3).detune(\"<0 .25 .5 1 2>\").osc()\n *\n */", + "meta": { + "filename": "controls.mjs", + "lineno": 194, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": {} + }, + "description": "

      Set detune of oscillators. Works only with some synths, see tidal doc

      ", + "name": "detune", + "params": [ + { + "type": { + "names": [ + "number", + "Pattern" + ] + }, + "description": "

      between 0 and 1

      ", + "name": "amount" + } + ], + "examples": [ + "n(\"0 3 7\").s('superzow').octave(3).detune(\"<0 .25 .5 1 2>\").osc()" + ], + "longname": "detune", + "kind": "member", + "scope": "global", + "___id": "T000002R000017", + "___s": true + }, + { + "comment": "/** \n * Set detune of oscillators. Works only with some synths, see tidal doc\n *\n * @name djf\n * @param {number | Pattern} cutoff below 0.5 is low pass filter, above is high pass filter\n * @example\n * n(\"0 3 7 [10,24]\").s('superzow').octave(3).djf(\"<.5 .25 .5 .75>\").osc()\n *\n */", + "meta": { + "filename": "controls.mjs", + "lineno": 204, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": {} + }, + "description": "

      Set detune of oscillators. Works only with some synths, see tidal doc

      ", + "name": "djf", + "params": [ + { + "type": { + "names": [ + "number", + "Pattern" + ] + }, + "description": "

      below 0.5 is low pass filter, above is high pass filter

      ", + "name": "cutoff" + } + ], + "examples": [ + "n(\"0 3 7 [10,24]\").s('superzow').octave(3).djf(\"<.5 .25 .5 .75>\").osc()" + ], + "longname": "djf", + "kind": "member", + "scope": "global", + "___id": "T000002R000018", + "___s": true + }, { "comment": "/**\n * Intended for a debugging, drawLine renders the pattern as a string, where each character represents the same time span.\n * Should only be used with single characters as values, otherwise the character slots will be messed up.\n * Character legend:\n *\n * - \"|\" cycle separator\n * - \"-\" hold previous value\n * - \".\" silence\n *\n * @param {Pattern} pattern the pattern to use\n * @param {number} chars max number of characters (approximately)\n * @returns string\n * @example\n * const line = drawLine(\"0 [1 2 3]\", 10); // |0--123|0--123\n * console.log(line);\n */", "meta": { @@ -229,7 +546,7 @@ "longname": "drawLine", "kind": "function", "scope": "global", - "___id": "T000002R000015", + "___id": "T000002R000025", "___s": true }, { @@ -318,7 +635,7 @@ "longname": "Pattern#euclid", "kind": "function", "scope": "instance", - "___id": "T000002R000039", + "___id": "T000002R000049", "___s": true }, { @@ -355,7 +672,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000040", + "___id": "T000002R000050", "___s": true }, { @@ -393,7 +710,7 @@ "name": "query" } ], - "___id": "T000002R000500", + "___id": "T000002R000510", "___s": true }, { @@ -456,7 +773,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000502", + "___id": "T000002R000512", "___s": true }, { @@ -492,7 +809,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000503", + "___id": "T000002R000513", "___s": true }, { @@ -540,7 +857,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000506", + "___id": "T000002R000516", "___s": true }, { @@ -588,7 +905,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000507", + "___id": "T000002R000517", "___s": true }, { @@ -635,7 +952,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000508", + "___id": "T000002R000518", "___s": true }, { @@ -683,7 +1000,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000509", + "___id": "T000002R000519", "___s": true }, { @@ -730,7 +1047,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000510", + "___id": "T000002R000520", "___s": true }, { @@ -777,7 +1094,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000511", + "___id": "T000002R000521", "___s": true }, { @@ -824,7 +1141,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000512", + "___id": "T000002R000522", "___s": true }, { @@ -871,7 +1188,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000513", + "___id": "T000002R000523", "___s": true }, { @@ -907,7 +1224,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000514", + "___id": "T000002R000524", "___s": true }, { @@ -963,7 +1280,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000515", + "___id": "T000002R000525", "___s": true }, { @@ -1010,7 +1327,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000549", + "___id": "T000002R000559", "___s": true }, { @@ -1043,7 +1360,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000550", + "___id": "T000002R000560", "___s": true }, { @@ -1091,7 +1408,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000551", + "___id": "T000002R000561", "___s": true }, { @@ -1138,7 +1455,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000552", + "___id": "T000002R000562", "___s": true }, { @@ -1174,7 +1491,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000553", + "___id": "T000002R000563", "___s": true }, { @@ -1210,7 +1527,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000554", + "___id": "T000002R000564", "___s": true }, { @@ -1246,7 +1563,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000555", + "___id": "T000002R000565", "___s": true }, { @@ -1293,7 +1610,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000563", + "___id": "T000002R000573", "___s": true }, { @@ -1340,7 +1657,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000565", + "___id": "T000002R000575", "___s": true }, { @@ -1387,7 +1704,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000577", + "___id": "T000002R000587", "___s": true }, { @@ -1436,7 +1753,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000589", + "___id": "T000002R000599", "___s": true }, { @@ -1467,7 +1784,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000592", + "___id": "T000002R000602", "___s": true }, { @@ -1498,7 +1815,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000593", + "___id": "T000002R000603", "___s": true }, { @@ -1534,7 +1851,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000594", + "___id": "T000002R000604", "___s": true }, { @@ -1570,7 +1887,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000613", + "___id": "T000002R000623", "___s": true }, { @@ -1606,7 +1923,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000614", + "___id": "T000002R000624", "___s": true }, { @@ -1642,7 +1959,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000615", + "___id": "T000002R000625", "___s": true }, { @@ -1678,7 +1995,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000616", + "___id": "T000002R000626", "___s": true }, { @@ -1714,7 +2031,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000617", + "___id": "T000002R000627", "___s": true }, { @@ -1770,7 +2087,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000618", + "___id": "T000002R000628", "___s": true }, { @@ -1826,7 +2143,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000619", + "___id": "T000002R000629", "___s": true }, { @@ -1882,7 +2199,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000620", + "___id": "T000002R000630", "___s": true }, { @@ -1918,7 +2235,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000717", + "___id": "T000002R000727", "___s": true }, { @@ -1969,7 +2286,7 @@ "longname": "pure", "kind": "function", "scope": "global", - "___id": "T000002R000835", + "___id": "T000002R000845", "___s": true }, { @@ -2021,7 +2338,7 @@ "longname": "stack", "kind": "function", "scope": "global", - "___id": "T000002R000842", + "___id": "T000002R000852", "___s": true }, { @@ -2073,7 +2390,7 @@ "longname": "slowcat", "kind": "function", "scope": "global", - "___id": "T000002R000846", + "___id": "T000002R000856", "___s": true }, { @@ -2122,7 +2439,7 @@ "longname": "slowcatPrime", "kind": "function", "scope": "global", - "___id": "T000002R000854", + "___id": "T000002R000864", "___s": true }, { @@ -2174,7 +2491,7 @@ "longname": "fastcat", "kind": "function", "scope": "global", - "___id": "T000002R000860", + "___id": "T000002R000870", "___s": true }, { @@ -2202,7 +2519,7 @@ "longname": "cat", "kind": "function", "scope": "global", - "___id": "T000002R000862", + "___id": "T000002R000872", "___s": true }, { @@ -2254,7 +2571,7 @@ "longname": "timeCat", "kind": "function", "scope": "global", - "___id": "T000002R000864", + "___id": "T000002R000874", "___s": true }, { @@ -2282,7 +2599,7 @@ "longname": "sequence", "kind": "function", "scope": "global", - "___id": "T000002R000871", + "___id": "T000002R000881", "___s": true }, { @@ -2310,7 +2627,7 @@ "longname": "seq", "kind": "function", "scope": "global", - "___id": "T000002R000873", + "___id": "T000002R000883", "___s": true }, { @@ -2349,7 +2666,7 @@ "scope": "static", "longname": "Pattern.transpose", "kind": "member", - "___id": "T000002R003682", + "___id": "T000002R003692", "___s": true }, { @@ -2386,7 +2703,7 @@ "scope": "static", "longname": "Pattern.scaleTranspose", "kind": "member", - "___id": "T000002R003686", + "___id": "T000002R003696", "___s": true }, { @@ -2423,7 +2740,7 @@ "scope": "static", "longname": "Pattern.scale", "kind": "member", - "___id": "T000002R003688", + "___id": "T000002R003698", "___s": true }, { @@ -2460,7 +2777,7 @@ "scope": "static", "longname": "Pattern.voicings", "kind": "member", - "___id": "T000002R003713", + "___id": "T000002R003723", "___s": true }, { @@ -2542,7 +2859,7 @@ "/home/felix/projects/strudel/packages/xen/tunejs.js", "/home/felix/projects/strudel/packages/xen/xen.mjs" ], - "___id": "T000002R013982", + "___id": "T000002R013992", "___s": true } ] diff --git a/packages/core/controls.mjs b/packages/core/controls.mjs index 83c75455..a34784e4 100644 --- a/packages/core/controls.mjs +++ b/packages/core/controls.mjs @@ -10,6 +10,7 @@ const controls = {}; const generic_params = [ /** * Select a sound / sample by name. Currently only supported by osc / superdirt. + * See default sounds here: https://tidalcycles.org/docs/configuration/Audio%20Samples/default_library * * @name s * @param {string | Pattern} sound The sound / pattern of sounds to pick @@ -27,7 +28,7 @@ const generic_params = [ * @name accelerate * @param {number | Pattern} amount acceleration. * @example - * s("bd").accelerate("<1 2 1 4>").osc() + * s("sax").accelerate("<0 1 2 4 8 16>").slow(2).osc() * */ ['f', 'accelerate', 'a pattern of numbers that speed up (or slow down) samples while they play.'], @@ -67,37 +68,148 @@ const generic_params = [ * */ ['f', 'bandf', 'A pattern of numbers from 0 to 1. Sets the center frequency of the band-pass filter.'], + // TODO: in tidal, it seems to be normalized + /** + * Sets the q-factor of the band-pass filter + * + * @name bandq + * @param {number | Pattern} q q factor + * @example + * s("bd sd").bandf("<1000 2000 4000 8000>").bandq("<.2 .9>").osc() + * + */ ['f', 'bandq', 'a pattern of anumbers from 0 to 1. Sets the q-factor of the band-pass filter.'], + /** + * a pattern of numbers from 0 to 1. Skips the beginning of each sample, e.g. `0.25` to cut off the first quarter from each sample. + * + * @name begin + * @param {number | Pattern} amount between 0 and 1, where 1 is the length of the sample + * @example + * s("rave").begin("<0 .25 .5 .75>").osc() + * + */ [ 'f', 'begin', 'a pattern of numbers from 0 to 1. Skips the beginning of each sample, e.g. `0.25` to cut off the first quarter from each sample.', ], + // TODO: currently duplicated with "native" legato + /** + * a pattern of numbers from 0 to 1. Skips the beginning of each sample, e.g. `0.25` to cut off the first quarter from each sample. + * + * @name legato + * @param {number | Pattern} duration between 0 and 1, where 1 is the length of the whole hap time + * @example + * "c4 eb4 g4 bb4".legato("<0.125 .25 .5 .75 1 2 4>") + * + */ ['f', 'legato', 'controls the amount of overlap between two adjacent sounds'], // ['f', 'clhatdecay', ''], + /** + * bit crusher effect. + * + * @name crush + * @param {number | Pattern} depth between 1 (for drastic reduction in bit-depth) to 16 (for barely no reduction). + * @example + * s(",hh*3,jvbass*2").fast(2).crush("<16 8 7 6 5 4 3 2>").osc() + * + */ [ 'f', 'crush', 'bit crushing, a pattern of numbers from 1 (for drastic reduction in bit-depth) to 16 (for barely no reduction).', ], + /** + * fake-resampling for lowering the sample rate + * + * @name coarse + * @param {number | Pattern} factor 1 for original 2 for half, 3 for a third and so on. + * @example + * s("xmas").coarse("<1 4 8 16 32>").osc() + * + */ [ 'f', 'coarse', 'fake-resampling, a pattern of numbers for lowering the sample rate, i.e. 1 for original 2 for half, 3 for a third and so on.', ], + + /** + * choose the channel the pattern is sent to in superdirt + * + * @name channel + * @param {number | Pattern} channel channel number + * + */ ['i', 'channel', 'choose the channel the pattern is sent to in superdirt'], + /** + * In the style of classic drum-machines, `cut` will stop a playing sample as soon as another samples with in same cutgroup is to be played. An example would be an open hi-hat followed by a closed one, essentially muting the open. + * + * @name cut + * @param {number | Pattern} group cut group number + * @example + * s("bd sax").cut(1).osc() + * + */ [ 'i', 'cut', 'In the style of classic drum-machines, `cut` will stop a playing sample as soon as another samples with in same cutgroup is to be played. An example would be an open hi-hat followed by a closed one, essentially muting the open.', ], + /** + * Applies the cutoff frequency of the low-pass filter. + * + * @name cutoff + * @param {number | Pattern} frequency audible between 0 and 20000 + * @example + * s("bd,hh*2,<~ sd>").fast(2).cutoff("<4000 2000 1000 500 200 100>").osc() + * + */ ['f', 'cutoff', 'a pattern of numbers from 0 to 1. Applies the cutoff frequency of the low-pass filter.'], // ['f', 'cutoffegint', ''], + // TODO: find out how this works? + /* + * Envelope decay time = the time it takes after the attack time to reach the sustain level. + * + * @name decay + * @param {number | Pattern} time decay time in seconds + * @example + * s("sax").cut(1).decay("<.1 .2 .3 .4>").sustain(0).osc() + * + */ ['f', 'decay', ''], + // TODO: does not seem to work + /* + * Sets the level of the delay signal. + * + * @name delay + * @param {number | Pattern} level between 0 and 1 + * @example + * s("bd").delay("<0 .5 .75 1>").osc() + * + */ ['f', 'delay', 'a pattern of numbers from 0 to 1. Sets the level of the delay signal.'], ['f', 'delayfeedback', 'a pattern of numbers from 0 to 1. Sets the amount of delay feedback.'], ['f', 'delaytime', 'a pattern of numbers from 0 to 1. Sets the length of the delay.'], + /** + * Set detune of oscillators. Works only with some synths, see tidal doc + * + * @name detune + * @param {number | Pattern} amount between 0 and 1 + * @example + * n("0 3 7").s('superzow').octave(3).detune("<0 .25 .5 1 2>").osc() + * + */ ['f', 'detune', ''], + /** + * Set detune of oscillators. Works only with some synths, see tidal doc + * + * @name djf + * @param {number | Pattern} cutoff below 0.5 is low pass filter, above is high pass filter + * @example + * n("0 3 7 [10,24]").s('superzow').octave(3).djf("<.5 .25 .5 .75>").osc() + * + */ ['f', 'djf', 'DJ filter, below 0.5 is low pass filter, above is high pass filter.'], [ 'f', From 4c4d0b426e09e6aaa01dff582158ca78ff46610e Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Sun, 22 May 2022 12:26:45 +0200 Subject: [PATCH 12/26] even more control doc + more logical grouping --- doc.json | 316 ++++++++++++++++++++++++------------- packages/core/controls.mjs | 100 ++++++++---- 2 files changed, 275 insertions(+), 141 deletions(-) diff --git a/doc.json b/doc.json index 2ffe2425..5040d048 100644 --- a/doc.json +++ b/doc.json @@ -65,7 +65,7 @@ "___s": true }, { - "comment": "/**\n * Like {@link gain}, but linear.\n *\n * @name amp\n * @param {number | Pattern} amount gain.\n * @example\n * s(\"bd*8\").amp(\".1*2 .5 .1*2 .5 .1 .5\").osc()\n *\n */", + "comment": "/**\n * Like {@link amp}, but exponential.\n *\n * @name gain\n * @param {number | Pattern} amount gain.\n * @example\n * s(\"bd*8\").gain(\".7*2 1 .7*2 1 .7 1\").osc()\n *\n */", "meta": { "filename": "controls.mjs", "lineno": 35, @@ -73,6 +73,38 @@ "path": "/home/felix/projects/strudel/packages/core", "code": {} }, + "description": "

      Like {@link amp}, but exponential.

      ", + "name": "gain", + "params": [ + { + "type": { + "names": [ + "number", + "Pattern" + ] + }, + "description": "

      gain.

      ", + "name": "amount" + } + ], + "examples": [ + "s(\"bd*8\").gain(\".7*2 1 .7*2 1 .7 1\").osc()" + ], + "longname": "gain", + "kind": "member", + "scope": "global", + "___id": "T000002R000006", + "___s": true + }, + { + "comment": "/**\n * Like {@link gain}, but linear.\n *\n * @name amp\n * @param {number | Pattern} amount gain.\n * @example\n * s(\"bd*8\").amp(\".1*2 .5 .1*2 .5 .1 .5\").osc()\n *\n */", + "meta": { + "filename": "controls.mjs", + "lineno": 49, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": {} + }, "description": "

      Like {@link gain}, but linear.

      ", "name": "amp", "params": [ @@ -93,14 +125,14 @@ "longname": "amp", "kind": "member", "scope": "global", - "___id": "T000002R000006", + "___id": "T000002R000007", "___s": true }, { "comment": "/**\n * A pattern of numbers to specify the attack time of an envelope applied to each sample.\n *\n * @name attack\n * @param {number | Pattern} attack time in seconds.\n * @example\n * n(\"c5 e5\").s('superpiano').attack(\"<0 .1>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 46, + "lineno": 60, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -125,14 +157,14 @@ "longname": "attack", "kind": "member", "scope": "global", - "___id": "T000002R000007", + "___id": "T000002R000008", "___s": true }, { "comment": "/**\n * Sets the center frequency of the band-pass filter.\n *\n * @name bandf\n * @param {number | Pattern} frequency center frequency\n * @example\n * s(\"bd sd\").bandf(\"<1000 2000 4000 8000>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 61, + "lineno": 92, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -157,14 +189,14 @@ "longname": "bandf", "kind": "member", "scope": "global", - "___id": "T000002R000008", + "___id": "T000002R000009", "___s": true }, { "comment": "/**\n * Sets the q-factor of the band-pass filter\n *\n * @name bandq\n * @param {number | Pattern} q q factor\n * @example\n * s(\"bd sd\").bandf(\"<1000 2000 4000 8000>\").bandq(\"<.2 .9>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 72, + "lineno": 103, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -189,14 +221,14 @@ "longname": "bandq", "kind": "member", "scope": "global", - "___id": "T000002R000009", + "___id": "T000002R000010", "___s": true }, { "comment": "/**\n * a pattern of numbers from 0 to 1. Skips the beginning of each sample, e.g. `0.25` to cut off the first quarter from each sample.\n *\n * @name begin\n * @param {number | Pattern} amount between 0 and 1, where 1 is the length of the sample\n * @example\n * s(\"rave\").begin(\"<0 .25 .5 .75>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 82, + "lineno": 113, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -221,14 +253,46 @@ "longname": "begin", "kind": "member", "scope": "global", - "___id": "T000002R000010", + "___id": "T000002R000011", + "___s": true + }, + { + "comment": "/**\n * The same as {@link begin}, but cuts off the end off each sample.\n *\n * @name end\n * @param {number | Pattern} length 1 = whole sample, .5 = half sample, .25 = quarter sample etc..\n * @example\n * s(\"bd*2,ho*4\").end(\"<.1 .2 .5 1>\").osc()\n *\n */", + "meta": { + "filename": "controls.mjs", + "lineno": 127, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": {} + }, + "description": "

      The same as {@link begin}, but cuts off the end off each sample.

      ", + "name": "end", + "params": [ + { + "type": { + "names": [ + "number", + "Pattern" + ] + }, + "description": "

      1 = whole sample, .5 = half sample, .25 = quarter sample etc..

      ", + "name": "length" + } + ], + "examples": [ + "s(\"bd*2,ho*4\").end(\"<.1 .2 .5 1>\").osc()" + ], + "longname": "end", + "kind": "member", + "scope": "global", + "___id": "T000002R000012", "___s": true }, { "comment": "/**\n * a pattern of numbers from 0 to 1. Skips the beginning of each sample, e.g. `0.25` to cut off the first quarter from each sample.\n *\n * @name legato\n * @param {number | Pattern} duration between 0 and 1, where 1 is the length of the whole hap time\n * @example\n * \"c4 eb4 g4 bb4\".legato(\"<0.125 .25 .5 .75 1 2 4>\")\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 97, + "lineno": 142, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -253,14 +317,14 @@ "longname": "legato", "kind": "member", "scope": "global", - "___id": "T000002R000011", + "___id": "T000002R000013", "___s": true }, { "comment": "/**\n * bit crusher effect.\n *\n * @name crush\n * @param {number | Pattern} depth between 1 (for drastic reduction in bit-depth) to 16 (for barely no reduction).\n * @example\n * s(\",hh*3,jvbass*2\").fast(2).crush(\"<16 8 7 6 5 4 3 2>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 108, + "lineno": 153, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -285,14 +349,14 @@ "longname": "crush", "kind": "member", "scope": "global", - "___id": "T000002R000012", + "___id": "T000002R000014", "___s": true }, { "comment": "/**\n * fake-resampling for lowering the sample rate\n *\n * @name coarse\n * @param {number | Pattern} factor 1 for original 2 for half, 3 for a third and so on.\n * @example\n * s(\"xmas\").coarse(\"<1 4 8 16 32>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 122, + "lineno": 167, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -317,14 +381,14 @@ "longname": "coarse", "kind": "member", "scope": "global", - "___id": "T000002R000013", + "___id": "T000002R000015", "___s": true }, { "comment": "/**\n * choose the channel the pattern is sent to in superdirt\n *\n * @name channel\n * @param {number | Pattern} channel channel number\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 137, + "lineno": 182, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -346,14 +410,14 @@ "longname": "channel", "kind": "member", "scope": "global", - "___id": "T000002R000014", + "___id": "T000002R000016", "___s": true }, { "comment": "/**\n * In the style of classic drum-machines, `cut` will stop a playing sample as soon as another samples with in same cutgroup is to be played. An example would be an open hi-hat followed by a closed one, essentially muting the open.\n *\n * @name cut\n * @param {number | Pattern} group cut group number\n * @example\n * s(\"bd sax\").cut(1).osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 145, + "lineno": 190, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -378,14 +442,14 @@ "longname": "cut", "kind": "member", "scope": "global", - "___id": "T000002R000015", + "___id": "T000002R000017", "___s": true }, { "comment": "/**\n * Applies the cutoff frequency of the low-pass filter.\n *\n * @name cutoff\n * @param {number | Pattern} frequency audible between 0 and 20000\n * @example\n * s(\"bd,hh*2,<~ sd>\").fast(2).cutoff(\"<4000 2000 1000 500 200 100>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 159, + "lineno": 204, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -410,46 +474,14 @@ "longname": "cutoff", "kind": "member", "scope": "global", - "___id": "T000002R000016", + "___id": "T000002R000018", "___s": true }, { - "comment": "/** \n * Set detune of oscillators. Works only with some synths, see tidal doc\n *\n * @name detune\n * @param {number | Pattern} amount between 0 and 1\n * @example\n * n(\"0 3 7\").s('superzow').octave(3).detune(\"<0 .25 .5 1 2>\").osc()\n *\n */", + "comment": "/**\n * Set detune of oscillators. Works only with some synths, see tidal doc\n *\n * @name djf\n * @param {number | Pattern} cutoff below 0.5 is low pass filter, above is high pass filter\n * @example\n * n(\"0 3 7 [10,24]\").s('superzow').octave(3).djf(\"<.5 .25 .5 .75>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 194, - "columnno": 2, - "path": "/home/felix/projects/strudel/packages/core", - "code": {} - }, - "description": "

      Set detune of oscillators. Works only with some synths, see tidal doc

      ", - "name": "detune", - "params": [ - { - "type": { - "names": [ - "number", - "Pattern" - ] - }, - "description": "

      between 0 and 1

      ", - "name": "amount" - } - ], - "examples": [ - "n(\"0 3 7\").s('superzow').octave(3).detune(\"<0 .25 .5 1 2>\").osc()" - ], - "longname": "detune", - "kind": "member", - "scope": "global", - "___id": "T000002R000017", - "___s": true - }, - { - "comment": "/** \n * Set detune of oscillators. Works only with some synths, see tidal doc\n *\n * @name djf\n * @param {number | Pattern} cutoff below 0.5 is low pass filter, above is high pass filter\n * @example\n * n(\"0 3 7 [10,24]\").s('superzow').octave(3).djf(\"<.5 .25 .5 .75>\").osc()\n *\n */", - "meta": { - "filename": "controls.mjs", - "lineno": 204, + "lineno": 214, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -474,7 +506,71 @@ "longname": "djf", "kind": "member", "scope": "global", - "___id": "T000002R000018", + "___id": "T000002R000019", + "___s": true + }, + { + "comment": "/**\n * Set detune of oscillators. Works only with some synths, see tidal doc\n *\n * @name detune\n * @param {number | Pattern} amount between 0 and 1\n * @example\n * n(\"0 3 7\").s('superzow').octave(3).detune(\"<0 .25 .5 1 2>\").osc()\n *\n */", + "meta": { + "filename": "controls.mjs", + "lineno": 238, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": {} + }, + "description": "

      Set detune of oscillators. Works only with some synths, see tidal doc

      ", + "name": "detune", + "params": [ + { + "type": { + "names": [ + "number", + "Pattern" + ] + }, + "description": "

      between 0 and 1

      ", + "name": "amount" + } + ], + "examples": [ + "n(\"0 3 7\").s('superzow').octave(3).detune(\"<0 .25 .5 1 2>\").osc()" + ], + "longname": "detune", + "kind": "member", + "scope": "global", + "___id": "T000002R000020", + "___s": true + }, + { + "comment": "/**\n * Set dryness of reverb. See {@link room} and {@link size} for more information about reverb.\n *\n * @name dry\n * @param {number | Pattern} dry 0 = wet, 1 = dry\n * @example\n * n(\"[0,3,7](3,8)\").s(\"superpiano\").room(.7).dry(\"<0 .5 .75 1>\").osc()\n *\n */", + "meta": { + "filename": "controls.mjs", + "lineno": 248, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": {} + }, + "description": "

      Set dryness of reverb. See {@link room} and {@link size} for more information about reverb.

      ", + "name": "dry", + "params": [ + { + "type": { + "names": [ + "number", + "Pattern" + ] + }, + "description": "

      0 = wet, 1 = dry

      ", + "name": "dry" + } + ], + "examples": [ + "n(\"[0,3,7](3,8)\").s(\"superpiano\").room(.7).dry(\"<0 .5 .75 1>\").osc()" + ], + "longname": "dry", + "kind": "member", + "scope": "global", + "___id": "T000002R000021", "___s": true }, { @@ -546,7 +642,7 @@ "longname": "drawLine", "kind": "function", "scope": "global", - "___id": "T000002R000025", + "___id": "T000002R000028", "___s": true }, { @@ -635,7 +731,7 @@ "longname": "Pattern#euclid", "kind": "function", "scope": "instance", - "___id": "T000002R000049", + "___id": "T000002R000052", "___s": true }, { @@ -672,7 +768,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000050", + "___id": "T000002R000053", "___s": true }, { @@ -710,7 +806,7 @@ "name": "query" } ], - "___id": "T000002R000510", + "___id": "T000002R000513", "___s": true }, { @@ -773,7 +869,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000512", + "___id": "T000002R000515", "___s": true }, { @@ -809,7 +905,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000513", + "___id": "T000002R000516", "___s": true }, { @@ -857,7 +953,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000516", + "___id": "T000002R000519", "___s": true }, { @@ -905,7 +1001,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000517", + "___id": "T000002R000520", "___s": true }, { @@ -952,7 +1048,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000518", + "___id": "T000002R000521", "___s": true }, { @@ -1000,7 +1096,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000519", + "___id": "T000002R000522", "___s": true }, { @@ -1047,7 +1143,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000520", + "___id": "T000002R000523", "___s": true }, { @@ -1094,7 +1190,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000521", + "___id": "T000002R000524", "___s": true }, { @@ -1141,7 +1237,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000522", + "___id": "T000002R000525", "___s": true }, { @@ -1188,7 +1284,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000523", + "___id": "T000002R000526", "___s": true }, { @@ -1224,7 +1320,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000524", + "___id": "T000002R000527", "___s": true }, { @@ -1280,7 +1376,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000525", + "___id": "T000002R000528", "___s": true }, { @@ -1327,7 +1423,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000559", + "___id": "T000002R000562", "___s": true }, { @@ -1360,7 +1456,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000560", + "___id": "T000002R000563", "___s": true }, { @@ -1408,7 +1504,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000561", + "___id": "T000002R000564", "___s": true }, { @@ -1455,7 +1551,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000562", + "___id": "T000002R000565", "___s": true }, { @@ -1491,7 +1587,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000563", + "___id": "T000002R000566", "___s": true }, { @@ -1527,7 +1623,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000564", + "___id": "T000002R000567", "___s": true }, { @@ -1563,7 +1659,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000565", + "___id": "T000002R000568", "___s": true }, { @@ -1610,7 +1706,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000573", + "___id": "T000002R000576", "___s": true }, { @@ -1657,7 +1753,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000575", + "___id": "T000002R000578", "___s": true }, { @@ -1704,7 +1800,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000587", + "___id": "T000002R000590", "___s": true }, { @@ -1753,7 +1849,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000599", + "___id": "T000002R000602", "___s": true }, { @@ -1784,7 +1880,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000602", + "___id": "T000002R000605", "___s": true }, { @@ -1815,7 +1911,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000603", + "___id": "T000002R000606", "___s": true }, { @@ -1851,7 +1947,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000604", + "___id": "T000002R000607", "___s": true }, { @@ -1887,7 +1983,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000623", + "___id": "T000002R000626", "___s": true }, { @@ -1923,7 +2019,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000624", + "___id": "T000002R000627", "___s": true }, { @@ -1959,7 +2055,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000625", + "___id": "T000002R000628", "___s": true }, { @@ -1995,7 +2091,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000626", + "___id": "T000002R000629", "___s": true }, { @@ -2031,7 +2127,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000627", + "___id": "T000002R000630", "___s": true }, { @@ -2087,7 +2183,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000628", + "___id": "T000002R000631", "___s": true }, { @@ -2143,7 +2239,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000629", + "___id": "T000002R000632", "___s": true }, { @@ -2199,7 +2295,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000630", + "___id": "T000002R000633", "___s": true }, { @@ -2235,7 +2331,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000727", + "___id": "T000002R000730", "___s": true }, { @@ -2286,7 +2382,7 @@ "longname": "pure", "kind": "function", "scope": "global", - "___id": "T000002R000845", + "___id": "T000002R000848", "___s": true }, { @@ -2338,7 +2434,7 @@ "longname": "stack", "kind": "function", "scope": "global", - "___id": "T000002R000852", + "___id": "T000002R000855", "___s": true }, { @@ -2390,7 +2486,7 @@ "longname": "slowcat", "kind": "function", "scope": "global", - "___id": "T000002R000856", + "___id": "T000002R000859", "___s": true }, { @@ -2439,7 +2535,7 @@ "longname": "slowcatPrime", "kind": "function", "scope": "global", - "___id": "T000002R000864", + "___id": "T000002R000867", "___s": true }, { @@ -2491,7 +2587,7 @@ "longname": "fastcat", "kind": "function", "scope": "global", - "___id": "T000002R000870", + "___id": "T000002R000873", "___s": true }, { @@ -2519,7 +2615,7 @@ "longname": "cat", "kind": "function", "scope": "global", - "___id": "T000002R000872", + "___id": "T000002R000875", "___s": true }, { @@ -2571,7 +2667,7 @@ "longname": "timeCat", "kind": "function", "scope": "global", - "___id": "T000002R000874", + "___id": "T000002R000877", "___s": true }, { @@ -2599,7 +2695,7 @@ "longname": "sequence", "kind": "function", "scope": "global", - "___id": "T000002R000881", + "___id": "T000002R000884", "___s": true }, { @@ -2627,7 +2723,7 @@ "longname": "seq", "kind": "function", "scope": "global", - "___id": "T000002R000883", + "___id": "T000002R000886", "___s": true }, { @@ -2666,7 +2762,7 @@ "scope": "static", "longname": "Pattern.transpose", "kind": "member", - "___id": "T000002R003692", + "___id": "T000002R003695", "___s": true }, { @@ -2703,7 +2799,7 @@ "scope": "static", "longname": "Pattern.scaleTranspose", "kind": "member", - "___id": "T000002R003696", + "___id": "T000002R003699", "___s": true }, { @@ -2740,7 +2836,7 @@ "scope": "static", "longname": "Pattern.scale", "kind": "member", - "___id": "T000002R003698", + "___id": "T000002R003701", "___s": true }, { @@ -2777,7 +2873,7 @@ "scope": "static", "longname": "Pattern.voicings", "kind": "member", - "___id": "T000002R003723", + "___id": "T000002R003726", "___s": true }, { @@ -2859,7 +2955,7 @@ "/home/felix/projects/strudel/packages/xen/tunejs.js", "/home/felix/projects/strudel/packages/xen/xen.mjs" ], - "___id": "T000002R013992", + "___id": "T000002R013995", "___s": true } ] diff --git a/packages/core/controls.mjs b/packages/core/controls.mjs index a34784e4..f3a1458b 100644 --- a/packages/core/controls.mjs +++ b/packages/core/controls.mjs @@ -32,6 +32,20 @@ const generic_params = [ * */ ['f', 'accelerate', 'a pattern of numbers that speed up (or slow down) samples while they play.'], + /** + * Like {@link amp}, but exponential. + * + * @name gain + * @param {number | Pattern} amount gain. + * @example + * s("bd*8").gain(".7*2 1 .7*2 1 .7 1").osc() + * + */ + [ + 'f', + 'gain', + 'a pattern of numbers that specify volume. Values less than 1 make the sound quieter. Values greater than 1 make the sound louder. For the linear equivalent, see @amp@.', + ], /** * Like {@link gain}, but linear. * @@ -57,6 +71,23 @@ const generic_params = [ 'attack', 'a pattern of numbers to specify the attack time (in seconds) of an envelope applied to each sample.', ], + // TODO: find out how this works? + /* + * Envelope decay time = the time it takes after the attack time to reach the sustain level. + * + * @name decay + * @param {number | Pattern} time decay time in seconds + * @example + * s("sax").cut(1).decay("<.1 .2 .3 .4>").sustain(0).osc() + * + */ + ['f', 'decay', ''], + ['f', 'sustain', ''], + [ + 'f', + 'release', + 'a pattern of numbers to specify the release time (in seconds) of an envelope applied to each sample.', + ], // TODO: in tidal, it seems to be normalized /** * Sets the center frequency of the band-pass filter. @@ -93,6 +124,20 @@ const generic_params = [ 'begin', 'a pattern of numbers from 0 to 1. Skips the beginning of each sample, e.g. `0.25` to cut off the first quarter from each sample.', ], + /** + * The same as {@link begin}, but cuts off the end off each sample. + * + * @name end + * @param {number | Pattern} length 1 = whole sample, .5 = half sample, .25 = quarter sample etc.. + * @example + * s("bd*2,ho*4").end("<.1 .2 .5 1>").osc() + * + */ + [ + 'f', + 'end', + 'the same as `begin`, but cuts the end off samples, shortening them; e.g. `0.75` to cut off the last quarter of each sample.', + ], // TODO: currently duplicated with "native" legato /** * a pattern of numbers from 0 to 1. Skips the beginning of each sample, e.g. `0.25` to cut off the first quarter from each sample. @@ -166,18 +211,17 @@ const generic_params = [ * */ ['f', 'cutoff', 'a pattern of numbers from 0 to 1. Applies the cutoff frequency of the low-pass filter.'], - // ['f', 'cutoffegint', ''], - // TODO: find out how this works? - /* - * Envelope decay time = the time it takes after the attack time to reach the sustain level. + /** + * Set detune of oscillators. Works only with some synths, see tidal doc * - * @name decay - * @param {number | Pattern} time decay time in seconds + * @name djf + * @param {number | Pattern} cutoff below 0.5 is low pass filter, above is high pass filter * @example - * s("sax").cut(1).decay("<.1 .2 .3 .4>").sustain(0).osc() + * n("0 3 7 [10,24]").s('superzow').octave(3).djf("<.5 .25 .5 .75>").osc() * */ - ['f', 'decay', ''], + ['f', 'djf', 'DJ filter, below 0.5 is low pass filter, above is high pass filter.'], + // ['f', 'cutoffegint', ''], // TODO: does not seem to work /* * Sets the level of the delay signal. @@ -191,7 +235,7 @@ const generic_params = [ ['f', 'delay', 'a pattern of numbers from 0 to 1. Sets the level of the delay signal.'], ['f', 'delayfeedback', 'a pattern of numbers from 0 to 1. Sets the amount of delay feedback.'], ['f', 'delaytime', 'a pattern of numbers from 0 to 1. Sets the length of the delay.'], - /** + /** * Set detune of oscillators. Works only with some synths, see tidal doc * * @name detune @@ -201,42 +245,42 @@ const generic_params = [ * */ ['f', 'detune', ''], - /** - * Set detune of oscillators. Works only with some synths, see tidal doc + /** + * Set dryness of reverb. See {@link room} and {@link size} for more information about reverb. * - * @name djf - * @param {number | Pattern} cutoff below 0.5 is low pass filter, above is high pass filter + * @name dry + * @param {number | Pattern} dry 0 = wet, 1 = dry * @example - * n("0 3 7 [10,24]").s('superzow').octave(3).djf("<.5 .25 .5 .75>").osc() + * n("[0,3,7](3,8)").s("superpiano").room(.7).dry("<0 .5 .75 1>").osc() * */ - ['f', 'djf', 'DJ filter, below 0.5 is low pass filter, above is high pass filter.'], [ 'f', 'dry', 'when set to `1` will disable all reverb for this pattern. See `room` and `size` for more information about reverb.', ], - [ - 'f', - 'end', - 'the same as `begin`, but cuts the end off samples, shortening them; e.g. `0.75` to cut off the last quarter of each sample.', - ], + // TODO: does not seem to do anything + /* + * Used when using {@link begin}/{@link end} or {@link chop}/{@link striate} and friends, to change the fade out time of the 'grain' envelope. + * + * @name fadeTime + * @param {number | Pattern} time between 0 and 1 + * @example + * s("ho*4").end(.1).fadeTime("<0 .2 .4 .8>").osc() + * + */ [ 'f', 'fadeTime', "Used when using begin/end or chop/striate and friends, to change the fade out time of the 'grain' envelope.", ], + // TODO: see above [ 'f', 'fadeInTime', 'As with fadeTime, but controls the fade in time of the grain envelope. Not used if the grain begins at position 0 in the sample.', ], ['f', 'freq', ''], - [ - 'f', - 'gain', - 'a pattern of numbers that specify volume. Values less than 1 make the sound quieter. Values greater than 1 make the sound louder. For the linear equivalent, see @amp@.', - ], ['f', 'gate', ''], // ['f', 'hatgrain', ''], [ @@ -333,11 +377,6 @@ const generic_params = [ // ['f', 'pitch3', ''], // ['f', 'portamento', ''], ['f', 'rate', "used in SuperDirt softsynths as a control rate or 'speed'"], - [ - 'f', - 'release', - 'a pattern of numbers to specify the release time (in seconds) of an envelope applied to each sample.', - ], ['f', 'resonance', 'a pattern of numbers from 0 to 1. Specifies the resonance of the low-pass filter.'], ['f', 'room', 'a pattern of numbers from 0 to 1. Sets the level of reverb.'], // ['f', 'sagogo', ''], @@ -364,7 +403,6 @@ const generic_params = [ ['f', 'squiz', ''], ['f', 'stutterdepth', ''], ['f', 'stuttertime', ''], - ['f', 'sustain', ''], ['f', 'timescale', ''], ['f', 'timescalewin', ''], // ['f', 'tomdecay', ''], From 4be798d15a1e1e70ba24c3926135dbb208cc0f38 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Sun, 22 May 2022 15:59:56 +0200 Subject: [PATCH 13/26] more doc --- doc.json | 362 ++++++++++++++++++++++++++++++------- packages/core/controls.mjs | 106 +++++++++-- 2 files changed, 383 insertions(+), 85 deletions(-) diff --git a/doc.json b/doc.json index 5040d048..cdca7f9b 100644 --- a/doc.json +++ b/doc.json @@ -164,7 +164,7 @@ "comment": "/**\n * Sets the center frequency of the band-pass filter.\n *\n * @name bandf\n * @param {number | Pattern} frequency center frequency\n * @example\n * s(\"bd sd\").bandf(\"<1000 2000 4000 8000>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 92, + "lineno": 97, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -196,7 +196,7 @@ "comment": "/**\n * Sets the q-factor of the band-pass filter\n *\n * @name bandq\n * @param {number | Pattern} q q factor\n * @example\n * s(\"bd sd\").bandf(\"<1000 2000 4000 8000>\").bandq(\"<.2 .9>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 103, + "lineno": 108, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -228,7 +228,7 @@ "comment": "/**\n * a pattern of numbers from 0 to 1. Skips the beginning of each sample, e.g. `0.25` to cut off the first quarter from each sample.\n *\n * @name begin\n * @param {number | Pattern} amount between 0 and 1, where 1 is the length of the sample\n * @example\n * s(\"rave\").begin(\"<0 .25 .5 .75>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 113, + "lineno": 118, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -260,7 +260,7 @@ "comment": "/**\n * The same as {@link begin}, but cuts off the end off each sample.\n *\n * @name end\n * @param {number | Pattern} length 1 = whole sample, .5 = half sample, .25 = quarter sample etc..\n * @example\n * s(\"bd*2,ho*4\").end(\"<.1 .2 .5 1>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 127, + "lineno": 132, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -292,7 +292,7 @@ "comment": "/**\n * a pattern of numbers from 0 to 1. Skips the beginning of each sample, e.g. `0.25` to cut off the first quarter from each sample.\n *\n * @name legato\n * @param {number | Pattern} duration between 0 and 1, where 1 is the length of the whole hap time\n * @example\n * \"c4 eb4 g4 bb4\".legato(\"<0.125 .25 .5 .75 1 2 4>\")\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 142, + "lineno": 147, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -324,7 +324,7 @@ "comment": "/**\n * bit crusher effect.\n *\n * @name crush\n * @param {number | Pattern} depth between 1 (for drastic reduction in bit-depth) to 16 (for barely no reduction).\n * @example\n * s(\",hh*3,jvbass*2\").fast(2).crush(\"<16 8 7 6 5 4 3 2>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 153, + "lineno": 158, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -356,7 +356,7 @@ "comment": "/**\n * fake-resampling for lowering the sample rate\n *\n * @name coarse\n * @param {number | Pattern} factor 1 for original 2 for half, 3 for a third and so on.\n * @example\n * s(\"xmas\").coarse(\"<1 4 8 16 32>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 167, + "lineno": 172, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -388,7 +388,7 @@ "comment": "/**\n * choose the channel the pattern is sent to in superdirt\n *\n * @name channel\n * @param {number | Pattern} channel channel number\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 182, + "lineno": 187, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -417,7 +417,7 @@ "comment": "/**\n * In the style of classic drum-machines, `cut` will stop a playing sample as soon as another samples with in same cutgroup is to be played. An example would be an open hi-hat followed by a closed one, essentially muting the open.\n *\n * @name cut\n * @param {number | Pattern} group cut group number\n * @example\n * s(\"bd sax\").cut(1).osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 190, + "lineno": 195, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -449,7 +449,7 @@ "comment": "/**\n * Applies the cutoff frequency of the low-pass filter.\n *\n * @name cutoff\n * @param {number | Pattern} frequency audible between 0 and 20000\n * @example\n * s(\"bd,hh*2,<~ sd>\").fast(2).cutoff(\"<4000 2000 1000 500 200 100>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 204, + "lineno": 209, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -477,11 +477,107 @@ "___id": "T000002R000018", "___s": true }, + { + "comment": "/**\n * Applies the cutoff frequency of the high-pass filter.\n *\n * @name hcutoff\n * @param {number | Pattern} frequency audible between 0 and 20000\n * @example\n * s(\"bd,hh*2,<~ sd>\").fast(2).hcutoff(\"<4000 2000 1000 500 200 100>\").osc()\n *\n */", + "meta": { + "filename": "controls.mjs", + "lineno": 220, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": {} + }, + "description": "

      Applies the cutoff frequency of the high-pass filter.

      ", + "name": "hcutoff", + "params": [ + { + "type": { + "names": [ + "number", + "Pattern" + ] + }, + "description": "

      audible between 0 and 20000

      ", + "name": "frequency" + } + ], + "examples": [ + "s(\"bd,hh*2,<~ sd>\").fast(2).hcutoff(\"<4000 2000 1000 500 200 100>\").osc()" + ], + "longname": "hcutoff", + "kind": "member", + "scope": "global", + "___id": "T000002R000019", + "___s": true + }, + { + "comment": "/**\n * Applies the cutoff frequency of the high-pass filter.\n *\n * @name hresonance\n * @param {number | Pattern} q resonance factor between 0 and 1\n * @example\n * s(\"bd,hh*2,<~ sd>\").fast(2).hcutoff(2000).hresonance(\"<0 .2 .4 .6>\").osc()\n *\n */", + "meta": { + "filename": "controls.mjs", + "lineno": 235, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": {} + }, + "description": "

      Applies the cutoff frequency of the high-pass filter.

      ", + "name": "hresonance", + "params": [ + { + "type": { + "names": [ + "number", + "Pattern" + ] + }, + "description": "

      resonance factor between 0 and 1

      ", + "name": "q" + } + ], + "examples": [ + "s(\"bd,hh*2,<~ sd>\").fast(2).hcutoff(2000).hresonance(\"<0 .2 .4 .6>\").osc()" + ], + "longname": "hresonance", + "kind": "member", + "scope": "global", + "___id": "T000002R000020", + "___s": true + }, + { + "comment": "/**\n * Applies the cutoff frequency of the low-pass filter.\n *\n * @name resonance\n * @param {number | Pattern} q resonance factor between 0 and 1\n * @example\n * s(\"bd,hh*2,<~ sd>\").fast(2).cutoff(2000).resonance(\"<0 .2 .4 .6>\").osc()\n *\n */", + "meta": { + "filename": "controls.mjs", + "lineno": 250, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": {} + }, + "description": "

      Applies the cutoff frequency of the low-pass filter.

      ", + "name": "resonance", + "params": [ + { + "type": { + "names": [ + "number", + "Pattern" + ] + }, + "description": "

      resonance factor between 0 and 1

      ", + "name": "q" + } + ], + "examples": [ + "s(\"bd,hh*2,<~ sd>\").fast(2).cutoff(2000).resonance(\"<0 .2 .4 .6>\").osc()" + ], + "longname": "resonance", + "kind": "member", + "scope": "global", + "___id": "T000002R000021", + "___s": true + }, { "comment": "/**\n * Set detune of oscillators. Works only with some synths, see tidal doc\n *\n * @name djf\n * @param {number | Pattern} cutoff below 0.5 is low pass filter, above is high pass filter\n * @example\n * n(\"0 3 7 [10,24]\").s('superzow').octave(3).djf(\"<.5 .25 .5 .75>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 214, + "lineno": 261, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -506,14 +602,14 @@ "longname": "djf", "kind": "member", "scope": "global", - "___id": "T000002R000019", + "___id": "T000002R000022", "___s": true }, { "comment": "/**\n * Set detune of oscillators. Works only with some synths, see tidal doc\n *\n * @name detune\n * @param {number | Pattern} amount between 0 and 1\n * @example\n * n(\"0 3 7\").s('superzow').octave(3).detune(\"<0 .25 .5 1 2>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 238, + "lineno": 285, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -538,14 +634,14 @@ "longname": "detune", "kind": "member", "scope": "global", - "___id": "T000002R000020", + "___id": "T000002R000023", "___s": true }, { "comment": "/**\n * Set dryness of reverb. See {@link room} and {@link size} for more information about reverb.\n *\n * @name dry\n * @param {number | Pattern} dry 0 = wet, 1 = dry\n * @example\n * n(\"[0,3,7](3,8)\").s(\"superpiano\").room(.7).dry(\"<0 .5 .75 1>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 248, + "lineno": 295, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -570,7 +666,135 @@ "longname": "dry", "kind": "member", "scope": "global", - "___id": "T000002R000021", + "___id": "T000002R000024", + "___s": true + }, + { + "comment": "/**\n * Set frequency of sound.\n *\n * @name freq\n * @param {number | Pattern} frequency in Hz. the audible range is between 20 and 20000 Hz\n * @example\n * freq(\"220 110 440 110\").s(\"superzow\").osc()\n * @example\n * freq(\"110\".mulOut(\".5 1.5 .6 [2 3]\")).s(\"superzow\").osc()\n *\n */", + "meta": { + "filename": "controls.mjs", + "lineno": 330, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": {} + }, + "description": "

      Set frequency of sound.

      ", + "name": "freq", + "params": [ + { + "type": { + "names": [ + "number", + "Pattern" + ] + }, + "description": "

      in Hz. the audible range is between 20 and 20000 Hz

      ", + "name": "frequency" + } + ], + "examples": [ + "freq(\"220 110 440 110\").s(\"superzow\").osc()", + "freq(\"110\".mulOut(\".5 1.5 .6 [2 3]\")).s(\"superzow\").osc()" + ], + "longname": "freq", + "kind": "member", + "scope": "global", + "___id": "T000002R000025", + "___s": true + }, + { + "comment": "/**\n * Emulation of a Leslie speaker: speakers rotating in a wooden amplified cabinet.\n *\n * @name leslie\n * @param {number | Pattern} dry between 0 and 1\n * @example\n * n(\"0,4,7\").s(\"supersquare\").leslie(\"<0 .4 .6 1>\").osc()\n *\n */", + "meta": { + "filename": "controls.mjs", + "lineno": 353, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": {} + }, + "description": "

      Emulation of a Leslie speaker: speakers rotating in a wooden amplified cabinet.

      ", + "name": "leslie", + "params": [ + { + "type": { + "names": [ + "number", + "Pattern" + ] + }, + "description": "

      between 0 and 1

      ", + "name": "dry" + } + ], + "examples": [ + "n(\"0,4,7\").s(\"supersquare\").leslie(\"<0 .4 .6 1>\").osc()" + ], + "longname": "leslie", + "kind": "member", + "scope": "global", + "___id": "T000002R000026", + "___s": true + }, + { + "comment": "/**\n * Rate of modulation / rotation for leslie effect\n *\n * @name lrate\n * @param {number | Pattern} rate 6.7 for fast, 0.7 for slow\n * @example\n * n(\"0,4,7\").s(\"supersquare\").leslie(1).lrate(\"<1 2 4 8>\").osc()\n *\n */", + "meta": { + "filename": "controls.mjs", + "lineno": 363, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": {} + }, + "description": "

      Rate of modulation / rotation for leslie effect

      ", + "name": "lrate", + "params": [ + { + "type": { + "names": [ + "number", + "Pattern" + ] + }, + "description": "

      6.7 for fast, 0.7 for slow

      ", + "name": "rate" + } + ], + "examples": [ + "n(\"0,4,7\").s(\"supersquare\").leslie(1).lrate(\"<1 2 4 8>\").osc()" + ], + "longname": "lrate", + "kind": "member", + "scope": "global", + "___id": "T000002R000027", + "___s": true + }, + { + "comment": "/**\n * Physical size of the cabinet in meters. Be careful, it might be slightly larger than your computer. Affects the Doppler amount (pitch warble)\n *\n * @name lsize\n * @param {number | Pattern} meters \n * @example\n * n(\"0,4,7\").s(\"supersquare\").leslie(1).lrate(2).lsize(\"<.1 .5 1>\").osc()\n *\n */", + "meta": { + "filename": "controls.mjs", + "lineno": 374, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": {} + }, + "description": "

      Physical size of the cabinet in meters. Be careful, it might be slightly larger than your computer. Affects the Doppler amount (pitch warble)

      ", + "name": "lsize", + "params": [ + { + "type": { + "names": [ + "number", + "Pattern" + ] + }, + "name": "meters" + } + ], + "examples": [ + "n(\"0,4,7\").s(\"supersquare\").leslie(1).lrate(2).lsize(\"<.1 .5 1>\").osc()" + ], + "longname": "lsize", + "kind": "member", + "scope": "global", + "___id": "T000002R000028", "___s": true }, { @@ -642,7 +866,7 @@ "longname": "drawLine", "kind": "function", "scope": "global", - "___id": "T000002R000028", + "___id": "T000002R000035", "___s": true }, { @@ -731,7 +955,7 @@ "longname": "Pattern#euclid", "kind": "function", "scope": "instance", - "___id": "T000002R000052", + "___id": "T000002R000059", "___s": true }, { @@ -768,7 +992,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000053", + "___id": "T000002R000060", "___s": true }, { @@ -806,7 +1030,7 @@ "name": "query" } ], - "___id": "T000002R000513", + "___id": "T000002R000520", "___s": true }, { @@ -869,7 +1093,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000515", + "___id": "T000002R000522", "___s": true }, { @@ -905,7 +1129,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000516", + "___id": "T000002R000523", "___s": true }, { @@ -953,7 +1177,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000519", + "___id": "T000002R000526", "___s": true }, { @@ -1001,7 +1225,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000520", + "___id": "T000002R000527", "___s": true }, { @@ -1048,7 +1272,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000521", + "___id": "T000002R000528", "___s": true }, { @@ -1096,7 +1320,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000522", + "___id": "T000002R000529", "___s": true }, { @@ -1143,7 +1367,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000523", + "___id": "T000002R000530", "___s": true }, { @@ -1190,7 +1414,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000524", + "___id": "T000002R000531", "___s": true }, { @@ -1237,7 +1461,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000525", + "___id": "T000002R000532", "___s": true }, { @@ -1284,7 +1508,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000526", + "___id": "T000002R000533", "___s": true }, { @@ -1320,7 +1544,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000527", + "___id": "T000002R000534", "___s": true }, { @@ -1376,7 +1600,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000528", + "___id": "T000002R000535", "___s": true }, { @@ -1423,7 +1647,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000562", + "___id": "T000002R000569", "___s": true }, { @@ -1456,7 +1680,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000563", + "___id": "T000002R000570", "___s": true }, { @@ -1504,7 +1728,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000564", + "___id": "T000002R000571", "___s": true }, { @@ -1551,7 +1775,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000565", + "___id": "T000002R000572", "___s": true }, { @@ -1587,7 +1811,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000566", + "___id": "T000002R000573", "___s": true }, { @@ -1623,7 +1847,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000567", + "___id": "T000002R000574", "___s": true }, { @@ -1659,7 +1883,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000568", + "___id": "T000002R000575", "___s": true }, { @@ -1706,7 +1930,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000576", + "___id": "T000002R000583", "___s": true }, { @@ -1753,7 +1977,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000578", + "___id": "T000002R000585", "___s": true }, { @@ -1800,7 +2024,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000590", + "___id": "T000002R000597", "___s": true }, { @@ -1849,7 +2073,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000602", + "___id": "T000002R000609", "___s": true }, { @@ -1880,7 +2104,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000605", + "___id": "T000002R000612", "___s": true }, { @@ -1911,7 +2135,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000606", + "___id": "T000002R000613", "___s": true }, { @@ -1947,7 +2171,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000607", + "___id": "T000002R000614", "___s": true }, { @@ -1983,7 +2207,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000626", + "___id": "T000002R000633", "___s": true }, { @@ -2019,7 +2243,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000627", + "___id": "T000002R000634", "___s": true }, { @@ -2055,7 +2279,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000628", + "___id": "T000002R000635", "___s": true }, { @@ -2091,7 +2315,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000629", + "___id": "T000002R000636", "___s": true }, { @@ -2127,7 +2351,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000630", + "___id": "T000002R000637", "___s": true }, { @@ -2183,7 +2407,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000631", + "___id": "T000002R000638", "___s": true }, { @@ -2239,7 +2463,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000632", + "___id": "T000002R000639", "___s": true }, { @@ -2295,7 +2519,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000633", + "___id": "T000002R000640", "___s": true }, { @@ -2331,7 +2555,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000730", + "___id": "T000002R000737", "___s": true }, { @@ -2382,7 +2606,7 @@ "longname": "pure", "kind": "function", "scope": "global", - "___id": "T000002R000848", + "___id": "T000002R000855", "___s": true }, { @@ -2434,7 +2658,7 @@ "longname": "stack", "kind": "function", "scope": "global", - "___id": "T000002R000855", + "___id": "T000002R000862", "___s": true }, { @@ -2486,7 +2710,7 @@ "longname": "slowcat", "kind": "function", "scope": "global", - "___id": "T000002R000859", + "___id": "T000002R000866", "___s": true }, { @@ -2535,7 +2759,7 @@ "longname": "slowcatPrime", "kind": "function", "scope": "global", - "___id": "T000002R000867", + "___id": "T000002R000874", "___s": true }, { @@ -2587,7 +2811,7 @@ "longname": "fastcat", "kind": "function", "scope": "global", - "___id": "T000002R000873", + "___id": "T000002R000880", "___s": true }, { @@ -2615,7 +2839,7 @@ "longname": "cat", "kind": "function", "scope": "global", - "___id": "T000002R000875", + "___id": "T000002R000882", "___s": true }, { @@ -2667,7 +2891,7 @@ "longname": "timeCat", "kind": "function", "scope": "global", - "___id": "T000002R000877", + "___id": "T000002R000884", "___s": true }, { @@ -2695,7 +2919,7 @@ "longname": "sequence", "kind": "function", "scope": "global", - "___id": "T000002R000884", + "___id": "T000002R000891", "___s": true }, { @@ -2723,7 +2947,7 @@ "longname": "seq", "kind": "function", "scope": "global", - "___id": "T000002R000886", + "___id": "T000002R000893", "___s": true }, { @@ -2762,7 +2986,7 @@ "scope": "static", "longname": "Pattern.transpose", "kind": "member", - "___id": "T000002R003695", + "___id": "T000002R003702", "___s": true }, { @@ -2799,7 +3023,7 @@ "scope": "static", "longname": "Pattern.scaleTranspose", "kind": "member", - "___id": "T000002R003699", + "___id": "T000002R003706", "___s": true }, { @@ -2836,7 +3060,7 @@ "scope": "static", "longname": "Pattern.scale", "kind": "member", - "___id": "T000002R003701", + "___id": "T000002R003708", "___s": true }, { @@ -2873,7 +3097,7 @@ "scope": "static", "longname": "Pattern.voicings", "kind": "member", - "___id": "T000002R003726", + "___id": "T000002R003733", "___s": true }, { @@ -2955,7 +3179,7 @@ "/home/felix/projects/strudel/packages/xen/tunejs.js", "/home/felix/projects/strudel/packages/xen/xen.mjs" ], - "___id": "T000002R013995", + "___id": "T000002R014002", "___s": true } ] diff --git a/packages/core/controls.mjs b/packages/core/controls.mjs index f3a1458b..20d58150 100644 --- a/packages/core/controls.mjs +++ b/packages/core/controls.mjs @@ -88,6 +88,11 @@ const generic_params = [ 'release', 'a pattern of numbers to specify the release time (in seconds) of an envelope applied to each sample.', ], + [ + 'f', + 'hold', + 'a pattern of numbers to specify the hold time (in seconds) of an envelope applied to each sample. Only takes effect if `attack` and `release` are also specified.', + ], // TODO: in tidal, it seems to be normalized /** * Sets the center frequency of the band-pass filter. @@ -210,7 +215,49 @@ const generic_params = [ * s("bd,hh*2,<~ sd>").fast(2).cutoff("<4000 2000 1000 500 200 100>").osc() * */ + // TODO: add lpf synonym ['f', 'cutoff', 'a pattern of numbers from 0 to 1. Applies the cutoff frequency of the low-pass filter.'], + /** + * Applies the cutoff frequency of the high-pass filter. + * + * @name hcutoff + * @param {number | Pattern} frequency audible between 0 and 20000 + * @example + * s("bd,hh*2,<~ sd>").fast(2).hcutoff("<4000 2000 1000 500 200 100>").osc() + * + */ + // TODO: add hpf synonym + [ + 'f', + 'hcutoff', + 'a pattern of numbers from 0 to 1. Applies the cutoff frequency of the high-pass filter. Also has alias @hpf@', + ], + /** + * Applies the cutoff frequency of the high-pass filter. + * + * @name hresonance + * @param {number | Pattern} q resonance factor between 0 and 1 + * @example + * s("bd,hh*2,<~ sd>").fast(2).hcutoff(2000).hresonance("<0 .2 .4 .6>").osc() + * + */ + [ + 'f', + 'hresonance', + 'a pattern of numbers from 0 to 1. Applies the resonance of the high-pass filter. Has alias @hpq@', + ], + // TODO: add hpq synonym + /** + * Applies the cutoff frequency of the low-pass filter. + * + * @name resonance + * @param {number | Pattern} q resonance factor between 0 and 1 + * @example + * s("bd,hh*2,<~ sd>").fast(2).cutoff(2000).resonance("<0 .2 .4 .6>").osc() + * + */ + ['f', 'resonance', 'a pattern of numbers from 0 to 1. Specifies the resonance of the low-pass filter.'], + // TODO: add lpq synonym? /** * Set detune of oscillators. Works only with some synths, see tidal doc * @@ -280,31 +327,59 @@ const generic_params = [ 'fadeInTime', 'As with fadeTime, but controls the fade in time of the grain envelope. Not used if the grain begins at position 0 in the sample.', ], + /** + * Set frequency of sound. + * + * @name freq + * @param {number | Pattern} frequency in Hz. the audible range is between 20 and 20000 Hz + * @example + * freq("220 110 440 110").s("superzow").osc() + * @example + * freq("110".mulOut(".5 1.5 .6 [2 3]")).s("superzow").osc() + * + */ ['f', 'freq', ''], + // TODO: https://tidalcycles.org/docs/configuration/MIDIOSC/control-voltage/#gate ['f', 'gate', ''], // ['f', 'hatgrain', ''], - [ - 'f', - 'hcutoff', - 'a pattern of numbers from 0 to 1. Applies the cutoff frequency of the high-pass filter. Also has alias @hpf@', - ], - [ - 'f', - 'hold', - 'a pattern of numbers to specify the hold time (in seconds) of an envelope applied to each sample. Only takes effect if `attack` and `release` are also specified.', - ], - [ - 'f', - 'hresonance', - 'a pattern of numbers from 0 to 1. Applies the resonance of the high-pass filter. Has alias @hpq@', - ], // ['f', 'lagogo', ''], // ['f', 'lclap', ''], // ['f', 'lclaves', ''], // ['f', 'lclhat', ''], // ['f', 'lcrash', ''], + // TODO: + // https://tidalcycles.org/docs/reference/audio_effects/#leslie-1 + // https://tidalcycles.org/docs/reference/audio_effects/#leslie + /** + * Emulation of a Leslie speaker: speakers rotating in a wooden amplified cabinet. + * + * @name leslie + * @param {number | Pattern} dry between 0 and 1 + * @example + * n("0,4,7").s("supersquare").leslie("<0 .4 .6 1>").osc() + * + */ ['f', 'leslie', ''], + /** + * Rate of modulation / rotation for leslie effect + * + * @name lrate + * @param {number | Pattern} rate 6.7 for fast, 0.7 for slow + * @example + * n("0,4,7").s("supersquare").leslie(1).lrate("<1 2 4 8>").osc() + * + */ + // TODO: the rate seems to "lag" (in the example, 1 will be fast) ['f', 'lrate', ''], + /** + * Physical size of the cabinet in meters. Be careful, it might be slightly larger than your computer. Affects the Doppler amount (pitch warble) + * + * @name lsize + * @param {number | Pattern} meters somewhere between 0 and 1 + * @example + * n("0,4,7").s("supersquare").leslie(1).lrate(2).lsize("<.1 .5 1>").osc() + * + */ ['f', 'lsize', ''], // ['f', 'lfo', ''], // ['f', 'lfocutoffint', ''], @@ -377,7 +452,6 @@ const generic_params = [ // ['f', 'pitch3', ''], // ['f', 'portamento', ''], ['f', 'rate', "used in SuperDirt softsynths as a control rate or 'speed'"], - ['f', 'resonance', 'a pattern of numbers from 0 to 1. Specifies the resonance of the low-pass filter.'], ['f', 'room', 'a pattern of numbers from 0 to 1. Sets the level of reverb.'], // ['f', 'sagogo', ''], // ['f', 'sclap', ''], From b2743108f11876f716e5a0dc49dd22db38afc4fd Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Sun, 22 May 2022 16:01:17 +0200 Subject: [PATCH 14/26] dont render attack yet --- packages/core/controls.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/controls.mjs b/packages/core/controls.mjs index 20d58150..ca7ab4d2 100644 --- a/packages/core/controls.mjs +++ b/packages/core/controls.mjs @@ -57,7 +57,7 @@ const generic_params = [ */ ['f', 'amp', 'like @gain@, but linear.'], // TODO: find out why 0 does not work, and it generally seems not right - /** + /* * A pattern of numbers to specify the attack time of an envelope applied to each sample. * * @name attack From 8646410e6f653105bf2205f06a79407aeba71491 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Sun, 22 May 2022 16:23:51 +0200 Subject: [PATCH 15/26] add n + todos --- doc.json | 120 +++++++++++++++++++------------------ packages/core/controls.mjs | 25 +++++++- 2 files changed, 84 insertions(+), 61 deletions(-) diff --git a/doc.json b/doc.json index cdca7f9b..a30a1a6f 100644 --- a/doc.json +++ b/doc.json @@ -32,11 +32,46 @@ "___id": "T000002R000004", "___s": true }, + { + "comment": "/**\n * The note or sample number to choose for a synth or sampleset\n * @name n \n * @param {string | number | Pattern} value note name, note number or sample number\n * @example\n * s('superpiano').n(\"<0 1 2 3>\").osc()\n * @example\n * s('superpiano').n(\"\").osc()\n * @example\n * n(\"0 1 2 3\").s('east').osc()\n */", + "meta": { + "filename": "controls.mjs", + "lineno": 22, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": {} + }, + "description": "

      The note or sample number to choose for a synth or sampleset

      ", + "name": "n", + "params": [ + { + "type": { + "names": [ + "string", + "number", + "Pattern" + ] + }, + "description": "

      note name, note number or sample number

      ", + "name": "value" + } + ], + "examples": [ + "s('superpiano').n(\"<0 1 2 3>\").osc()", + "s('superpiano').n(\"\").osc()", + "n(\"0 1 2 3\").s('east').osc()" + ], + "longname": "n", + "kind": "member", + "scope": "global", + "___id": "T000002R000005", + "___s": true + }, { "comment": "/**\n * A pattern of numbers that speed up (or slow down) samples while they play. Currently only supported by osc / superdirt.\n *\n * @name accelerate\n * @param {number | Pattern} amount acceleration.\n * @example\n * s(\"sax\").accelerate(\"<0 1 2 4 8 16>\").slow(2).osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 25, + "lineno": 40, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -61,14 +96,14 @@ "longname": "accelerate", "kind": "member", "scope": "global", - "___id": "T000002R000005", + "___id": "T000002R000006", "___s": true }, { "comment": "/**\n * Like {@link amp}, but exponential.\n *\n * @name gain\n * @param {number | Pattern} amount gain.\n * @example\n * s(\"bd*8\").gain(\".7*2 1 .7*2 1 .7 1\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 35, + "lineno": 50, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -93,14 +128,14 @@ "longname": "gain", "kind": "member", "scope": "global", - "___id": "T000002R000006", + "___id": "T000002R000007", "___s": true }, { "comment": "/**\n * Like {@link gain}, but linear.\n *\n * @name amp\n * @param {number | Pattern} amount gain.\n * @example\n * s(\"bd*8\").amp(\".1*2 .5 .1*2 .5 .1 .5\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 49, + "lineno": 64, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -125,38 +160,6 @@ "longname": "amp", "kind": "member", "scope": "global", - "___id": "T000002R000007", - "___s": true - }, - { - "comment": "/**\n * A pattern of numbers to specify the attack time of an envelope applied to each sample.\n *\n * @name attack\n * @param {number | Pattern} attack time in seconds.\n * @example\n * n(\"c5 e5\").s('superpiano').attack(\"<0 .1>\").osc()\n *\n */", - "meta": { - "filename": "controls.mjs", - "lineno": 60, - "columnno": 2, - "path": "/home/felix/projects/strudel/packages/core", - "code": {} - }, - "description": "

      A pattern of numbers to specify the attack time of an envelope applied to each sample.

      ", - "name": "attack", - "params": [ - { - "type": { - "names": [ - "number", - "Pattern" - ] - }, - "description": "

      time in seconds.

      ", - "name": "attack" - } - ], - "examples": [ - "n(\"c5 e5\").s('superpiano').attack(\"<0 .1>\").osc()" - ], - "longname": "attack", - "kind": "member", - "scope": "global", "___id": "T000002R000008", "___s": true }, @@ -164,7 +167,7 @@ "comment": "/**\n * Sets the center frequency of the band-pass filter.\n *\n * @name bandf\n * @param {number | Pattern} frequency center frequency\n * @example\n * s(\"bd sd\").bandf(\"<1000 2000 4000 8000>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 97, + "lineno": 112, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -196,7 +199,7 @@ "comment": "/**\n * Sets the q-factor of the band-pass filter\n *\n * @name bandq\n * @param {number | Pattern} q q factor\n * @example\n * s(\"bd sd\").bandf(\"<1000 2000 4000 8000>\").bandq(\"<.2 .9>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 108, + "lineno": 123, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -228,7 +231,7 @@ "comment": "/**\n * a pattern of numbers from 0 to 1. Skips the beginning of each sample, e.g. `0.25` to cut off the first quarter from each sample.\n *\n * @name begin\n * @param {number | Pattern} amount between 0 and 1, where 1 is the length of the sample\n * @example\n * s(\"rave\").begin(\"<0 .25 .5 .75>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 118, + "lineno": 133, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -260,7 +263,7 @@ "comment": "/**\n * The same as {@link begin}, but cuts off the end off each sample.\n *\n * @name end\n * @param {number | Pattern} length 1 = whole sample, .5 = half sample, .25 = quarter sample etc..\n * @example\n * s(\"bd*2,ho*4\").end(\"<.1 .2 .5 1>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 132, + "lineno": 147, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -292,7 +295,7 @@ "comment": "/**\n * a pattern of numbers from 0 to 1. Skips the beginning of each sample, e.g. `0.25` to cut off the first quarter from each sample.\n *\n * @name legato\n * @param {number | Pattern} duration between 0 and 1, where 1 is the length of the whole hap time\n * @example\n * \"c4 eb4 g4 bb4\".legato(\"<0.125 .25 .5 .75 1 2 4>\")\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 147, + "lineno": 162, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -324,7 +327,7 @@ "comment": "/**\n * bit crusher effect.\n *\n * @name crush\n * @param {number | Pattern} depth between 1 (for drastic reduction in bit-depth) to 16 (for barely no reduction).\n * @example\n * s(\",hh*3,jvbass*2\").fast(2).crush(\"<16 8 7 6 5 4 3 2>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 158, + "lineno": 173, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -356,7 +359,7 @@ "comment": "/**\n * fake-resampling for lowering the sample rate\n *\n * @name coarse\n * @param {number | Pattern} factor 1 for original 2 for half, 3 for a third and so on.\n * @example\n * s(\"xmas\").coarse(\"<1 4 8 16 32>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 172, + "lineno": 187, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -388,7 +391,7 @@ "comment": "/**\n * choose the channel the pattern is sent to in superdirt\n *\n * @name channel\n * @param {number | Pattern} channel channel number\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 187, + "lineno": 202, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -417,7 +420,7 @@ "comment": "/**\n * In the style of classic drum-machines, `cut` will stop a playing sample as soon as another samples with in same cutgroup is to be played. An example would be an open hi-hat followed by a closed one, essentially muting the open.\n *\n * @name cut\n * @param {number | Pattern} group cut group number\n * @example\n * s(\"bd sax\").cut(1).osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 195, + "lineno": 210, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -449,7 +452,7 @@ "comment": "/**\n * Applies the cutoff frequency of the low-pass filter.\n *\n * @name cutoff\n * @param {number | Pattern} frequency audible between 0 and 20000\n * @example\n * s(\"bd,hh*2,<~ sd>\").fast(2).cutoff(\"<4000 2000 1000 500 200 100>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 209, + "lineno": 224, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -481,7 +484,7 @@ "comment": "/**\n * Applies the cutoff frequency of the high-pass filter.\n *\n * @name hcutoff\n * @param {number | Pattern} frequency audible between 0 and 20000\n * @example\n * s(\"bd,hh*2,<~ sd>\").fast(2).hcutoff(\"<4000 2000 1000 500 200 100>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 220, + "lineno": 235, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -513,7 +516,7 @@ "comment": "/**\n * Applies the cutoff frequency of the high-pass filter.\n *\n * @name hresonance\n * @param {number | Pattern} q resonance factor between 0 and 1\n * @example\n * s(\"bd,hh*2,<~ sd>\").fast(2).hcutoff(2000).hresonance(\"<0 .2 .4 .6>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 235, + "lineno": 250, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -545,7 +548,7 @@ "comment": "/**\n * Applies the cutoff frequency of the low-pass filter.\n *\n * @name resonance\n * @param {number | Pattern} q resonance factor between 0 and 1\n * @example\n * s(\"bd,hh*2,<~ sd>\").fast(2).cutoff(2000).resonance(\"<0 .2 .4 .6>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 250, + "lineno": 265, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -577,7 +580,7 @@ "comment": "/**\n * Set detune of oscillators. Works only with some synths, see tidal doc\n *\n * @name djf\n * @param {number | Pattern} cutoff below 0.5 is low pass filter, above is high pass filter\n * @example\n * n(\"0 3 7 [10,24]\").s('superzow').octave(3).djf(\"<.5 .25 .5 .75>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 261, + "lineno": 276, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -609,7 +612,7 @@ "comment": "/**\n * Set detune of oscillators. Works only with some synths, see tidal doc\n *\n * @name detune\n * @param {number | Pattern} amount between 0 and 1\n * @example\n * n(\"0 3 7\").s('superzow').octave(3).detune(\"<0 .25 .5 1 2>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 285, + "lineno": 300, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -641,7 +644,7 @@ "comment": "/**\n * Set dryness of reverb. See {@link room} and {@link size} for more information about reverb.\n *\n * @name dry\n * @param {number | Pattern} dry 0 = wet, 1 = dry\n * @example\n * n(\"[0,3,7](3,8)\").s(\"superpiano\").room(.7).dry(\"<0 .5 .75 1>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 295, + "lineno": 310, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -673,7 +676,7 @@ "comment": "/**\n * Set frequency of sound.\n *\n * @name freq\n * @param {number | Pattern} frequency in Hz. the audible range is between 20 and 20000 Hz\n * @example\n * freq(\"220 110 440 110\").s(\"superzow\").osc()\n * @example\n * freq(\"110\".mulOut(\".5 1.5 .6 [2 3]\")).s(\"superzow\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 330, + "lineno": 345, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -706,7 +709,7 @@ "comment": "/**\n * Emulation of a Leslie speaker: speakers rotating in a wooden amplified cabinet.\n *\n * @name leslie\n * @param {number | Pattern} dry between 0 and 1\n * @example\n * n(\"0,4,7\").s(\"supersquare\").leslie(\"<0 .4 .6 1>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 353, + "lineno": 368, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -738,7 +741,7 @@ "comment": "/**\n * Rate of modulation / rotation for leslie effect\n *\n * @name lrate\n * @param {number | Pattern} rate 6.7 for fast, 0.7 for slow\n * @example\n * n(\"0,4,7\").s(\"supersquare\").leslie(1).lrate(\"<1 2 4 8>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 363, + "lineno": 378, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -767,10 +770,10 @@ "___s": true }, { - "comment": "/**\n * Physical size of the cabinet in meters. Be careful, it might be slightly larger than your computer. Affects the Doppler amount (pitch warble)\n *\n * @name lsize\n * @param {number | Pattern} meters \n * @example\n * n(\"0,4,7\").s(\"supersquare\").leslie(1).lrate(2).lsize(\"<.1 .5 1>\").osc()\n *\n */", + "comment": "/**\n * Physical size of the cabinet in meters. Be careful, it might be slightly larger than your computer. Affects the Doppler amount (pitch warble)\n *\n * @name lsize\n * @param {number | Pattern} meters somewhere between 0 and 1\n * @example\n * n(\"0,4,7\").s(\"supersquare\").leslie(1).lrate(2).lsize(\"<.1 .5 1>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 374, + "lineno": 389, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -785,6 +788,7 @@ "Pattern" ] }, + "description": "

      somewhere between 0 and 1

      ", "name": "meters" } ], diff --git a/packages/core/controls.mjs b/packages/core/controls.mjs index ca7ab4d2..30ddd203 100644 --- a/packages/core/controls.mjs +++ b/packages/core/controls.mjs @@ -9,7 +9,7 @@ import { Pattern, sequence } from './pattern.mjs'; const controls = {}; const generic_params = [ /** - * Select a sound / sample by name. Currently only supported by osc / superdirt. + * Select a sound / sample by name. * See default sounds here: https://tidalcycles.org/docs/configuration/Audio%20Samples/default_library * * @name s @@ -19,6 +19,27 @@ const generic_params = [ * */ ['s', 's', 'sound'], + /** + * The note or sample number to choose for a synth or sampleset + * Note names currently not working yet, but will hopefully soon. Just stick to numbers for now + * + * @name n + * @param {string | number | Pattern} value note name, note number or sample number + * @example + * s('superpiano').n("<0 1 2 3>").osc() + * @example + * s('superpiano').n("").osc() + * @example + * n("0 1 2 3").s('east').osc() + */ + // TODO: nOut does not work + // TODO: notes don't work as expected + // current "workaround" for notes: + // s('superpiano').n(""._asNumber()).osc() + // -> .n or .osc (or .superdirt) would need to convert note strings to numbers + // also see https://github.com/tidalcycles/strudel/pull/63 + ['f', 'n', 'The note or sample number to choose for a synth or sampleset'], + ['f', 'note', 'The note or pitch to play a sound or synth with'], //['s', 'toArg', 'for internal sound routing'], // ["f", "from", "for internal sound routing"), //['f', 'to', 'for internal sound routing'], @@ -399,8 +420,6 @@ const generic_params = [ ['f', 'loop', 'loops the sample (from `begin` to `end`) the specified number of times.'], // ['f', 'lophat', ''], // ['f', 'lsnare', ''], - ['f', 'n', 'The note or sample number to choose for a synth or sampleset'], - ['f', 'note', 'The note or pitch to play a sound or synth with'], ['f', 'degree', ''], ['f', 'mtranspose', ''], ['f', 'ctranspose', ''], From b0c6236c246392d17efc9630263b59c16cd942d9 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Sun, 22 May 2022 21:42:30 +0200 Subject: [PATCH 16/26] even more doc --- doc.json | 542 ++++++++++++++++++++++++++++++------- packages/core/controls.mjs | 212 ++++++++++++--- 2 files changed, 622 insertions(+), 132 deletions(-) diff --git a/doc.json b/doc.json index a30a1a6f..64952a2d 100644 --- a/doc.json +++ b/doc.json @@ -1,7 +1,7 @@ { "docs": [ { - "comment": "/**\n * Select a sound / sample by name. Currently only supported by osc / superdirt.\n * See default sounds here: https://tidalcycles.org/docs/configuration/Audio%20Samples/default_library\n *\n * @name s\n * @param {string | Pattern} sound The sound / pattern of sounds to pick\n * @example\n * s(\"bd hh\").osc()\n *\n */", + "comment": "/**\n * Select a sound / sample by name.\n * See default sounds here: https://tidalcycles.org/docs/configuration/Audio%20Samples/default_library\n *\n * @name s\n * @param {string | Pattern} sound The sound / pattern of sounds to pick\n * @example\n * s(\"bd hh\").osc()\n *\n */", "meta": { "filename": "controls.mjs", "lineno": 11, @@ -9,7 +9,7 @@ "path": "/home/felix/projects/strudel/packages/core", "code": {} }, - "description": "

      Select a sound / sample by name. Currently only supported by osc / superdirt.\nSee default sounds here: https://tidalcycles.org/docs/configuration/Audio%20Samples/default_library

      ", + "description": "

      Select a sound / sample by name.\nSee default sounds here: https://tidalcycles.org/docs/configuration/Audio%20Samples/default_library

      ", "name": "s", "params": [ { @@ -33,7 +33,7 @@ "___s": true }, { - "comment": "/**\n * The note or sample number to choose for a synth or sampleset\n * @name n \n * @param {string | number | Pattern} value note name, note number or sample number\n * @example\n * s('superpiano').n(\"<0 1 2 3>\").osc()\n * @example\n * s('superpiano').n(\"\").osc()\n * @example\n * n(\"0 1 2 3\").s('east').osc()\n */", + "comment": "/**\n * The note or sample number to choose for a synth or sampleset\n * Note names currently not working yet, but will hopefully soon. Just stick to numbers for now\n *\n * @name n\n * @param {string | number | Pattern} value note name, note number or sample number\n * @example\n * s('superpiano').n(\"<0 1 2 3>\").osc()\n * @example\n * s('superpiano').n(\"\").osc()\n * @example\n * n(\"0 1 2 3\").s('east').osc()\n */", "meta": { "filename": "controls.mjs", "lineno": 22, @@ -41,7 +41,7 @@ "path": "/home/felix/projects/strudel/packages/core", "code": {} }, - "description": "

      The note or sample number to choose for a synth or sampleset

      ", + "description": "

      The note or sample number to choose for a synth or sampleset\nNote names currently not working yet, but will hopefully soon. Just stick to numbers for now

      ", "name": "n", "params": [ { @@ -71,7 +71,7 @@ "comment": "/**\n * A pattern of numbers that speed up (or slow down) samples while they play. Currently only supported by osc / superdirt.\n *\n * @name accelerate\n * @param {number | Pattern} amount acceleration.\n * @example\n * s(\"sax\").accelerate(\"<0 1 2 4 8 16>\").slow(2).osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 40, + "lineno": 46, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -103,7 +103,7 @@ "comment": "/**\n * Like {@link amp}, but exponential.\n *\n * @name gain\n * @param {number | Pattern} amount gain.\n * @example\n * s(\"bd*8\").gain(\".7*2 1 .7*2 1 .7 1\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 50, + "lineno": 56, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -135,7 +135,7 @@ "comment": "/**\n * Like {@link gain}, but linear.\n *\n * @name amp\n * @param {number | Pattern} amount gain.\n * @example\n * s(\"bd*8\").amp(\".1*2 .5 .1*2 .5 .1 .5\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 64, + "lineno": 70, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -167,7 +167,7 @@ "comment": "/**\n * Sets the center frequency of the band-pass filter.\n *\n * @name bandf\n * @param {number | Pattern} frequency center frequency\n * @example\n * s(\"bd sd\").bandf(\"<1000 2000 4000 8000>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 112, + "lineno": 118, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -199,7 +199,7 @@ "comment": "/**\n * Sets the q-factor of the band-pass filter\n *\n * @name bandq\n * @param {number | Pattern} q q factor\n * @example\n * s(\"bd sd\").bandf(\"<1000 2000 4000 8000>\").bandq(\"<.2 .9>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 123, + "lineno": 129, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -231,7 +231,7 @@ "comment": "/**\n * a pattern of numbers from 0 to 1. Skips the beginning of each sample, e.g. `0.25` to cut off the first quarter from each sample.\n *\n * @name begin\n * @param {number | Pattern} amount between 0 and 1, where 1 is the length of the sample\n * @example\n * s(\"rave\").begin(\"<0 .25 .5 .75>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 133, + "lineno": 139, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -263,7 +263,7 @@ "comment": "/**\n * The same as {@link begin}, but cuts off the end off each sample.\n *\n * @name end\n * @param {number | Pattern} length 1 = whole sample, .5 = half sample, .25 = quarter sample etc..\n * @example\n * s(\"bd*2,ho*4\").end(\"<.1 .2 .5 1>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 147, + "lineno": 153, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -291,11 +291,43 @@ "___id": "T000002R000012", "___s": true }, + { + "comment": "/**\n * Loops the sample (from `begin` to `end`) the specified number of times.\n * Note that the tempo of the loop is not synced with the cycle tempo.\n *\n * @name loop\n * @param {number | Pattern} times How often the sample is looped\n * @example\n * s(\"bd\").loop(\"<1 2 3 4>\").osc()\n *\n */", + "meta": { + "filename": "controls.mjs", + "lineno": 167, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": {} + }, + "description": "

      Loops the sample (from begin to end) the specified number of times.\nNote that the tempo of the loop is not synced with the cycle tempo.

      ", + "name": "loop", + "params": [ + { + "type": { + "names": [ + "number", + "Pattern" + ] + }, + "description": "

      How often the sample is looped

      ", + "name": "times" + } + ], + "examples": [ + "s(\"bd\").loop(\"<1 2 3 4>\").osc()" + ], + "longname": "loop", + "kind": "member", + "scope": "global", + "___id": "T000002R000013", + "___s": true + }, { "comment": "/**\n * a pattern of numbers from 0 to 1. Skips the beginning of each sample, e.g. `0.25` to cut off the first quarter from each sample.\n *\n * @name legato\n * @param {number | Pattern} duration between 0 and 1, where 1 is the length of the whole hap time\n * @example\n * \"c4 eb4 g4 bb4\".legato(\"<0.125 .25 .5 .75 1 2 4>\")\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 162, + "lineno": 179, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -320,14 +352,14 @@ "longname": "legato", "kind": "member", "scope": "global", - "___id": "T000002R000013", + "___id": "T000002R000014", "___s": true }, { "comment": "/**\n * bit crusher effect.\n *\n * @name crush\n * @param {number | Pattern} depth between 1 (for drastic reduction in bit-depth) to 16 (for barely no reduction).\n * @example\n * s(\",hh*3,jvbass*2\").fast(2).crush(\"<16 8 7 6 5 4 3 2>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 173, + "lineno": 190, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -352,14 +384,14 @@ "longname": "crush", "kind": "member", "scope": "global", - "___id": "T000002R000014", + "___id": "T000002R000015", "___s": true }, { "comment": "/**\n * fake-resampling for lowering the sample rate\n *\n * @name coarse\n * @param {number | Pattern} factor 1 for original 2 for half, 3 for a third and so on.\n * @example\n * s(\"xmas\").coarse(\"<1 4 8 16 32>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 187, + "lineno": 204, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -384,14 +416,14 @@ "longname": "coarse", "kind": "member", "scope": "global", - "___id": "T000002R000015", + "___id": "T000002R000016", "___s": true }, { "comment": "/**\n * choose the channel the pattern is sent to in superdirt\n *\n * @name channel\n * @param {number | Pattern} channel channel number\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 202, + "lineno": 219, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -413,14 +445,14 @@ "longname": "channel", "kind": "member", "scope": "global", - "___id": "T000002R000016", + "___id": "T000002R000017", "___s": true }, { "comment": "/**\n * In the style of classic drum-machines, `cut` will stop a playing sample as soon as another samples with in same cutgroup is to be played. An example would be an open hi-hat followed by a closed one, essentially muting the open.\n *\n * @name cut\n * @param {number | Pattern} group cut group number\n * @example\n * s(\"bd sax\").cut(1).osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 210, + "lineno": 227, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -445,14 +477,14 @@ "longname": "cut", "kind": "member", "scope": "global", - "___id": "T000002R000017", + "___id": "T000002R000018", "___s": true }, { "comment": "/**\n * Applies the cutoff frequency of the low-pass filter.\n *\n * @name cutoff\n * @param {number | Pattern} frequency audible between 0 and 20000\n * @example\n * s(\"bd,hh*2,<~ sd>\").fast(2).cutoff(\"<4000 2000 1000 500 200 100>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 224, + "lineno": 241, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -477,14 +509,14 @@ "longname": "cutoff", "kind": "member", "scope": "global", - "___id": "T000002R000018", + "___id": "T000002R000019", "___s": true }, { "comment": "/**\n * Applies the cutoff frequency of the high-pass filter.\n *\n * @name hcutoff\n * @param {number | Pattern} frequency audible between 0 and 20000\n * @example\n * s(\"bd,hh*2,<~ sd>\").fast(2).hcutoff(\"<4000 2000 1000 500 200 100>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 235, + "lineno": 252, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -509,14 +541,14 @@ "longname": "hcutoff", "kind": "member", "scope": "global", - "___id": "T000002R000019", + "___id": "T000002R000020", "___s": true }, { "comment": "/**\n * Applies the cutoff frequency of the high-pass filter.\n *\n * @name hresonance\n * @param {number | Pattern} q resonance factor between 0 and 1\n * @example\n * s(\"bd,hh*2,<~ sd>\").fast(2).hcutoff(2000).hresonance(\"<0 .2 .4 .6>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 250, + "lineno": 267, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -541,14 +573,14 @@ "longname": "hresonance", "kind": "member", "scope": "global", - "___id": "T000002R000020", + "___id": "T000002R000021", "___s": true }, { "comment": "/**\n * Applies the cutoff frequency of the low-pass filter.\n *\n * @name resonance\n * @param {number | Pattern} q resonance factor between 0 and 1\n * @example\n * s(\"bd,hh*2,<~ sd>\").fast(2).cutoff(2000).resonance(\"<0 .2 .4 .6>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 265, + "lineno": 282, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -573,14 +605,14 @@ "longname": "resonance", "kind": "member", "scope": "global", - "___id": "T000002R000021", + "___id": "T000002R000022", "___s": true }, { "comment": "/**\n * Set detune of oscillators. Works only with some synths, see tidal doc\n *\n * @name djf\n * @param {number | Pattern} cutoff below 0.5 is low pass filter, above is high pass filter\n * @example\n * n(\"0 3 7 [10,24]\").s('superzow').octave(3).djf(\"<.5 .25 .5 .75>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 276, + "lineno": 293, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -605,14 +637,14 @@ "longname": "djf", "kind": "member", "scope": "global", - "___id": "T000002R000022", + "___id": "T000002R000023", "___s": true }, { "comment": "/**\n * Set detune of oscillators. Works only with some synths, see tidal doc\n *\n * @name detune\n * @param {number | Pattern} amount between 0 and 1\n * @example\n * n(\"0 3 7\").s('superzow').octave(3).detune(\"<0 .25 .5 1 2>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 300, + "lineno": 331, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -637,14 +669,14 @@ "longname": "detune", "kind": "member", "scope": "global", - "___id": "T000002R000023", + "___id": "T000002R000024", "___s": true }, { "comment": "/**\n * Set dryness of reverb. See {@link room} and {@link size} for more information about reverb.\n *\n * @name dry\n * @param {number | Pattern} dry 0 = wet, 1 = dry\n * @example\n * n(\"[0,3,7](3,8)\").s(\"superpiano\").room(.7).dry(\"<0 .5 .75 1>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 310, + "lineno": 341, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -669,14 +701,14 @@ "longname": "dry", "kind": "member", "scope": "global", - "___id": "T000002R000024", + "___id": "T000002R000025", "___s": true }, { "comment": "/**\n * Set frequency of sound.\n *\n * @name freq\n * @param {number | Pattern} frequency in Hz. the audible range is between 20 and 20000 Hz\n * @example\n * freq(\"220 110 440 110\").s(\"superzow\").osc()\n * @example\n * freq(\"110\".mulOut(\".5 1.5 .6 [2 3]\")).s(\"superzow\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 345, + "lineno": 376, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -702,14 +734,14 @@ "longname": "freq", "kind": "member", "scope": "global", - "___id": "T000002R000025", + "___id": "T000002R000026", "___s": true }, { "comment": "/**\n * Emulation of a Leslie speaker: speakers rotating in a wooden amplified cabinet.\n *\n * @name leslie\n * @param {number | Pattern} dry between 0 and 1\n * @example\n * n(\"0,4,7\").s(\"supersquare\").leslie(\"<0 .4 .6 1>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 368, + "lineno": 399, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -734,14 +766,14 @@ "longname": "leslie", "kind": "member", "scope": "global", - "___id": "T000002R000026", + "___id": "T000002R000027", "___s": true }, { "comment": "/**\n * Rate of modulation / rotation for leslie effect\n *\n * @name lrate\n * @param {number | Pattern} rate 6.7 for fast, 0.7 for slow\n * @example\n * n(\"0,4,7\").s(\"supersquare\").leslie(1).lrate(\"<1 2 4 8>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 378, + "lineno": 409, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -766,14 +798,14 @@ "longname": "lrate", "kind": "member", "scope": "global", - "___id": "T000002R000027", + "___id": "T000002R000028", "___s": true }, { "comment": "/**\n * Physical size of the cabinet in meters. Be careful, it might be slightly larger than your computer. Affects the Doppler amount (pitch warble)\n *\n * @name lsize\n * @param {number | Pattern} meters somewhere between 0 and 1\n * @example\n * n(\"0,4,7\").s(\"supersquare\").leslie(1).lrate(2).lsize(\"<.1 .5 1>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 389, + "lineno": 420, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -798,7 +830,325 @@ "longname": "lsize", "kind": "member", "scope": "global", - "___id": "T000002R000028", + "___id": "T000002R000029", + "___s": true + }, + { + "comment": "/**\n * Sets the default octave of a synth.\n *\n * @name octave\n * @param {number | Pattern} octave octave number\n * @example\n * n(\"0,4,7\").s('supersquare').octave(\"<3 4 5 6>\").osc()\n */", + "meta": { + "filename": "controls.mjs", + "lineno": 455, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": {} + }, + "description": "

      Sets the default octave of a synth.

      ", + "name": "octave", + "params": [ + { + "type": { + "names": [ + "number", + "Pattern" + ] + }, + "description": "

      octave number

      ", + "name": "octave" + } + ], + "examples": [ + "n(\"0,4,7\").s('supersquare').octave(\"<3 4 5 6>\").osc()" + ], + "longname": "octave", + "kind": "member", + "scope": "global", + "___id": "T000002R000030", + "___s": true + }, + { + "comment": "/**\n * a pattern of numbers. An `orbit` is a global parameter context for patterns. Patterns with the same orbit will share hardware output bus offset and global effects, e.g. reverb and delay. The maximum number of orbits is specified in the superdirt startup, numbers higher than maximum will wrap around.\n *\n * @name orbit\n * @param {number | Pattern} number\n *\n */", + "meta": { + "filename": "controls.mjs", + "lineno": 467, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": {} + }, + "description": "

      a pattern of numbers. An orbit is a global parameter context for patterns. Patterns with the same orbit will share hardware output bus offset and global effects, e.g. reverb and delay. The maximum number of orbits is specified in the superdirt startup, numbers higher than maximum will wrap around.

      ", + "name": "orbit", + "params": [ + { + "type": { + "names": [ + "number", + "Pattern" + ] + }, + "name": "number" + } + ], + "longname": "orbit", + "kind": "member", + "scope": "global", + "___id": "T000002R000031", + "___s": true + }, + { + "comment": "/**\n * Sets position in stereo.\n *\n * @name pan\n * @param {number | Pattern} pan between 0 and 1, from left to right (assuming stereo), once round a circle (assuming multichannel)\n * @example\n * s(\"[bd hh]*2\").pan(\"<.5 1 .5 0>\").osc()\n *\n */", + "meta": { + "filename": "controls.mjs", + "lineno": 481, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": {} + }, + "description": "

      Sets position in stereo.

      ", + "name": "pan", + "params": [ + { + "type": { + "names": [ + "number", + "Pattern" + ] + }, + "description": "

      between 0 and 1, from left to right (assuming stereo), once round a circle (assuming multichannel)

      ", + "name": "pan" + } + ], + "examples": [ + "s(\"[bd hh]*2\").pan(\"<.5 1 .5 0>\").osc()" + ], + "longname": "pan", + "kind": "member", + "scope": "global", + "___id": "T000002R000032", + "___s": true + }, + { + "comment": "/**\n * Sets the level of reverb.\n *\n * @name room\n * @param {number | Pattern} level between 0 and 1\n * @example\n * s(\"bd sd\").room(\"<0 .2 .4 .6 .8 1>\").osc()\n *\n */", + "meta": { + "filename": "controls.mjs", + "lineno": 548, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": {} + }, + "description": "

      Sets the level of reverb.

      ", + "name": "room", + "params": [ + { + "type": { + "names": [ + "number", + "Pattern" + ] + }, + "description": "

      between 0 and 1

      ", + "name": "level" + } + ], + "examples": [ + "s(\"bd sd\").room(\"<0 .2 .4 .6 .8 1>\").osc()" + ], + "longname": "room", + "kind": "member", + "scope": "global", + "___id": "T000002R000033", + "___s": true + }, + { + "comment": "/**\n * Sets the room size of the reverb, see {@link room}.\n *\n * @name size\n * @param {number | Pattern} size between 0 and 1\n * @example\n * s(\"bd sd\").room(.8).size(\"<0 .2 .4 .6 .8 1>\").osc()\n *\n */", + "meta": { + "filename": "controls.mjs", + "lineno": 558, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": {} + }, + "description": "

      Sets the room size of the reverb, see {@link room}.

      ", + "name": "size", + "params": [ + { + "type": { + "names": [ + "number", + "Pattern" + ] + }, + "description": "

      between 0 and 1

      ", + "name": "size" + } + ], + "examples": [ + "s(\"bd sd\").room(.8).size(\"<0 .2 .4 .6 .8 1>\").osc()" + ], + "longname": "size", + "kind": "member", + "scope": "global", + "___id": "T000002R000034", + "___s": true + }, + { + "comment": "/**\n * Wave shaping distortion. CAUTION: it might get loud\n *\n * @name shape\n * @param {number | Pattern} distortion between 0 and 1\n * @example\n * s(\"bd sd\").shape(\"<0 .2 .4 .6 .8 1>\").osc()\n *\n */", + "meta": { + "filename": "controls.mjs", + "lineno": 576, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": {} + }, + "description": "

      Wave shaping distortion. CAUTION: it might get loud

      ", + "name": "shape", + "params": [ + { + "type": { + "names": [ + "number", + "Pattern" + ] + }, + "description": "

      between 0 and 1

      ", + "name": "distortion" + } + ], + "examples": [ + "s(\"bd sd\").shape(\"<0 .2 .4 .6 .8 1>\").osc()" + ], + "longname": "shape", + "kind": "member", + "scope": "global", + "___id": "T000002R000035", + "___s": true + }, + { + "comment": "/**\n * Changes the speed of sample playback, i.e. a cheap way of changing pitch.\n *\n * @name speed\n * @param {number | Pattern} speed -inf to inf, negative numbers play the sample backwards.\n * @example\n * s(\"bd\").speed(\"<1 2 4 1 -2 -4>\").osc()\n * @example\n * speed(\"1 1.5*2 [2 1.1]\").s(\"sax\").cut(1).osc()\n *\n */", + "meta": { + "filename": "controls.mjs", + "lineno": 590, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": {} + }, + "description": "

      Changes the speed of sample playback, i.e. a cheap way of changing pitch.

      ", + "name": "speed", + "params": [ + { + "type": { + "names": [ + "number", + "Pattern" + ] + }, + "description": "

      inf to inf, negative numbers play the sample backwards.

      ", + "name": "speed" + } + ], + "examples": [ + "s(\"bd\").speed(\"<1 2 4 1 -2 -4>\").osc()", + "speed(\"1 1.5*2 [2 1.1]\").s(\"sax\").cut(1).osc()" + ], + "longname": "speed", + "kind": "member", + "scope": "global", + "___id": "T000002R000036", + "___s": true + }, + { + "comment": "/**\n * Used in conjunction with {@link speed}, accepts values of \"r\" (rate, default behavior), \"c\" (cycles), or \"s\" (seconds). Using `unit \"c\"` means `speed` will be interpreted in units of cycles, e.g. `speed \"1\"` means samples will be stretched to fill a cycle. Using `unit \"s\"` means the playback speed will be adjusted so that the duration is the number of seconds specified by `speed`.\n *\n * @name unit\n * @param {number | string | Pattern} unit see description above\n * @example\n * speed(\"1 2 .5 3\").s(\"bd\").unit(\"c\").osc()\n *\n */", + "meta": { + "filename": "controls.mjs", + "lineno": 606, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": {} + }, + "description": "

      Used in conjunction with {@link speed}, accepts values of "r" (rate, default behavior), "c" (cycles), or "s" (seconds). Using unit "c" means speed will be interpreted in units of cycles, e.g. speed "1" means samples will be stretched to fill a cycle. Using unit "s" means the playback speed will be adjusted so that the duration is the number of seconds specified by speed.

      ", + "name": "unit", + "params": [ + { + "type": { + "names": [ + "number", + "string", + "Pattern" + ] + }, + "description": "

      see description above

      ", + "name": "unit" + } + ], + "examples": [ + "speed(\"1 2 .5 3\").s(\"bd\").unit(\"c\").osc()" + ], + "longname": "unit", + "kind": "member", + "scope": "global", + "___id": "T000002R000037", + "___s": true + }, + { + "comment": "/**\n * Made by Calum Gunn. Reminiscent of some weird mixture of filter, ring-modulator and pitch-shifter. The SuperCollider manual defines Squiz as:\n *\n * \"A simplistic pitch-raising algorithm. It's not meant to sound natural; its sound is reminiscent of some weird mixture of filter, ring-modulator and pitch-shifter, depending on the input. The algorithm works by cutting the signal into fragments (delimited by upwards-going zero-crossings) and squeezing those fragments in the time domain (i.e. simply playing them back faster than they came in), leaving silences inbetween. All the parameters apart from memlen can be modulated.\"\n *\n * @name squiz\n * @param {number | Pattern} squiz Try passing multiples of 2 to it - 2, 4, 8 etc.\n * @example\n * squiz(\"2 4/2 6 [8 16]\").s(\"bd\").osc()\n *\n */", + "meta": { + "filename": "controls.mjs", + "lineno": 620, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": {} + }, + "description": "

      Made by Calum Gunn. Reminiscent of some weird mixture of filter, ring-modulator and pitch-shifter. The SuperCollider manual defines Squiz as:

      \n

      "A simplistic pitch-raising algorithm. It's not meant to sound natural; its sound is reminiscent of some weird mixture of filter, ring-modulator and pitch-shifter, depending on the input. The algorithm works by cutting the signal into fragments (delimited by upwards-going zero-crossings) and squeezing those fragments in the time domain (i.e. simply playing them back faster than they came in), leaving silences inbetween. All the parameters apart from memlen can be modulated."

      ", + "name": "squiz", + "params": [ + { + "type": { + "names": [ + "number", + "Pattern" + ] + }, + "description": "

      Try passing multiples of 2 to it - 2, 4, 8 etc.

      ", + "name": "squiz" + } + ], + "examples": [ + "squiz(\"2 4/2 6 [8 16]\").s(\"bd\").osc()" + ], + "longname": "squiz", + "kind": "member", + "scope": "global", + "___id": "T000002R000038", + "___s": true + }, + { + "comment": "/**\n * \n * Formant filter to make things sound like vowels.\n * \n * @name vowel\n * @param {string | Pattern} vowel You can use a e i o u. Use a rest (~) to override the effect\n * @example\n * vowel(\"a e i [o u]\").slow(2)\n * .n(\"<[0,7]!4 [2,7]!4>\")\n * .s('supersquare').osc()\n *\n */", + "meta": { + "filename": "controls.mjs", + "lineno": 639, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": {} + }, + "description": "

      Formant filter to make things sound like vowels.

      ", + "name": "vowel", + "params": [ + { + "type": { + "names": [ + "string", + "Pattern" + ] + }, + "description": "

      You can use a e i o u. Use a rest (~) to override the effect

      ", + "name": "vowel" + } + ], + "examples": [ + "vowel(\"a e i [o u]\").slow(2)\n.n(\"<[0,7]!4 [2,7]!4>\")\n.s('supersquare').osc()" + ], + "longname": "vowel", + "kind": "member", + "scope": "global", + "___id": "T000002R000039", "___s": true }, { @@ -870,7 +1220,7 @@ "longname": "drawLine", "kind": "function", "scope": "global", - "___id": "T000002R000035", + "___id": "T000002R000046", "___s": true }, { @@ -959,7 +1309,7 @@ "longname": "Pattern#euclid", "kind": "function", "scope": "instance", - "___id": "T000002R000059", + "___id": "T000002R000070", "___s": true }, { @@ -996,7 +1346,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000060", + "___id": "T000002R000071", "___s": true }, { @@ -1034,7 +1384,7 @@ "name": "query" } ], - "___id": "T000002R000520", + "___id": "T000002R000531", "___s": true }, { @@ -1097,7 +1447,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000522", + "___id": "T000002R000533", "___s": true }, { @@ -1133,7 +1483,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000523", + "___id": "T000002R000534", "___s": true }, { @@ -1181,7 +1531,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000526", + "___id": "T000002R000537", "___s": true }, { @@ -1229,7 +1579,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000527", + "___id": "T000002R000538", "___s": true }, { @@ -1276,7 +1626,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000528", + "___id": "T000002R000539", "___s": true }, { @@ -1324,7 +1674,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000529", + "___id": "T000002R000540", "___s": true }, { @@ -1371,7 +1721,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000530", + "___id": "T000002R000541", "___s": true }, { @@ -1418,7 +1768,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000531", + "___id": "T000002R000542", "___s": true }, { @@ -1465,7 +1815,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000532", + "___id": "T000002R000543", "___s": true }, { @@ -1512,7 +1862,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000533", + "___id": "T000002R000544", "___s": true }, { @@ -1548,7 +1898,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000534", + "___id": "T000002R000545", "___s": true }, { @@ -1604,7 +1954,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000535", + "___id": "T000002R000546", "___s": true }, { @@ -1651,7 +2001,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000569", + "___id": "T000002R000580", "___s": true }, { @@ -1684,7 +2034,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000570", + "___id": "T000002R000581", "___s": true }, { @@ -1732,7 +2082,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000571", + "___id": "T000002R000582", "___s": true }, { @@ -1779,7 +2129,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000572", + "___id": "T000002R000583", "___s": true }, { @@ -1815,7 +2165,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000573", + "___id": "T000002R000584", "___s": true }, { @@ -1851,7 +2201,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000574", + "___id": "T000002R000585", "___s": true }, { @@ -1887,7 +2237,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000575", + "___id": "T000002R000586", "___s": true }, { @@ -1934,7 +2284,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000583", + "___id": "T000002R000594", "___s": true }, { @@ -1981,7 +2331,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000585", + "___id": "T000002R000596", "___s": true }, { @@ -2028,7 +2378,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000597", + "___id": "T000002R000608", "___s": true }, { @@ -2077,7 +2427,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000609", + "___id": "T000002R000620", "___s": true }, { @@ -2108,7 +2458,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000612", + "___id": "T000002R000623", "___s": true }, { @@ -2139,7 +2489,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000613", + "___id": "T000002R000624", "___s": true }, { @@ -2175,7 +2525,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000614", + "___id": "T000002R000625", "___s": true }, { @@ -2211,7 +2561,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000633", + "___id": "T000002R000644", "___s": true }, { @@ -2247,7 +2597,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000634", + "___id": "T000002R000645", "___s": true }, { @@ -2283,7 +2633,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000635", + "___id": "T000002R000646", "___s": true }, { @@ -2319,7 +2669,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000636", + "___id": "T000002R000647", "___s": true }, { @@ -2355,7 +2705,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000637", + "___id": "T000002R000648", "___s": true }, { @@ -2411,7 +2761,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000638", + "___id": "T000002R000649", "___s": true }, { @@ -2467,7 +2817,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000639", + "___id": "T000002R000650", "___s": true }, { @@ -2523,7 +2873,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000640", + "___id": "T000002R000651", "___s": true }, { @@ -2559,7 +2909,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000737", + "___id": "T000002R000748", "___s": true }, { @@ -2610,7 +2960,7 @@ "longname": "pure", "kind": "function", "scope": "global", - "___id": "T000002R000855", + "___id": "T000002R000866", "___s": true }, { @@ -2662,7 +3012,7 @@ "longname": "stack", "kind": "function", "scope": "global", - "___id": "T000002R000862", + "___id": "T000002R000873", "___s": true }, { @@ -2714,7 +3064,7 @@ "longname": "slowcat", "kind": "function", "scope": "global", - "___id": "T000002R000866", + "___id": "T000002R000877", "___s": true }, { @@ -2763,7 +3113,7 @@ "longname": "slowcatPrime", "kind": "function", "scope": "global", - "___id": "T000002R000874", + "___id": "T000002R000885", "___s": true }, { @@ -2815,7 +3165,7 @@ "longname": "fastcat", "kind": "function", "scope": "global", - "___id": "T000002R000880", + "___id": "T000002R000891", "___s": true }, { @@ -2843,7 +3193,7 @@ "longname": "cat", "kind": "function", "scope": "global", - "___id": "T000002R000882", + "___id": "T000002R000893", "___s": true }, { @@ -2895,7 +3245,7 @@ "longname": "timeCat", "kind": "function", "scope": "global", - "___id": "T000002R000884", + "___id": "T000002R000895", "___s": true }, { @@ -2923,7 +3273,7 @@ "longname": "sequence", "kind": "function", "scope": "global", - "___id": "T000002R000891", + "___id": "T000002R000902", "___s": true }, { @@ -2951,7 +3301,7 @@ "longname": "seq", "kind": "function", "scope": "global", - "___id": "T000002R000893", + "___id": "T000002R000904", "___s": true }, { @@ -2990,7 +3340,7 @@ "scope": "static", "longname": "Pattern.transpose", "kind": "member", - "___id": "T000002R003702", + "___id": "T000002R003713", "___s": true }, { @@ -3027,7 +3377,7 @@ "scope": "static", "longname": "Pattern.scaleTranspose", "kind": "member", - "___id": "T000002R003706", + "___id": "T000002R003717", "___s": true }, { @@ -3064,7 +3414,7 @@ "scope": "static", "longname": "Pattern.scale", "kind": "member", - "___id": "T000002R003708", + "___id": "T000002R003719", "___s": true }, { @@ -3101,7 +3451,7 @@ "scope": "static", "longname": "Pattern.voicings", "kind": "member", - "___id": "T000002R003733", + "___id": "T000002R003744", "___s": true }, { @@ -3183,7 +3533,7 @@ "/home/felix/projects/strudel/packages/xen/tunejs.js", "/home/felix/projects/strudel/packages/xen/xen.mjs" ], - "___id": "T000002R014002", + "___id": "T000002R014013", "___s": true } ] diff --git a/packages/core/controls.mjs b/packages/core/controls.mjs index 30ddd203..cc2444ce 100644 --- a/packages/core/controls.mjs +++ b/packages/core/controls.mjs @@ -22,8 +22,8 @@ const generic_params = [ /** * The note or sample number to choose for a synth or sampleset * Note names currently not working yet, but will hopefully soon. Just stick to numbers for now - * - * @name n + * + * @name n * @param {string | number | Pattern} value note name, note number or sample number * @example * s('superpiano').n("<0 1 2 3>").osc() @@ -164,6 +164,17 @@ const generic_params = [ 'end', 'the same as `begin`, but cuts the end off samples, shortening them; e.g. `0.75` to cut off the last quarter of each sample.', ], + /** + * Loops the sample (from `begin` to `end`) the specified number of times. + * Note that the tempo of the loop is not synced with the cycle tempo. + * + * @name loop + * @param {number | Pattern} times How often the sample is looped + * @example + * s("bd").loop("<1 2 3 4>").osc() + * + */ + ['f', 'loop', 'loops the sample (from `begin` to `end`) the specified number of times.'], // TODO: currently duplicated with "native" legato /** * a pattern of numbers from 0 to 1. Skips the beginning of each sample, e.g. `0.25` to cut off the first quarter from each sample. @@ -303,6 +314,20 @@ const generic_params = [ ['f', 'delay', 'a pattern of numbers from 0 to 1. Sets the level of the delay signal.'], ['f', 'delayfeedback', 'a pattern of numbers from 0 to 1. Sets the amount of delay feedback.'], ['f', 'delaytime', 'a pattern of numbers from 0 to 1. Sets the length of the delay.'], + /* // TODO: test + * Specifies whether delaytime is calculated relative to cps. + * + * @name lock + * @param {number | Pattern} enable When set to 1, delaytime is a direct multiple of a cycle. + * @example + * s("sd").delay().lock(1).osc() + * + */ + [ + 'f', + 'lock', + 'A pattern of numbers. Specifies whether delaytime is calculated relative to cps. When set to 1, delaytime is a direct multiple of a cycle.', + ], /** * Set detune of oscillators. Works only with some synths, see tidal doc * @@ -412,45 +437,86 @@ const generic_params = [ // ['f', 'lhitom', ''], // ['f', 'lkick', ''], // ['f', 'llotom', ''], - [ - 'f', - 'lock', - 'A pattern of numbers. Specifies whether delaytime is calculated relative to cps. When set to 1, delaytime is a direct multiple of a cycle.', - ], - ['f', 'loop', 'loops the sample (from `begin` to `end`) the specified number of times.'], // ['f', 'lophat', ''], // ['f', 'lsnare', ''], - ['f', 'degree', ''], - ['f', 'mtranspose', ''], - ['f', 'ctranspose', ''], - ['f', 'harmonic', ''], - ['f', 'stepsPerOctave', ''], - ['f', 'octaveR', ''], + ['f', 'degree', ''], // TODO: what is this? not found in tidal doc + ['f', 'mtranspose', ''], // TODO: what is this? not found in tidal doc + ['f', 'ctranspose', ''], // TODO: what is this? not found in tidal doc + ['f', 'harmonic', ''], // TODO: what is this? not found in tidal doc + ['f', 'stepsPerOctave', ''], // TODO: what is this? not found in tidal doc + ['f', 'octaveR', ''], // TODO: what is this? not found in tidal doc + // TODO: why is this needed? what's the difference to late / early? [ 'f', 'nudge', 'Nudges events into the future by the specified number of seconds. Negative numbers work up to a point as well (due to internal latency)', ], + // TODO: the following doc is just a guess, it's not documented in tidal doc. + /** + * Sets the default octave of a synth. + * + * @name octave + * @param {number | Pattern} octave octave number + * @example + * n("0,4,7").s('supersquare').octave("<3 4 5 6>").osc() + */ ['i', 'octave', ''], - ['f', 'offset', ''], + ['f', 'offset', ''], // TODO: what is this? not found in tidal doc // ['f', 'ophatdecay', ''], + // TODO: example + /** + * a pattern of numbers. An `orbit` is a global parameter context for patterns. Patterns with the same orbit will share hardware output bus offset and global effects, e.g. reverb and delay. The maximum number of orbits is specified in the superdirt startup, numbers higher than maximum will wrap around. + * + * @name orbit + * @param {number | Pattern} number + * + */ [ 'i', 'orbit', 'a pattern of numbers. An `orbit` is a global parameter context for patterns. Patterns with the same orbit will share hardware output bus offset and global effects, e.g. reverb and delay. The maximum number of orbits is specified in the superdirt startup, numbers higher than maximum will wrap around.', ], - ['f', 'overgain', ''], - ['f', 'overshape', ''], + ['f', 'overgain', ''], // TODO: what is this? not found in tidal doc + ['f', 'overshape', ''], // TODO: what is this? not found in tidal doc + /** + * Sets position in stereo. + * + * @name pan + * @param {number | Pattern} pan between 0 and 1, from left to right (assuming stereo), once round a circle (assuming multichannel) + * @example + * s("[bd hh]*2").pan("<.5 1 .5 0>").osc() + * + */ [ 'f', 'pan', 'a pattern of numbers between 0 and 1, from left to right (assuming stereo), once round a circle (assuming multichannel)', ], + // TODO: this has no effect (see example) + /* + * Controls how much multichannel output is fanned out + * + * @name panspan + * @param {number | Pattern} span between -inf and inf, negative is backwards ordering + * @example + * s("[bd hh]*2").pan("<.5 1 .5 0>").panspan("<0 .5 1>").osc() + * + */ [ 'f', 'panspan', 'a pattern of numbers between -inf and inf, which controls how much multichannel output is fanned out (negative is backwards ordering)', ], + // TODO: this has no effect (see example) + /* + * Controls how much multichannel output is spread + * + * @name pansplay + * @param {number | Pattern} spread between 0 and 1 + * @example + * s("[bd hh]*2").pan("<.5 1 .5 0>").pansplay("<0 .5 1>").osc() + * + */ [ 'f', 'pansplay', @@ -470,44 +536,118 @@ const generic_params = [ // ['f', 'pitch2', ''], // ['f', 'pitch3', ''], // ['f', 'portamento', ''], + // TODO: LFO rate see https://tidalcycles.org/docs/patternlib/tutorials/synthesizers/#supersquare ['f', 'rate', "used in SuperDirt softsynths as a control rate or 'speed'"], - ['f', 'room', 'a pattern of numbers from 0 to 1. Sets the level of reverb.'], - // ['f', 'sagogo', ''], - // ['f', 'sclap', ''], - // ['f', 'sclaves', ''], - // ['f', 'scrash', ''], + // TODO: slide param for certain synths + ['f', 'slide', ''], + // TODO: detune? https://tidalcycles.org/docs/patternlib/tutorials/synthesizers/#supersquare ['f', 'semitone', ''], - [ - 'f', - 'shape', - 'wave shaping distortion, a pattern of numbers from 0 for no distortion up to 1 for loads of distortion.', - ], + // TODO: dedup with synth param, see https://tidalcycles.org/docs/reference/synthesizers/#superpiano + ['f', 'velocity', ''], + ['f', 'voice', ''], // TODO: synth param + /** + * Sets the level of reverb. + * + * @name room + * @param {number | Pattern} level between 0 and 1 + * @example + * s("bd sd").room("<0 .2 .4 .6 .8 1>").osc() + * + */ + ['f', 'room', 'a pattern of numbers from 0 to 1. Sets the level of reverb.'], + /** + * Sets the room size of the reverb, see {@link room}. + * + * @name size + * @param {number | Pattern} size between 0 and 1 + * @example + * s("bd sd").room(.8).size("<0 .2 .4 .6 .8 1>").osc() + * + */ [ 'f', 'size', 'a pattern of numbers from 0 to 1. Sets the perceptual size (reverb time) of the `room` to be used in reverb.', ], - ['f', 'slide', ''], + // ['f', 'sagogo', ''], + // ['f', 'sclap', ''], + // ['f', 'sclaves', ''], + // ['f', 'scrash', ''], + /** + * Wave shaping distortion. CAUTION: it might get loud + * + * @name shape + * @param {number | Pattern} distortion between 0 and 1 + * @example + * s("bd sd").shape("<0 .2 .4 .6 .8 1>").osc() + * + */ + [ + 'f', + 'shape', + 'wave shaping distortion, a pattern of numbers from 0 for no distortion up to 1 for loads of distortion.', + ], + /** + * Changes the speed of sample playback, i.e. a cheap way of changing pitch. + * + * @name speed + * @param {number | Pattern} speed -inf to inf, negative numbers play the sample backwards. + * @example + * s("bd").speed("<1 2 4 1 -2 -4>").osc() + * @example + * speed("1 1.5*2 [2 1.1]").s("sax").cut(1).osc() + * + */ [ 'f', 'speed', 'a pattern of numbers which changes the speed of sample playback, i.e. a cheap way of changing pitch. Negative values will play the sample backwards!', ], - ['f', 'squiz', ''], - ['f', 'stutterdepth', ''], - ['f', 'stuttertime', ''], - ['f', 'timescale', ''], - ['f', 'timescalewin', ''], - // ['f', 'tomdecay', ''], + /** + * Used in conjunction with {@link speed}, accepts values of "r" (rate, default behavior), "c" (cycles), or "s" (seconds). Using `unit "c"` means `speed` will be interpreted in units of cycles, e.g. `speed "1"` means samples will be stretched to fill a cycle. Using `unit "s"` means the playback speed will be adjusted so that the duration is the number of seconds specified by `speed`. + * + * @name unit + * @param {number | string | Pattern} unit see description above + * @example + * speed("1 2 .5 3").s("bd").unit("c").osc() + * + */ [ 's', 'unit', 'used in conjunction with `speed`, accepts values of "r" (rate, default behavior), "c" (cycles), or "s" (seconds). Using `unit "c"` means `speed` will be interpreted in units of cycles, e.g. `speed "1"` means samples will be stretched to fill a cycle. Using `unit "s"` means the playback speed will be adjusted so that the duration is the number of seconds specified by `speed`.', ], - ['f', 'velocity', ''], + /** + * Made by Calum Gunn. Reminiscent of some weird mixture of filter, ring-modulator and pitch-shifter. The SuperCollider manual defines Squiz as: + * + * "A simplistic pitch-raising algorithm. It's not meant to sound natural; its sound is reminiscent of some weird mixture of filter, ring-modulator and pitch-shifter, depending on the input. The algorithm works by cutting the signal into fragments (delimited by upwards-going zero-crossings) and squeezing those fragments in the time domain (i.e. simply playing them back faster than they came in), leaving silences inbetween. All the parameters apart from memlen can be modulated." + * + * @name squiz + * @param {number | Pattern} squiz Try passing multiples of 2 to it - 2, 4, 8 etc. + * @example + * squiz("2 4/2 6 [8 16]").s("bd").osc() + * + */ + ['f', 'squiz', ''], + ['f', 'stutterdepth', ''], // TODO: what is this? not found in tidal doc + ['f', 'stuttertime', ''], // TODO: what is this? not found in tidal doc + ['f', 'timescale', ''], // TODO: what is this? not found in tidal doc + ['f', 'timescalewin', ''], // TODO: what is this? not found in tidal doc + // ['f', 'tomdecay', ''], // ['f', 'vcfegint', ''], // ['f', 'vcoegint', ''], - ['f', 'voice', ''], + /** + * + * Formant filter to make things sound like vowels. + * + * @name vowel + * @param {string | Pattern} vowel You can use a e i o u. Use a rest (~) to override the effect + * @example + * vowel("a e i [o u]").slow(2) + * .n("<[0,7]!4 [2,7]!4>") + * .s('supersquare').osc() + * + */ [ 's', 'vowel', From 1b8a12dd2a429aec94e1325033da9660e9c3033a Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Sun, 22 May 2022 21:52:46 +0200 Subject: [PATCH 17/26] doc --- doc.json | 140 +++++++++++++++++++++++-------------- packages/core/controls.mjs | 29 +++++++- 2 files changed, 113 insertions(+), 56 deletions(-) diff --git a/doc.json b/doc.json index 64952a2d..6d717503 100644 --- a/doc.json +++ b/doc.json @@ -1120,7 +1120,7 @@ "___s": true }, { - "comment": "/**\n * \n * Formant filter to make things sound like vowels.\n * \n * @name vowel\n * @param {string | Pattern} vowel You can use a e i o u. Use a rest (~) to override the effect\n * @example\n * vowel(\"a e i [o u]\").slow(2)\n * .n(\"<[0,7]!4 [2,7]!4>\")\n * .s('supersquare').osc()\n *\n */", + "comment": "/**\n *\n * Formant filter to make things sound like vowels.\n *\n * @name vowel\n * @param {string | Pattern} vowel You can use a e i o u. Use a rest (~) to override the effect\n * @example\n * vowel(\"a e i [o u]\").slow(2)\n * .n(\"<[0,7]!4 [2,7]!4>\")\n * .s('supersquare').osc()\n *\n */", "meta": { "filename": "controls.mjs", "lineno": 639, @@ -1151,6 +1151,38 @@ "___id": "T000002R000039", "___s": true }, + { + "comment": "/**\n *\n * Tremolo Audio DSP effect\n *\n * @name tremolodepth\n * @param {number | Pattern} depth between 0 and 1\n * @example\n * n(\"[0,4,7]\").tremolodepth(\"<0 .3 .6 .9>\").osc()\n *\n */", + "meta": { + "filename": "controls.mjs", + "lineno": 672, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": {} + }, + "description": "

      Tremolo Audio DSP effect

      ", + "name": "tremolodepth", + "params": [ + { + "type": { + "names": [ + "number", + "Pattern" + ] + }, + "description": "

      between 0 and 1

      ", + "name": "depth" + } + ], + "examples": [ + "n(\"[0,4,7]\").tremolodepth(\"<0 .3 .6 .9>\").osc()" + ], + "longname": "tremolodepth", + "kind": "member", + "scope": "global", + "___id": "T000002R000040", + "___s": true + }, { "comment": "/**\n * Intended for a debugging, drawLine renders the pattern as a string, where each character represents the same time span.\n * Should only be used with single characters as values, otherwise the character slots will be messed up.\n * Character legend:\n *\n * - \"|\" cycle separator\n * - \"-\" hold previous value\n * - \".\" silence\n *\n * @param {Pattern} pattern the pattern to use\n * @param {number} chars max number of characters (approximately)\n * @returns string\n * @example\n * const line = drawLine(\"0 [1 2 3]\", 10); // |0--123|0--123\n * console.log(line);\n */", "meta": { @@ -1220,7 +1252,7 @@ "longname": "drawLine", "kind": "function", "scope": "global", - "___id": "T000002R000046", + "___id": "T000002R000047", "___s": true }, { @@ -1309,7 +1341,7 @@ "longname": "Pattern#euclid", "kind": "function", "scope": "instance", - "___id": "T000002R000070", + "___id": "T000002R000071", "___s": true }, { @@ -1346,7 +1378,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000071", + "___id": "T000002R000072", "___s": true }, { @@ -1384,7 +1416,7 @@ "name": "query" } ], - "___id": "T000002R000531", + "___id": "T000002R000532", "___s": true }, { @@ -1447,7 +1479,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000533", + "___id": "T000002R000534", "___s": true }, { @@ -1483,7 +1515,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000534", + "___id": "T000002R000535", "___s": true }, { @@ -1531,7 +1563,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000537", + "___id": "T000002R000538", "___s": true }, { @@ -1579,7 +1611,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000538", + "___id": "T000002R000539", "___s": true }, { @@ -1626,7 +1658,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000539", + "___id": "T000002R000540", "___s": true }, { @@ -1674,7 +1706,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000540", + "___id": "T000002R000541", "___s": true }, { @@ -1721,7 +1753,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000541", + "___id": "T000002R000542", "___s": true }, { @@ -1768,7 +1800,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000542", + "___id": "T000002R000543", "___s": true }, { @@ -1815,7 +1847,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000543", + "___id": "T000002R000544", "___s": true }, { @@ -1862,7 +1894,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000544", + "___id": "T000002R000545", "___s": true }, { @@ -1898,7 +1930,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000545", + "___id": "T000002R000546", "___s": true }, { @@ -1954,7 +1986,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000546", + "___id": "T000002R000547", "___s": true }, { @@ -2001,7 +2033,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000580", + "___id": "T000002R000581", "___s": true }, { @@ -2034,7 +2066,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000581", + "___id": "T000002R000582", "___s": true }, { @@ -2082,7 +2114,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000582", + "___id": "T000002R000583", "___s": true }, { @@ -2129,7 +2161,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000583", + "___id": "T000002R000584", "___s": true }, { @@ -2165,7 +2197,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000584", + "___id": "T000002R000585", "___s": true }, { @@ -2201,7 +2233,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000585", + "___id": "T000002R000586", "___s": true }, { @@ -2237,7 +2269,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000586", + "___id": "T000002R000587", "___s": true }, { @@ -2284,7 +2316,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000594", + "___id": "T000002R000595", "___s": true }, { @@ -2331,7 +2363,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000596", + "___id": "T000002R000597", "___s": true }, { @@ -2378,7 +2410,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000608", + "___id": "T000002R000609", "___s": true }, { @@ -2427,7 +2459,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000620", + "___id": "T000002R000621", "___s": true }, { @@ -2458,7 +2490,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000623", + "___id": "T000002R000624", "___s": true }, { @@ -2489,7 +2521,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000624", + "___id": "T000002R000625", "___s": true }, { @@ -2525,7 +2557,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000625", + "___id": "T000002R000626", "___s": true }, { @@ -2561,7 +2593,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000644", + "___id": "T000002R000645", "___s": true }, { @@ -2597,7 +2629,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000645", + "___id": "T000002R000646", "___s": true }, { @@ -2633,7 +2665,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000646", + "___id": "T000002R000647", "___s": true }, { @@ -2669,7 +2701,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000647", + "___id": "T000002R000648", "___s": true }, { @@ -2705,7 +2737,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000648", + "___id": "T000002R000649", "___s": true }, { @@ -2761,7 +2793,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000649", + "___id": "T000002R000650", "___s": true }, { @@ -2817,7 +2849,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000650", + "___id": "T000002R000651", "___s": true }, { @@ -2873,7 +2905,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000651", + "___id": "T000002R000652", "___s": true }, { @@ -2909,7 +2941,7 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000748", + "___id": "T000002R000749", "___s": true }, { @@ -2960,7 +2992,7 @@ "longname": "pure", "kind": "function", "scope": "global", - "___id": "T000002R000866", + "___id": "T000002R000867", "___s": true }, { @@ -3012,7 +3044,7 @@ "longname": "stack", "kind": "function", "scope": "global", - "___id": "T000002R000873", + "___id": "T000002R000874", "___s": true }, { @@ -3064,7 +3096,7 @@ "longname": "slowcat", "kind": "function", "scope": "global", - "___id": "T000002R000877", + "___id": "T000002R000878", "___s": true }, { @@ -3113,7 +3145,7 @@ "longname": "slowcatPrime", "kind": "function", "scope": "global", - "___id": "T000002R000885", + "___id": "T000002R000886", "___s": true }, { @@ -3165,7 +3197,7 @@ "longname": "fastcat", "kind": "function", "scope": "global", - "___id": "T000002R000891", + "___id": "T000002R000892", "___s": true }, { @@ -3193,7 +3225,7 @@ "longname": "cat", "kind": "function", "scope": "global", - "___id": "T000002R000893", + "___id": "T000002R000894", "___s": true }, { @@ -3245,7 +3277,7 @@ "longname": "timeCat", "kind": "function", "scope": "global", - "___id": "T000002R000895", + "___id": "T000002R000896", "___s": true }, { @@ -3273,7 +3305,7 @@ "longname": "sequence", "kind": "function", "scope": "global", - "___id": "T000002R000902", + "___id": "T000002R000903", "___s": true }, { @@ -3301,7 +3333,7 @@ "longname": "seq", "kind": "function", "scope": "global", - "___id": "T000002R000904", + "___id": "T000002R000905", "___s": true }, { @@ -3340,7 +3372,7 @@ "scope": "static", "longname": "Pattern.transpose", "kind": "member", - "___id": "T000002R003713", + "___id": "T000002R003714", "___s": true }, { @@ -3377,7 +3409,7 @@ "scope": "static", "longname": "Pattern.scaleTranspose", "kind": "member", - "___id": "T000002R003717", + "___id": "T000002R003718", "___s": true }, { @@ -3414,7 +3446,7 @@ "scope": "static", "longname": "Pattern.scale", "kind": "member", - "___id": "T000002R003719", + "___id": "T000002R003720", "___s": true }, { @@ -3451,7 +3483,7 @@ "scope": "static", "longname": "Pattern.voicings", "kind": "member", - "___id": "T000002R003744", + "___id": "T000002R003745", "___s": true }, { @@ -3533,7 +3565,7 @@ "/home/felix/projects/strudel/packages/xen/tunejs.js", "/home/felix/projects/strudel/packages/xen/xen.mjs" ], - "___id": "T000002R014013", + "___id": "T000002R014014", "___s": true } ] diff --git a/packages/core/controls.mjs b/packages/core/controls.mjs index cc2444ce..be51037e 100644 --- a/packages/core/controls.mjs +++ b/packages/core/controls.mjs @@ -637,9 +637,9 @@ const generic_params = [ // ['f', 'vcfegint', ''], // ['f', 'vcoegint', ''], /** - * + * * Formant filter to make things sound like vowels. - * + * * @name vowel * @param {string | Pattern} vowel You can use a e i o u. Use a rest (~) to override the effect * @example @@ -653,18 +653,43 @@ const generic_params = [ 'vowel', 'formant filter to make things sound like vowels, a pattern of either `a`, `e`, `i`, `o` or `u`. Use a rest (`~`) for no effect.', ], + /* // TODO: find out how it works + * Made by Calum Gunn. Divides an audio stream into tiny segments, using the signal's zero-crossings as segment boundaries, and discards a fraction of them. Takes a number between 1 and 100, denoted the percentage of segments to drop. The SuperCollider manual describes the Waveloss effect this way: + * + * Divide an audio stream into tiny segments, using the signal's zero-crossings as segment boundaries, and discard a fraction of them (i.e. replace them with silence of the same length). The technique was described by Trevor Wishart in a lecture. Parameters: the filter drops drop out of out of chunks. mode can be 1 to drop chunks in a simple deterministic fashion (e.g. always dropping the first 30 out of a set of 40 segments), or 2 to drop chunks randomly but in an appropriate proportion.) + * + * mode: ? + * waveloss: ? + * + * @name waveloss + */ ['f', 'waveloss', ''], + // TODO: midi effects? ['f', 'dur', ''], // ['f', 'modwheel', ''], ['f', 'expression', ''], ['f', 'sustainpedal', ''], + /* // TODO: doesn't seem to do anything + * + * Tremolo Audio DSP effect + * + * @name tremolodepth + * @param {number | Pattern} depth between 0 and 1 + * @example + * n("0,4,7").tremolodepth("<0 .3 .6 .9>").osc() + * + */ + // TODO: tremdp alias ['f', 'tremolodepth', "Tremolo Audio DSP effect | params are 'tremolorate' and 'tremolodepth'"], ['f', 'tremolorate', "Tremolo Audio DSP effect | params are 'tremolorate' and 'tremolodepth'"], + // TODO: doesn't seem to do anything ['f', 'phaserdepth', "Phaser Audio DSP effect | params are 'phaserrate' and 'phaserdepth'"], ['f', 'phaserrate', "Phaser Audio DSP effect | params are 'phaserrate' and 'phaserdepth'"], + ['f', 'fshift', 'frequency shifter'], ['f', 'fshiftnote', 'frequency shifter'], ['f', 'fshiftphase', 'frequency shifter'], + ['f', 'triode', 'tube distortion'], ['f', 'krush', 'shape/bass enhancer'], ['f', 'kcutoff', ''], From 2680eed681e5e9f0e088f7bc8df766a3b6a31e5e Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Sun, 22 May 2022 21:57:04 +0200 Subject: [PATCH 18/26] hide api doc by default --- tutorial/ApiDoc.jsx | 13 +++++++++++++ tutorial/tutorial.mdx | 2 -- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/tutorial/ApiDoc.jsx b/tutorial/ApiDoc.jsx index c3ef7e96..fa752818 100644 --- a/tutorial/ApiDoc.jsx +++ b/tutorial/ApiDoc.jsx @@ -2,10 +2,23 @@ import React, { Fragment } from 'react'; import { docs } from '../doc.json'; import { MiniRepl } from './MiniRepl'; +const visible = window.location.href.includes('?api=true'); + function ApiDoc() { + if (!visible) { + return ( +

      + The API Docs are a work in progress, but you can preview it by clicking here +

      + ); + } // console.log('docJson', docs); return (
      +

      + The following Chapter is the technical API documentation. It is autogenerated from the jsdoc comments in the + source files. hide +

      {docs .filter((item) => !item.name?.startsWith('_') && item.kind !== 'package') .map((item, i) => ( diff --git a/tutorial/tutorial.mdx b/tutorial/tutorial.mdx index fc01f03a..87ade218 100644 --- a/tutorial/tutorial.mdx +++ b/tutorial/tutorial.mdx @@ -701,6 +701,4 @@ import ApiDoc from './ApiDoc'; # API Docs -The following Chapter is the technical API documentation. It is autogenerated from the jsdoc comments in the source files. - From b5b0fbbd380604f4da73f6703b1d8c3896d58568 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Tue, 24 May 2022 00:03:50 +0200 Subject: [PATCH 19/26] small fixes --- packages/core/controls.mjs | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/packages/core/controls.mjs b/packages/core/controls.mjs index be51037e..e59d4cc7 100644 --- a/packages/core/controls.mjs +++ b/packages/core/controls.mjs @@ -10,7 +10,15 @@ const controls = {}; const generic_params = [ /** * Select a sound / sample by name. - * See default sounds here: https://tidalcycles.org/docs/configuration/Audio%20Samples/default_library + * + *
      + * show all sounds + * + * 808 (6) 808bd (25) 808cy (25) 808hc (5) 808ht (5) 808lc (5) 808lt (5) 808mc (5) 808mt (5) 808oh (5) 808sd (25) 909 (1) ab (12) ade (10) ades2 (9) ades3 (7) ades4 (6) alex (2) alphabet (26) amencutup (32) armora (7) arp (2) arpy (11) auto (11) baa (7) baa2 (7) bass (4) bass0 (3) bass1 (30) bass2 (5) bass3 (11) bassdm (24) bassfoo (3) battles (2) bd (24) bend (4) bev (2) bin (2) birds (10) birds3 (19) bleep (13) blip (2) blue (2) bottle (13) breaks125 (2) breaks152 (1) breaks157 (1) breaks165 (1) breath (1) bubble (8) can (14) casio (3) cb (1) cc (6) chin (4) circus (3) clak (2) click (4) clubkick (5) co (4) coins (1) control (2) cosmicg (15) cp (2) cr (6) crow (4) d (4) db (13) diphone (38) diphone2 (12) dist (16) dork2 (4) dorkbot (2) dr (42) dr2 (6) dr55 (4) dr_few (8) drum (6) drumtraks (13) e (8) east (9) electro1 (13) em2 (6) erk (1) f (1) feel (7) feelfx (8) fest (1) fire (1) flick (17) fm (17) foo (27) future (17) gab (10) gabba (4) gabbaloud (4) gabbalouder (4) glasstap (3) glitch (8) glitch2 (8) gretsch (24) gtr (3) h (7) hand (17) hardcore (12) hardkick (6) haw (6) hc (6) hh (13) hh27 (13) hit (6) hmm (1) ho (6) hoover (6) house (8) ht (16) if (5) ifdrums (3) incoming (8) industrial (32) insect (3) invaders (18) jazz (8) jungbass (20) jungle (13) juno (12) jvbass (13) kicklinn (1) koy (2) kurt (7) latibro (8) led (1) less (4) lighter (33) linnhats (6) lt (16) made (7) made2 (1) mash (2) mash2 (4) metal (10) miniyeah (4) monsterb (6) moog (7) mouth (15) mp3 (4) msg (9) mt (16) mute (28) newnotes (15) noise (1) noise2 (8) notes (15) numbers (9) oc (4) odx (15) off (1) outdoor (6) pad (3) padlong (1) pebbles (1) perc (6) peri (15) pluck (17) popkick (10) print (11) proc (2) procshort (8) psr (30) rave (8) rave2 (4) ravemono (2) realclaps (4) reverbkick (1) rm (2) rs (1) sax (22) sd (2) seawolf (3) sequential (8) sf (18) sheffield (1) short (5) sid (12) sine (6) sitar (8) sn (52) space (18) speakspell (12) speech (7) speechless (10) speedupdown (9) stab (23) stomp (10) subroc3d (11) sugar (2) sundance (6) tabla (26) tabla2 (46) tablex (3) tacscan (22) tech (13) techno (7) tink (5) tok (4) toys (13) trump (11) ul (10) ulgab (5) uxay (3) v (6) voodoo (5) wind (10) wobble (1) world (3) xmas (1) yeah (31) + * + * more info + * + *
      * * @name s * @param {string | Pattern} sound The sound / pattern of sounds to pick @@ -132,7 +140,7 @@ const generic_params = [ * @name bandq * @param {number | Pattern} q q factor * @example - * s("bd sd").bandf("<1000 2000 4000 8000>").bandq("<.2 .9>").osc() + * s("bd sd").bandf(2000).bandq("<.2 .9>").osc() * */ ['f', 'bandq', 'a pattern of anumbers from 0 to 1. Sets the q-factor of the band-pass filter.'], @@ -176,6 +184,7 @@ const generic_params = [ */ ['f', 'loop', 'loops the sample (from `begin` to `end`) the specified number of times.'], // TODO: currently duplicated with "native" legato + // TODO: superdirt legato will do more: https://youtu.be/dQPmE1WaD1k?t=419 /** * a pattern of numbers from 0 to 1. Skips the beginning of each sample, e.g. `0.25` to cut off the first quarter from each sample. * @@ -400,7 +409,7 @@ const generic_params = [ * Emulation of a Leslie speaker: speakers rotating in a wooden amplified cabinet. * * @name leslie - * @param {number | Pattern} dry between 0 and 1 + * @param {number | Pattern} wet between 0 and 1 * @example * n("0,4,7").s("supersquare").leslie("<0 .4 .6 1>").osc() * @@ -564,6 +573,9 @@ const generic_params = [ * s("bd sd").room(.8).size("<0 .2 .4 .6 .8 1>").osc() * */ + // TODO: find out why : + // s("bd sd").room(.8).size("<0 .2 .4 .6 .8 [1,0]>").osc() + // .. does not work. Is it because room is only one effect? [ 'f', 'size', @@ -685,7 +697,7 @@ const generic_params = [ // TODO: doesn't seem to do anything ['f', 'phaserdepth', "Phaser Audio DSP effect | params are 'phaserrate' and 'phaserdepth'"], ['f', 'phaserrate', "Phaser Audio DSP effect | params are 'phaserrate' and 'phaserdepth'"], - + ['f', 'fshift', 'frequency shifter'], ['f', 'fshiftnote', 'frequency shifter'], ['f', 'fshiftphase', 'frequency shifter'], @@ -734,6 +746,8 @@ const generic_params = [ ['f', 'cps', ''], ]; +// TODO: slice / splice https://www.youtube.com/watch?v=hKhPdO0RKDQ&list=PL2lW1zNIIwj3bDkh-Y3LUGDuRcoUigoDs&index=13 + const _name = (name, ...pats) => sequence(...pats).withValue((x) => ({ [name]: x })); const _setter = (func) => From 4acdabe4398d720ad2c976a174353a7e3fd324f5 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Tue, 24 May 2022 00:03:59 +0200 Subject: [PATCH 20/26] can now generate mdx from nunjucks --- doc.json | 570 ++++++++++++++++++++----------------- packages/core/pattern.mjs | 30 +- tutorial/ApiDoc.jsx | 7 +- tutorial/Tutorial.jsx | 4 + tutorial/api.mdx | 123 ++++++++ tutorial/package-lock.json | 76 +++++ tutorial/package.json | 4 +- tutorial/render.js | 49 ++++ tutorial/templates/api.mdx | 35 +++ tutorial/tutorial.mdx | 3 - 10 files changed, 627 insertions(+), 274 deletions(-) create mode 100644 tutorial/api.mdx create mode 100644 tutorial/render.js create mode 100644 tutorial/templates/api.mdx diff --git a/doc.json b/doc.json index 6d717503..53b3f510 100644 --- a/doc.json +++ b/doc.json @@ -1,7 +1,7 @@ { "docs": [ { - "comment": "/**\n * Select a sound / sample by name.\n * See default sounds here: https://tidalcycles.org/docs/configuration/Audio%20Samples/default_library\n *\n * @name s\n * @param {string | Pattern} sound The sound / pattern of sounds to pick\n * @example\n * s(\"bd hh\").osc()\n *\n */", + "comment": "/**\n * Select a sound / sample by name.\n * \n *
      \n * show all sounds\n * \n * 808 (6) 808bd (25) 808cy (25) 808hc (5) 808ht (5) 808lc (5) 808lt (5) 808mc (5) 808mt (5) 808oh (5) 808sd (25) 909 (1) ab (12) ade (10) ades2 (9) ades3 (7) ades4 (6) alex (2) alphabet (26) amencutup (32) armora (7) arp (2) arpy (11) auto (11) baa (7) baa2 (7) bass (4) bass0 (3) bass1 (30) bass2 (5) bass3 (11) bassdm (24) bassfoo (3) battles (2) bd (24) bend (4) bev (2) bin (2) birds (10) birds3 (19) bleep (13) blip (2) blue (2) bottle (13) breaks125 (2) breaks152 (1) breaks157 (1) breaks165 (1) breath (1) bubble (8) can (14) casio (3) cb (1) cc (6) chin (4) circus (3) clak (2) click (4) clubkick (5) co (4) coins (1) control (2) cosmicg (15) cp (2) cr (6) crow (4) d (4) db (13) diphone (38) diphone2 (12) dist (16) dork2 (4) dorkbot (2) dr (42) dr2 (6) dr55 (4) dr_few (8) drum (6) drumtraks (13) e (8) east (9) electro1 (13) em2 (6) erk (1) f (1) feel (7) feelfx (8) fest (1) fire (1) flick (17) fm (17) foo (27) future (17) gab (10) gabba (4) gabbaloud (4) gabbalouder (4) glasstap (3) glitch (8) glitch2 (8) gretsch (24) gtr (3) h (7) hand (17) hardcore (12) hardkick (6) haw (6) hc (6) hh (13) hh27 (13) hit (6) hmm (1) ho (6) hoover (6) house (8) ht (16) if (5) ifdrums (3) incoming (8) industrial (32) insect (3) invaders (18) jazz (8) jungbass (20) jungle (13) juno (12) jvbass (13) kicklinn (1) koy (2) kurt (7) latibro (8) led (1) less (4) lighter (33) linnhats (6) lt (16) made (7) made2 (1) mash (2) mash2 (4) metal (10) miniyeah (4) monsterb (6) moog (7) mouth (15) mp3 (4) msg (9) mt (16) mute (28) newnotes (15) noise (1) noise2 (8) notes (15) numbers (9) oc (4) odx (15) off (1) outdoor (6) pad (3) padlong (1) pebbles (1) perc (6) peri (15) pluck (17) popkick (10) print (11) proc (2) procshort (8) psr (30) rave (8) rave2 (4) ravemono (2) realclaps (4) reverbkick (1) rm (2) rs (1) sax (22) sd (2) seawolf (3) sequential (8) sf (18) sheffield (1) short (5) sid (12) sine (6) sitar (8) sn (52) space (18) speakspell (12) speech (7) speechless (10) speedupdown (9) stab (23) stomp (10) subroc3d (11) sugar (2) sundance (6) tabla (26) tabla2 (46) tablex (3) tacscan (22) tech (13) techno (7) tink (5) tok (4) toys (13) trump (11) ul (10) ulgab (5) uxay (3) v (6) voodoo (5) wind (10) wobble (1) world (3) xmas (1) yeah (31)\n * \n * more info\n * \n *
      \n *\n * @name s\n * @param {string | Pattern} sound The sound / pattern of sounds to pick\n * @example\n * s(\"bd hh\").osc()\n *\n */", "meta": { "filename": "controls.mjs", "lineno": 11, @@ -9,7 +9,7 @@ "path": "/home/felix/projects/strudel/packages/core", "code": {} }, - "description": "

      Select a sound / sample by name.\nSee default sounds here: https://tidalcycles.org/docs/configuration/Audio%20Samples/default_library

      ", + "description": "

      Select a sound / sample by name.

      \n
      \nshow all sounds\n

      808 (6) 808bd (25) 808cy (25) 808hc (5) 808ht (5) 808lc (5) 808lt (5) 808mc (5) 808mt (5) 808oh (5) 808sd (25) 909 (1) ab (12) ade (10) ades2 (9) ades3 (7) ades4 (6) alex (2) alphabet (26) amencutup (32) armora (7) arp (2) arpy (11) auto (11) baa (7) baa2 (7) bass (4) bass0 (3) bass1 (30) bass2 (5) bass3 (11) bassdm (24) bassfoo (3) battles (2) bd (24) bend (4) bev (2) bin (2) birds (10) birds3 (19) bleep (13) blip (2) blue (2) bottle (13) breaks125 (2) breaks152 (1) breaks157 (1) breaks165 (1) breath (1) bubble (8) can (14) casio (3) cb (1) cc (6) chin (4) circus (3) clak (2) click (4) clubkick (5) co (4) coins (1) control (2) cosmicg (15) cp (2) cr (6) crow (4) d (4) db (13) diphone (38) diphone2 (12) dist (16) dork2 (4) dorkbot (2) dr (42) dr2 (6) dr55 (4) dr_few (8) drum (6) drumtraks (13) e (8) east (9) electro1 (13) em2 (6) erk (1) f (1) feel (7) feelfx (8) fest (1) fire (1) flick (17) fm (17) foo (27) future (17) gab (10) gabba (4) gabbaloud (4) gabbalouder (4) glasstap (3) glitch (8) glitch2 (8) gretsch (24) gtr (3) h (7) hand (17) hardcore (12) hardkick (6) haw (6) hc (6) hh (13) hh27 (13) hit (6) hmm (1) ho (6) hoover (6) house (8) ht (16) if (5) ifdrums (3) incoming (8) industrial (32) insect (3) invaders (18) jazz (8) jungbass (20) jungle (13) juno (12) jvbass (13) kicklinn (1) koy (2) kurt (7) latibro (8) led (1) less (4) lighter (33) linnhats (6) lt (16) made (7) made2 (1) mash (2) mash2 (4) metal (10) miniyeah (4) monsterb (6) moog (7) mouth (15) mp3 (4) msg (9) mt (16) mute (28) newnotes (15) noise (1) noise2 (8) notes (15) numbers (9) oc (4) odx (15) off (1) outdoor (6) pad (3) padlong (1) pebbles (1) perc (6) peri (15) pluck (17) popkick (10) print (11) proc (2) procshort (8) psr (30) rave (8) rave2 (4) ravemono (2) realclaps (4) reverbkick (1) rm (2) rs (1) sax (22) sd (2) seawolf (3) sequential (8) sf (18) sheffield (1) short (5) sid (12) sine (6) sitar (8) sn (52) space (18) speakspell (12) speech (7) speechless (10) speedupdown (9) stab (23) stomp (10) subroc3d (11) sugar (2) sundance (6) tabla (26) tabla2 (46) tablex (3) tacscan (22) tech (13) techno (7) tink (5) tok (4) toys (13) trump (11) ul (10) ulgab (5) uxay (3) v (6) voodoo (5) wind (10) wobble (1) world (3) xmas (1) yeah (31)

      \n

      more info

      \n
      ", "name": "s", "params": [ { @@ -36,7 +36,7 @@ "comment": "/**\n * The note or sample number to choose for a synth or sampleset\n * Note names currently not working yet, but will hopefully soon. Just stick to numbers for now\n *\n * @name n\n * @param {string | number | Pattern} value note name, note number or sample number\n * @example\n * s('superpiano').n(\"<0 1 2 3>\").osc()\n * @example\n * s('superpiano').n(\"\").osc()\n * @example\n * n(\"0 1 2 3\").s('east').osc()\n */", "meta": { "filename": "controls.mjs", - "lineno": 22, + "lineno": 30, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -71,7 +71,7 @@ "comment": "/**\n * A pattern of numbers that speed up (or slow down) samples while they play. Currently only supported by osc / superdirt.\n *\n * @name accelerate\n * @param {number | Pattern} amount acceleration.\n * @example\n * s(\"sax\").accelerate(\"<0 1 2 4 8 16>\").slow(2).osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 46, + "lineno": 54, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -103,7 +103,7 @@ "comment": "/**\n * Like {@link amp}, but exponential.\n *\n * @name gain\n * @param {number | Pattern} amount gain.\n * @example\n * s(\"bd*8\").gain(\".7*2 1 .7*2 1 .7 1\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 56, + "lineno": 64, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -135,7 +135,7 @@ "comment": "/**\n * Like {@link gain}, but linear.\n *\n * @name amp\n * @param {number | Pattern} amount gain.\n * @example\n * s(\"bd*8\").amp(\".1*2 .5 .1*2 .5 .1 .5\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 70, + "lineno": 78, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -167,7 +167,7 @@ "comment": "/**\n * Sets the center frequency of the band-pass filter.\n *\n * @name bandf\n * @param {number | Pattern} frequency center frequency\n * @example\n * s(\"bd sd\").bandf(\"<1000 2000 4000 8000>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 118, + "lineno": 126, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -196,10 +196,10 @@ "___s": true }, { - "comment": "/**\n * Sets the q-factor of the band-pass filter\n *\n * @name bandq\n * @param {number | Pattern} q q factor\n * @example\n * s(\"bd sd\").bandf(\"<1000 2000 4000 8000>\").bandq(\"<.2 .9>\").osc()\n *\n */", + "comment": "/**\n * Sets the q-factor of the band-pass filter\n *\n * @name bandq\n * @param {number | Pattern} q q factor\n * @example\n * s(\"bd sd\").bandf(2000).bandq(\"<.2 .9>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 129, + "lineno": 137, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -219,7 +219,7 @@ } ], "examples": [ - "s(\"bd sd\").bandf(\"<1000 2000 4000 8000>\").bandq(\"<.2 .9>\").osc()" + "s(\"bd sd\").bandf(2000).bandq(\"<.2 .9>\").osc()" ], "longname": "bandq", "kind": "member", @@ -231,7 +231,7 @@ "comment": "/**\n * a pattern of numbers from 0 to 1. Skips the beginning of each sample, e.g. `0.25` to cut off the first quarter from each sample.\n *\n * @name begin\n * @param {number | Pattern} amount between 0 and 1, where 1 is the length of the sample\n * @example\n * s(\"rave\").begin(\"<0 .25 .5 .75>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 139, + "lineno": 147, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -263,7 +263,7 @@ "comment": "/**\n * The same as {@link begin}, but cuts off the end off each sample.\n *\n * @name end\n * @param {number | Pattern} length 1 = whole sample, .5 = half sample, .25 = quarter sample etc..\n * @example\n * s(\"bd*2,ho*4\").end(\"<.1 .2 .5 1>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 153, + "lineno": 161, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -295,7 +295,7 @@ "comment": "/**\n * Loops the sample (from `begin` to `end`) the specified number of times.\n * Note that the tempo of the loop is not synced with the cycle tempo.\n *\n * @name loop\n * @param {number | Pattern} times How often the sample is looped\n * @example\n * s(\"bd\").loop(\"<1 2 3 4>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 167, + "lineno": 175, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -327,7 +327,7 @@ "comment": "/**\n * a pattern of numbers from 0 to 1. Skips the beginning of each sample, e.g. `0.25` to cut off the first quarter from each sample.\n *\n * @name legato\n * @param {number | Pattern} duration between 0 and 1, where 1 is the length of the whole hap time\n * @example\n * \"c4 eb4 g4 bb4\".legato(\"<0.125 .25 .5 .75 1 2 4>\")\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 179, + "lineno": 188, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -359,7 +359,7 @@ "comment": "/**\n * bit crusher effect.\n *\n * @name crush\n * @param {number | Pattern} depth between 1 (for drastic reduction in bit-depth) to 16 (for barely no reduction).\n * @example\n * s(\",hh*3,jvbass*2\").fast(2).crush(\"<16 8 7 6 5 4 3 2>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 190, + "lineno": 199, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -391,7 +391,7 @@ "comment": "/**\n * fake-resampling for lowering the sample rate\n *\n * @name coarse\n * @param {number | Pattern} factor 1 for original 2 for half, 3 for a third and so on.\n * @example\n * s(\"xmas\").coarse(\"<1 4 8 16 32>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 204, + "lineno": 213, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -423,7 +423,7 @@ "comment": "/**\n * choose the channel the pattern is sent to in superdirt\n *\n * @name channel\n * @param {number | Pattern} channel channel number\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 219, + "lineno": 228, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -452,7 +452,7 @@ "comment": "/**\n * In the style of classic drum-machines, `cut` will stop a playing sample as soon as another samples with in same cutgroup is to be played. An example would be an open hi-hat followed by a closed one, essentially muting the open.\n *\n * @name cut\n * @param {number | Pattern} group cut group number\n * @example\n * s(\"bd sax\").cut(1).osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 227, + "lineno": 236, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -484,7 +484,7 @@ "comment": "/**\n * Applies the cutoff frequency of the low-pass filter.\n *\n * @name cutoff\n * @param {number | Pattern} frequency audible between 0 and 20000\n * @example\n * s(\"bd,hh*2,<~ sd>\").fast(2).cutoff(\"<4000 2000 1000 500 200 100>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 241, + "lineno": 250, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -516,7 +516,7 @@ "comment": "/**\n * Applies the cutoff frequency of the high-pass filter.\n *\n * @name hcutoff\n * @param {number | Pattern} frequency audible between 0 and 20000\n * @example\n * s(\"bd,hh*2,<~ sd>\").fast(2).hcutoff(\"<4000 2000 1000 500 200 100>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 252, + "lineno": 261, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -548,7 +548,7 @@ "comment": "/**\n * Applies the cutoff frequency of the high-pass filter.\n *\n * @name hresonance\n * @param {number | Pattern} q resonance factor between 0 and 1\n * @example\n * s(\"bd,hh*2,<~ sd>\").fast(2).hcutoff(2000).hresonance(\"<0 .2 .4 .6>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 267, + "lineno": 276, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -580,7 +580,7 @@ "comment": "/**\n * Applies the cutoff frequency of the low-pass filter.\n *\n * @name resonance\n * @param {number | Pattern} q resonance factor between 0 and 1\n * @example\n * s(\"bd,hh*2,<~ sd>\").fast(2).cutoff(2000).resonance(\"<0 .2 .4 .6>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 282, + "lineno": 291, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -612,7 +612,7 @@ "comment": "/**\n * Set detune of oscillators. Works only with some synths, see tidal doc\n *\n * @name djf\n * @param {number | Pattern} cutoff below 0.5 is low pass filter, above is high pass filter\n * @example\n * n(\"0 3 7 [10,24]\").s('superzow').octave(3).djf(\"<.5 .25 .5 .75>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 293, + "lineno": 302, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -644,7 +644,7 @@ "comment": "/**\n * Set detune of oscillators. Works only with some synths, see tidal doc\n *\n * @name detune\n * @param {number | Pattern} amount between 0 and 1\n * @example\n * n(\"0 3 7\").s('superzow').octave(3).detune(\"<0 .25 .5 1 2>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 331, + "lineno": 340, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -676,7 +676,7 @@ "comment": "/**\n * Set dryness of reverb. See {@link room} and {@link size} for more information about reverb.\n *\n * @name dry\n * @param {number | Pattern} dry 0 = wet, 1 = dry\n * @example\n * n(\"[0,3,7](3,8)\").s(\"superpiano\").room(.7).dry(\"<0 .5 .75 1>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 341, + "lineno": 350, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -708,7 +708,7 @@ "comment": "/**\n * Set frequency of sound.\n *\n * @name freq\n * @param {number | Pattern} frequency in Hz. the audible range is between 20 and 20000 Hz\n * @example\n * freq(\"220 110 440 110\").s(\"superzow\").osc()\n * @example\n * freq(\"110\".mulOut(\".5 1.5 .6 [2 3]\")).s(\"superzow\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 376, + "lineno": 385, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -738,10 +738,10 @@ "___s": true }, { - "comment": "/**\n * Emulation of a Leslie speaker: speakers rotating in a wooden amplified cabinet.\n *\n * @name leslie\n * @param {number | Pattern} dry between 0 and 1\n * @example\n * n(\"0,4,7\").s(\"supersquare\").leslie(\"<0 .4 .6 1>\").osc()\n *\n */", + "comment": "/**\n * Emulation of a Leslie speaker: speakers rotating in a wooden amplified cabinet.\n *\n * @name leslie\n * @param {number | Pattern} wet between 0 and 1\n * @example\n * n(\"0,4,7\").s(\"supersquare\").leslie(\"<0 .4 .6 1>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 399, + "lineno": 408, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -757,7 +757,7 @@ ] }, "description": "

      between 0 and 1

      ", - "name": "dry" + "name": "wet" } ], "examples": [ @@ -773,7 +773,7 @@ "comment": "/**\n * Rate of modulation / rotation for leslie effect\n *\n * @name lrate\n * @param {number | Pattern} rate 6.7 for fast, 0.7 for slow\n * @example\n * n(\"0,4,7\").s(\"supersquare\").leslie(1).lrate(\"<1 2 4 8>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 409, + "lineno": 418, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -805,7 +805,7 @@ "comment": "/**\n * Physical size of the cabinet in meters. Be careful, it might be slightly larger than your computer. Affects the Doppler amount (pitch warble)\n *\n * @name lsize\n * @param {number | Pattern} meters somewhere between 0 and 1\n * @example\n * n(\"0,4,7\").s(\"supersquare\").leslie(1).lrate(2).lsize(\"<.1 .5 1>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 420, + "lineno": 429, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -837,7 +837,7 @@ "comment": "/**\n * Sets the default octave of a synth.\n *\n * @name octave\n * @param {number | Pattern} octave octave number\n * @example\n * n(\"0,4,7\").s('supersquare').octave(\"<3 4 5 6>\").osc()\n */", "meta": { "filename": "controls.mjs", - "lineno": 455, + "lineno": 464, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -869,7 +869,7 @@ "comment": "/**\n * a pattern of numbers. An `orbit` is a global parameter context for patterns. Patterns with the same orbit will share hardware output bus offset and global effects, e.g. reverb and delay. The maximum number of orbits is specified in the superdirt startup, numbers higher than maximum will wrap around.\n *\n * @name orbit\n * @param {number | Pattern} number\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 467, + "lineno": 476, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -897,7 +897,7 @@ "comment": "/**\n * Sets position in stereo.\n *\n * @name pan\n * @param {number | Pattern} pan between 0 and 1, from left to right (assuming stereo), once round a circle (assuming multichannel)\n * @example\n * s(\"[bd hh]*2\").pan(\"<.5 1 .5 0>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 481, + "lineno": 490, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -929,7 +929,7 @@ "comment": "/**\n * Sets the level of reverb.\n *\n * @name room\n * @param {number | Pattern} level between 0 and 1\n * @example\n * s(\"bd sd\").room(\"<0 .2 .4 .6 .8 1>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 548, + "lineno": 557, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -961,7 +961,7 @@ "comment": "/**\n * Sets the room size of the reverb, see {@link room}.\n *\n * @name size\n * @param {number | Pattern} size between 0 and 1\n * @example\n * s(\"bd sd\").room(.8).size(\"<0 .2 .4 .6 .8 1>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 558, + "lineno": 567, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -993,7 +993,7 @@ "comment": "/**\n * Wave shaping distortion. CAUTION: it might get loud\n *\n * @name shape\n * @param {number | Pattern} distortion between 0 and 1\n * @example\n * s(\"bd sd\").shape(\"<0 .2 .4 .6 .8 1>\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 576, + "lineno": 588, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -1025,7 +1025,7 @@ "comment": "/**\n * Changes the speed of sample playback, i.e. a cheap way of changing pitch.\n *\n * @name speed\n * @param {number | Pattern} speed -inf to inf, negative numbers play the sample backwards.\n * @example\n * s(\"bd\").speed(\"<1 2 4 1 -2 -4>\").osc()\n * @example\n * speed(\"1 1.5*2 [2 1.1]\").s(\"sax\").cut(1).osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 590, + "lineno": 602, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -1058,7 +1058,7 @@ "comment": "/**\n * Used in conjunction with {@link speed}, accepts values of \"r\" (rate, default behavior), \"c\" (cycles), or \"s\" (seconds). Using `unit \"c\"` means `speed` will be interpreted in units of cycles, e.g. `speed \"1\"` means samples will be stretched to fill a cycle. Using `unit \"s\"` means the playback speed will be adjusted so that the duration is the number of seconds specified by `speed`.\n *\n * @name unit\n * @param {number | string | Pattern} unit see description above\n * @example\n * speed(\"1 2 .5 3\").s(\"bd\").unit(\"c\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 606, + "lineno": 618, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -1091,7 +1091,7 @@ "comment": "/**\n * Made by Calum Gunn. Reminiscent of some weird mixture of filter, ring-modulator and pitch-shifter. The SuperCollider manual defines Squiz as:\n *\n * \"A simplistic pitch-raising algorithm. It's not meant to sound natural; its sound is reminiscent of some weird mixture of filter, ring-modulator and pitch-shifter, depending on the input. The algorithm works by cutting the signal into fragments (delimited by upwards-going zero-crossings) and squeezing those fragments in the time domain (i.e. simply playing them back faster than they came in), leaving silences inbetween. All the parameters apart from memlen can be modulated.\"\n *\n * @name squiz\n * @param {number | Pattern} squiz Try passing multiples of 2 to it - 2, 4, 8 etc.\n * @example\n * squiz(\"2 4/2 6 [8 16]\").s(\"bd\").osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 620, + "lineno": 632, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -1123,7 +1123,7 @@ "comment": "/**\n *\n * Formant filter to make things sound like vowels.\n *\n * @name vowel\n * @param {string | Pattern} vowel You can use a e i o u. Use a rest (~) to override the effect\n * @example\n * vowel(\"a e i [o u]\").slow(2)\n * .n(\"<[0,7]!4 [2,7]!4>\")\n * .s('supersquare').osc()\n *\n */", "meta": { "filename": "controls.mjs", - "lineno": 639, + "lineno": 651, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -1151,38 +1151,6 @@ "___id": "T000002R000039", "___s": true }, - { - "comment": "/**\n *\n * Tremolo Audio DSP effect\n *\n * @name tremolodepth\n * @param {number | Pattern} depth between 0 and 1\n * @example\n * n(\"[0,4,7]\").tremolodepth(\"<0 .3 .6 .9>\").osc()\n *\n */", - "meta": { - "filename": "controls.mjs", - "lineno": 672, - "columnno": 2, - "path": "/home/felix/projects/strudel/packages/core", - "code": {} - }, - "description": "

      Tremolo Audio DSP effect

      ", - "name": "tremolodepth", - "params": [ - { - "type": { - "names": [ - "number", - "Pattern" - ] - }, - "description": "

      between 0 and 1

      ", - "name": "depth" - } - ], - "examples": [ - "n(\"[0,4,7]\").tremolodepth(\"<0 .3 .6 .9>\").osc()" - ], - "longname": "tremolodepth", - "kind": "member", - "scope": "global", - "___id": "T000002R000040", - "___s": true - }, { "comment": "/**\n * Intended for a debugging, drawLine renders the pattern as a string, where each character represents the same time span.\n * Should only be used with single characters as values, otherwise the character slots will be messed up.\n * Character legend:\n *\n * - \"|\" cycle separator\n * - \"-\" hold previous value\n * - \".\" silence\n *\n * @param {Pattern} pattern the pattern to use\n * @param {number} chars max number of characters (approximately)\n * @returns string\n * @example\n * const line = drawLine(\"0 [1 2 3]\", 10); // |0--123|0--123\n * console.log(line);\n */", "meta": { @@ -1252,7 +1220,7 @@ "longname": "drawLine", "kind": "function", "scope": "global", - "___id": "T000002R000047", + "___id": "T000002R000046", "___s": true }, { @@ -1341,7 +1309,7 @@ "longname": "Pattern#euclid", "kind": "function", "scope": "instance", - "___id": "T000002R000071", + "___id": "T000002R000070", "___s": true }, { @@ -1378,7 +1346,7 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000072", + "___id": "T000002R000071", "___s": true }, { @@ -1386,7 +1354,7 @@ "meta": { "range": [ 1178, - 31003 + 31622 ], "filename": "pattern.mjs", "lineno": 17, @@ -1403,7 +1371,7 @@ "kind": "class", "classdesc": "

      Class representing a pattern.

      ", "scope": "global", - "description": "

      Create a pattern.

      ", + "description": "

      Create a pattern. As an end user, you will most likely not create a Pattern directly.

      ", "memberof": "Pattern", "params": [ { @@ -1412,22 +1380,22 @@ "function" ] }, - "description": "

      The function that maps a State to Haps .

      ", + "description": "

      The function that maps a {@link State} to an array of {@link Hap}.

      ", "name": "query" } ], - "___id": "T000002R000532", + "___id": "T000002R000531", "___s": true }, { "comment": "/**\n * query haps insude the tiven time span\n *\n * @param {Fraction | number} begin from time\n * @param {Fraction | number} end to time\n * @returns Hap[]\n * @example\n * const pattern = sequence('a', ['b', 'c']);\n * const haps = pattern.queryArc(0, 1);\n */", "meta": { "range": [ - 1638, - 1724 + 1737, + 1823 ], "filename": "pattern.mjs", - "lineno": 36, + "lineno": 37, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -1479,18 +1447,18 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000534", + "___id": "T000002R000533", "___s": true }, { "comment": "/**\n * Returns a new pattern, with queries split at cycle boundaries. This makes\n * some calculations easier to express, as all haps are then constrained to\n * happen within a cycle.\n * @returns Pattern\n */", "meta": { "range": [ - 1947, - 2148 + 2046, + 2247 ], "filename": "pattern.mjs", - "lineno": 46, + "lineno": 47, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -1515,18 +1483,18 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000535", + "___id": "T000002R000534", "___s": true }, { "comment": "/**\n * Returns a new pattern, where the given function is applied to the query\n * timespan before passing it to the original pattern.\n * @param {Function} func the function to apply\n * @returns Pattern\n */", "meta": { "range": [ - 2370, - 2464 + 2469, + 2563 ], "filename": "pattern.mjs", - "lineno": 60, + "lineno": 61, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -1563,18 +1531,18 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000538", + "___id": "T000002R000537", "___s": true }, { "comment": "/**\n * As with {@link Pattern#withQuerySpan}, but the function is applied to both the\n * begin and end time of the query timespan.\n * @param {Function} func the function to apply\n * @returns Pattern\n */", "meta": { "range": [ - 2683, - 2802 + 2782, + 2901 ], "filename": "pattern.mjs", - "lineno": 70, + "lineno": 71, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -1611,18 +1579,18 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000539", + "___id": "T000002R000538", "___s": true }, { "comment": "/**\n * Similar to {@link Pattern#withQuerySpan}, but the function is applied to the timespans\n * of all haps returned by pattern queries (both `part` timespans, and where\n * present, `whole` timespans).\n * @param {Function} func\n * @returns Pattern\n */", "meta": { "range": [ - 3073, - 3183 + 3172, + 3282 ], "filename": "pattern.mjs", - "lineno": 81, + "lineno": 82, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -1658,18 +1626,18 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000540", + "___id": "T000002R000539", "___s": true }, { "comment": "/**\n * As with {@link Pattern#withHapSpan}, but the function is applied to both the\n * begin and end time of the hap timespans.\n * @param {Function} func the function to apply\n * @returns Pattern\n */", "meta": { "range": [ - 3399, - 3482 + 3498, + 3581 ], "filename": "pattern.mjs", - "lineno": 91, + "lineno": 92, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -1706,18 +1674,18 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000541", + "___id": "T000002R000540", "___s": true }, { "comment": "/**\n * Returns a new pattern with the given function applied to the list of haps returned by every query.\n * @param {Function} func\n * @returns Pattern\n */", "meta": { "range": [ - 3652, - 3733 + 3751, + 3832 ], "filename": "pattern.mjs", - "lineno": 100, + "lineno": 101, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -1753,18 +1721,18 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000542", + "___id": "T000002R000541", "___s": true }, { "comment": "/**\n * As with {@link Pattern#_withHaps}, but applies the function to every hap, rather than every list of haps.\n * @param {Function} func\n * @returns Pattern\n */", "meta": { "range": [ - 3910, - 3983 + 4009, + 4082 ], "filename": "pattern.mjs", - "lineno": 109, + "lineno": 110, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -1800,18 +1768,18 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000543", + "___id": "T000002R000542", "___s": true }, { "comment": "/**\n * Returns a new pattern with the context field set to every hap set to the given value.\n * @param {*} context\n * @returns Pattern\n */", "meta": { "range": [ - 4136, - 4222 + 4235, + 4321 ], "filename": "pattern.mjs", - "lineno": 118, + "lineno": 119, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -1847,18 +1815,18 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000544", + "___id": "T000002R000543", "___s": true }, { "comment": "/**\n * Returns a new pattern with the given function applied to the context field of every hap.\n * @param {Function} func\n * @returns Pattern\n */", "meta": { "range": [ - 4382, - 4476 + 4481, + 4575 ], "filename": "pattern.mjs", - "lineno": 127, + "lineno": 128, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -1894,18 +1862,18 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000545", + "___id": "T000002R000544", "___s": true }, { "comment": "/**\n * Returns a new pattern with the context field of every hap set to an empty object.\n * @returns Pattern\n */", "meta": { "range": [ - 4601, - 4677 + 4700, + 4776 ], "filename": "pattern.mjs", - "lineno": 135, + "lineno": 136, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -1930,18 +1898,18 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000546", + "___id": "T000002R000545", "___s": true }, { "comment": "/**\n * Returns a new pattern with the given location information added to the\n * context of every hap.\n * @param {Number} start\n * @param {Number} end\n * @returns Pattern\n */", "meta": { "range": [ - 4870, - 5222 + 4969, + 5321 ], "filename": "pattern.mjs", - "lineno": 146, + "lineno": 147, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -1986,18 +1954,18 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000547", + "___id": "T000002R000546", "___s": true }, { "comment": "/**\n * Returns a new pattern, with the function applied to the value of\n * each hap. It has the alias {@link Pattern#fmap}.\n * @param {Function} func\n * @returns Pattern\n */", "meta": { "range": [ - 6237, - 6346 + 6336, + 6445 ], "filename": "pattern.mjs", - "lineno": 189, + "lineno": 190, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -2033,18 +2001,18 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000581", + "___id": "T000002R000580", "___s": true }, { "comment": "/**\n * see {@link Pattern#withValue}\n */", "meta": { "range": [ - 6397, - 6446 + 6496, + 6545 ], "filename": "pattern.mjs", - "lineno": 196, + "lineno": 197, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -2066,18 +2034,18 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000582", + "___id": "T000002R000581", "___s": true }, { "comment": "/**\n * Returns a new Pattern, which only returns haps that meet the given test.\n * @param {Function} hap_test - a function which returns false for haps to be removed from the pattern\n * @returns Pattern\n */", "meta": { "range": [ - 6667, - 6765 + 6766, + 6864 ], "filename": "pattern.mjs", - "lineno": 205, + "lineno": 206, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -2114,18 +2082,18 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000583", + "___id": "T000002R000582", "___s": true }, { "comment": "/**\n * As with {@link Pattern#_filterHaps}, but the function is applied to values\n * inside haps.\n * @param {Function} value_test\n * @returns Pattern\n */", "meta": { "range": [ - 6935, - 7059 + 7034, + 7158 ], "filename": "pattern.mjs", - "lineno": 215, + "lineno": 216, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -2161,18 +2129,18 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000584", + "___id": "T000002R000583", "___s": true }, { "comment": "/**\n * Returns a new pattern, with haps containing undefined values removed from\n * query results.\n * @returns Pattern\n */", "meta": { "range": [ - 7196, - 7279 + 7295, + 7378 ], "filename": "pattern.mjs", - "lineno": 224, + "lineno": 225, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -2197,18 +2165,18 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000585", + "___id": "T000002R000584", "___s": true }, { "comment": "/**\n * Returns a new pattern, with all haps without onsets filtered out. A hap\n * with an onset is one with a `whole` timespan that begins at the same time\n * as its `part` timespan.\n * @returns Pattern\n */", "meta": { "range": [ - 7502, - 7768 + 7601, + 7867 ], "filename": "pattern.mjs", - "lineno": 234, + "lineno": 235, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -2233,18 +2201,18 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000586", + "___id": "T000002R000585", "___s": true }, { "comment": "/**\n * Returns a new pattern, with 'continuous' haps (those without 'whole'\n * timespans) removed from query results.\n * @returns Pattern\n */", "meta": { "range": [ - 7924, - 8059 + 8023, + 8158 ], "filename": "pattern.mjs", - "lineno": 246, + "lineno": 247, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -2269,18 +2237,18 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000587", + "___id": "T000002R000586", "___s": true }, { "comment": "/**\n * When this method is called on a pattern of functions, it matches its haps\n * with those in the given pattern of values. A new pattern is returned, with\n * each matching value applied to the corresponding function.\n *\n * In this `appBoth` variant, where timespans of the function and value haps\n * are not the same but do intersect, the resulting hap has a timespan of the\n * intersection. This applies to both the part and the whole timespan.\n * @param {Pattern} pat_val\n * @returns Pattern\n */", "meta": { "range": [ - 9502, - 9783 + 9601, + 9882 ], "filename": "pattern.mjs", - "lineno": 289, + "lineno": 290, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -2316,18 +2284,18 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000595", + "___id": "T000002R000594", "___s": true }, { "comment": "/**\n * As with {@link Pattern#appBoth}, but the `whole` timespan is not the intersection,\n * but the timespan from the function of patterns that this method is called\n * on. In practice, this means that the pattern structure, including onsets,\n * are preserved from the pattern of functions (often referred to as the left\n * hand or inner pattern).\n * @param {Pattern} pat_val\n * @returns Pattern\n */", "meta": { "range": [ - 10206, - 10950 + 10305, + 11049 ], "filename": "pattern.mjs", - "lineno": 309, + "lineno": 310, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -2363,18 +2331,18 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000597", + "___id": "T000002R000596", "___s": true }, { "comment": "/**\n * As with {@link Pattern#appLeft}, but `whole` timespans are instead taken from the\n * pattern of values, i.e. structure is preserved from the right hand/outer\n * pattern.\n * @param {Pattern} pat_val\n * @returns Pattern\n */", "meta": { "range": [ - 11197, - 11942 + 11296, + 12041 ], "filename": "pattern.mjs", - "lineno": 339, + "lineno": 340, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -2410,18 +2378,18 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000609", + "___id": "T000002R000608", "___s": true }, { "comment": "/**\n * Queries the pattern for the first cycle, returning Haps. Mainly of use when\n * debugging a pattern.\n * @param {Boolean} with_context - set to true, otherwise the context field\n * will be stripped from the resulting haps.\n * @returns [Hap]\n */", "meta": { "range": [ - 12210, - 12409 + 12309, + 12508 ], "filename": "pattern.mjs", - "lineno": 369, + "lineno": 370, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -2459,18 +2427,18 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000621", + "___id": "T000002R000620", "___s": true }, { "comment": "/**\n * Accessor for a list of values returned by querying the first cycle.\n */", "meta": { "range": [ - 12498, - 12581 + 12597, + 12680 ], "filename": "pattern.mjs", - "lineno": 380, + "lineno": 381, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -2490,18 +2458,18 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000624", + "___id": "T000002R000623", "___s": true }, { "comment": "/**\n * More human-readable version of the {@link Pattern#_firstCycleValues} accessor.\n */", "meta": { "range": [ - 12681, - 12845 + 12780, + 12944 ], "filename": "pattern.mjs", - "lineno": 387, + "lineno": 388, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -2521,18 +2489,18 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000625", + "___id": "T000002R000624", "___s": true }, { "comment": "/**\n * Returns a new pattern, which returns haps sorted in temporal order. Mainly\n * of use when comparing two patterns for equality, in tests.\n * @returns Pattern\n */", "meta": { "range": [ - 13027, - 13302 + 13126, + 13401 ], "filename": "pattern.mjs", - "lineno": 398, + "lineno": 399, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -2557,18 +2525,18 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000626", + "___id": "T000002R000625", "___s": true }, { "comment": "/**\n * Assumes a numerical pattern. Returns a new pattern with all values rounded\n * to the nearest integer.\n * @returns Pattern\n */", "meta": { "range": [ - 15210, - 15279 + 15309, + 15378 ], "filename": "pattern.mjs", - "lineno": 471, + "lineno": 472, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -2593,18 +2561,18 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000645", + "___id": "T000002R000644", "___s": true }, { "comment": "/**\n * Assumes a numerical pattern. Returns a new pattern with all values set to\n * their mathematical floor. E.g. `3.7` replaced with to `3`, and `-4.2`\n * replaced with `-5`.\n * @returns Pattern\n */", "meta": { "range": [ - 15496, - 15565 + 15595, + 15664 ], "filename": "pattern.mjs", - "lineno": 481, + "lineno": 482, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -2629,18 +2597,18 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000646", + "___id": "T000002R000645", "___s": true }, { "comment": "/**\n * Assumes a numerical pattern. Returns a new pattern with all values set to\n * their mathematical ceiling. E.g. `3.2` replaced with `4`, and `-4.2`\n * replaced with `-4`.\n * @returns Pattern\n */", "meta": { "range": [ - 15781, - 15848 + 15880, + 15947 ], "filename": "pattern.mjs", - "lineno": 491, + "lineno": 492, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -2665,18 +2633,18 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000647", + "___id": "T000002R000646", "___s": true }, { "comment": "/**\n * Assumes a numerical pattern, containing unipolar values in the range 0 ..\n * 1. Returns a new pattern with values scaled to the bipolar range -1 .. 1\n * @returns Pattern\n */", "meta": { "range": [ - 16043, - 16101 + 16142, + 16200 ], "filename": "pattern.mjs", - "lineno": 500, + "lineno": 501, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -2701,18 +2669,18 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000648", + "___id": "T000002R000647", "___s": true }, { "comment": "/**\n * Assumes a numerical pattern, containing bipolar values in the range -1 ..\n * 1. Returns a new pattern with values scaled to the unipolar range 0 .. 1\n * @returns Pattern\n */", "meta": { "range": [ - 16296, - 16358 + 16395, + 16457 ], "filename": "pattern.mjs", - "lineno": 509, + "lineno": 510, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -2737,18 +2705,18 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000649", + "___id": "T000002R000648", "___s": true }, { "comment": "/**\n * Assumes a numerical pattern, containing unipolar values in the range 0 ..\n * 1. Returns a new pattern with values scaled to the given min/max range.\n * @param {Number} min\n * @param {Number} max\n * @returns Pattern\n */", "meta": { "range": [ - 16602, - 16664 + 16701, + 16763 ], "filename": "pattern.mjs", - "lineno": 520, + "lineno": 521, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -2793,18 +2761,18 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000650", + "___id": "T000002R000649", "___s": true }, { "comment": "/**\n * Assumes a numerical pattern, containing unipolar values in the range 0 ..\n * 1. Returns a new pattern with values scaled to the given min/max range,\n * following an exponential curve.\n * @param {Number} min\n * @param {Number} max\n * @returns Pattern\n */", "meta": { "range": [ - 16945, - 17035 + 17044, + 17134 ], "filename": "pattern.mjs", - "lineno": 532, + "lineno": 533, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -2849,18 +2817,18 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000651", + "___id": "T000002R000650", "___s": true }, { "comment": "/**\n * Assumes a numerical pattern, containing bipolar values in the range -1 ..\n * 1. Returns a new pattern with values scaled to the given min/max range.\n * @param {Number} min\n * @param {Number} max\n * @returns Pattern\n */", "meta": { "range": [ - 17279, - 17349 + 17378, + 17448 ], "filename": "pattern.mjs", - "lineno": 543, + "lineno": 544, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -2905,18 +2873,94 @@ "kind": "function", "memberof": "Pattern", "scope": "instance", - "___id": "T000002R000652", + "___id": "T000002R000651", + "___s": true + }, + { + "comment": "/**\n * Speed up a pattern by the given factor.\n *\n * @name fast\n * @memberof Pattern\n * @param {number | Pattern} factor speed up factor\n * @returns Pattern\n * @example\n * seq(e5, b4, d5, c5).fast(2)\n */", + "meta": { + "filename": "pattern.mjs", + "lineno": 735, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": {} + }, + "description": "

      Speed up a pattern by the given factor.

      ", + "name": "fast", + "memberof": "Pattern", + "params": [ + { + "type": { + "names": [ + "number", + "Pattern" + ] + }, + "description": "

      speed up factor

      ", + "name": "factor" + } + ], + "returns": [ + { + "description": "

      Pattern

      " + } + ], + "examples": [ + "seq(e5, b4, d5, c5).fast(2)" + ], + "scope": "static", + "longname": "Pattern.fast", + "kind": "member", + "___id": "T000002R000700", + "___s": true + }, + { + "comment": "/**\n * Slow down a pattern over the given number of cycles.\n *\n * @name slow\n * @memberof Pattern\n * @param {number | Pattern} factor slow down factor\n * @returns Pattern\n * @example\n * seq(e5, b4, d5, c5).slow(2)\n */", + "meta": { + "filename": "pattern.mjs", + "lineno": 750, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": {} + }, + "description": "

      Slow down a pattern over the given number of cycles.

      ", + "name": "slow", + "memberof": "Pattern", + "params": [ + { + "type": { + "names": [ + "number", + "Pattern" + ] + }, + "description": "

      slow down factor

      ", + "name": "factor" + } + ], + "returns": [ + { + "description": "

      Pattern

      " + } + ], + "examples": [ + "seq(e5, b4, d5, c5).slow(2)" + ], + "scope": "static", + "longname": "Pattern.slow", + "kind": "member", + "___id": "T000002R000703", "___s": true }, { "comment": "/**\n * Returns a new pattern where every other cycle is played once, twice as\n * fast, and offset in time by one quarter of a cycle. Creates a kind of\n * breakbeat feel.\n * @returns Pattern\n */", "meta": { "range": [ - 27227, - 27323 + 27788, + 27884 ], "filename": "pattern.mjs", - "lineno": 883, + "lineno": 904, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -2941,18 +2985,18 @@ "memberof": "Pattern", "scope": "instance", "params": [], - "___id": "T000002R000749", + "___id": "T000002R000750", "___s": true }, { "comment": "/** A discrete value that repeats once per cycle:\n *\n * @param {any} value - The value to repeat\n * @returns {Pattern}\n * @example\n * pure('e4')\n */", "meta": { "range": [ - 35084, - 35288 + 35703, + 35907 ], "filename": "pattern.mjs", - "lineno": 1181, + "lineno": 1203, "columnno": 0, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -2992,18 +3036,18 @@ "longname": "pure", "kind": "function", "scope": "global", - "___id": "T000002R000867", + "___id": "T000002R000868", "___s": true }, { "comment": "/** The given items are played at the same time at the same length:\n *\n * @param {...any} items - The items to stack\n * @return {Pattern}\n * @example\n * stack(g3, b3, [e4, d4])\n */", "meta": { "range": [ - 35801, - 36074 + 36420, + 36693 ], "filename": "pattern.mjs", - "lineno": 1208, + "lineno": 1230, "columnno": 0, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -3044,18 +3088,18 @@ "longname": "stack", "kind": "function", "scope": "global", - "___id": "T000002R000874", + "___id": "T000002R000875", "___s": true }, { "comment": "/** Concatenation: combines a list of patterns, switching between them successively, one per cycle:\n *\n * synonyms: {@link cat}\n *\n * @param {...any} items - The items to concatenate\n * @return {Pattern}\n * @example\n * slowcat(e5, b4, [d5, c5])\n *\n */", "meta": { "range": [ - 36328, - 37239 + 36947, + 37858 ], "filename": "pattern.mjs", - "lineno": 1225, + "lineno": 1247, "columnno": 0, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -3096,18 +3140,18 @@ "longname": "slowcat", "kind": "function", "scope": "global", - "___id": "T000002R000878", + "___id": "T000002R000879", "___s": true }, { "comment": "/** Concatenation: combines a list of patterns, switching between them successively, one per cycle. Unlike slowcat, this version will skip cycles.\n * @param {...any} items - The items to concatenate\n * @return {Pattern}\n */", "meta": { "range": [ - 37465, - 37737 + 38084, + 38356 ], "filename": "pattern.mjs", - "lineno": 1250, + "lineno": 1272, "columnno": 0, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -3145,18 +3189,18 @@ "longname": "slowcatPrime", "kind": "function", "scope": "global", - "___id": "T000002R000886", + "___id": "T000002R000887", "___s": true }, { - "comment": "/** Concatenation: as with {@link slowcat}, but squashes a cycle from each pattern into one cycle\n *\n * Synonyms: {@link seq}, {@link sequence}\n *\n * @param {...any} items - The items to concatenate\n * @return {Pattern}\n * @example\n * fastcat(e5, b4, [d5, c5])\n * sequence(e5, b4, [d5, c5])\n * seq(e5, b4, [d5, c5])\n */", + "comment": "/** Concatenation: as with {@link slowcat}, but squashes a cycle from each pattern into one cycle\n *\n * Synonyms: {@link seq}, {@link sequence}\n *\n * @param {...any} items - The items to concatenate\n * @return {Pattern}\n * @example\n * fastcat(e5, b4, [d5, c5])\n * // sequence(e5, b4, [d5, c5])\n * // seq(e5, b4, [d5, c5])\n */", "meta": { "range": [ - 38059, - 38141 + 38684, + 38766 ], "filename": "pattern.mjs", - "lineno": 1271, + "lineno": 1293, "columnno": 0, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -3191,24 +3235,24 @@ } ], "examples": [ - "fastcat(e5, b4, [d5, c5])\nsequence(e5, b4, [d5, c5])\nseq(e5, b4, [d5, c5])" + "fastcat(e5, b4, [d5, c5])\n// sequence(e5, b4, [d5, c5])\n// seq(e5, b4, [d5, c5])" ], "name": "fastcat", "longname": "fastcat", "kind": "function", "scope": "global", - "___id": "T000002R000892", + "___id": "T000002R000893", "___s": true }, { "comment": "/** See {@link slowcat} */", "meta": { "range": [ - 38170, - 38229 + 38795, + 38854 ], "filename": "pattern.mjs", - "lineno": 1276, + "lineno": 1298, "columnno": 0, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -3225,18 +3269,18 @@ "longname": "cat", "kind": "function", "scope": "global", - "___id": "T000002R000894", + "___id": "T000002R000895", "___s": true }, { "comment": "/** Like {@link fastcat}, but where each step has a temporal weight:\n * @param {...Array} items - The items to concatenate\n * @return {Pattern}\n * @example\n * timeCat([3,e3],[1, g3])\n */", "meta": { "range": [ - 38418, - 38777 + 39043, + 39402 ], "filename": "pattern.mjs", - "lineno": 1286, + "lineno": 1308, "columnno": 0, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -3277,18 +3321,18 @@ "longname": "timeCat", "kind": "function", "scope": "global", - "___id": "T000002R000896", + "___id": "T000002R000897", "___s": true }, { "comment": "/** See {@link fastcat} */", "meta": { "range": [ - 38806, - 38870 + 39431, + 39495 ], "filename": "pattern.mjs", - "lineno": 1299, + "lineno": 1321, "columnno": 0, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -3305,18 +3349,18 @@ "longname": "sequence", "kind": "function", "scope": "global", - "___id": "T000002R000903", + "___id": "T000002R000904", "___s": true }, { "comment": "/** See {@link fastcat} */", "meta": { "range": [ - 38899, - 38958 + 39524, + 39583 ], "filename": "pattern.mjs", - "lineno": 1304, + "lineno": 1326, "columnno": 0, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -3333,7 +3377,7 @@ "longname": "seq", "kind": "function", "scope": "global", - "___id": "T000002R000905", + "___id": "T000002R000906", "___s": true }, { @@ -3372,7 +3416,7 @@ "scope": "static", "longname": "Pattern.transpose", "kind": "member", - "___id": "T000002R003714", + "___id": "T000002R003715", "___s": true }, { @@ -3409,7 +3453,7 @@ "scope": "static", "longname": "Pattern.scaleTranspose", "kind": "member", - "___id": "T000002R003718", + "___id": "T000002R003719", "___s": true }, { @@ -3446,7 +3490,7 @@ "scope": "static", "longname": "Pattern.scale", "kind": "member", - "___id": "T000002R003720", + "___id": "T000002R003721", "___s": true }, { @@ -3483,7 +3527,7 @@ "scope": "static", "longname": "Pattern.voicings", "kind": "member", - "___id": "T000002R003745", + "___id": "T000002R003746", "___s": true }, { @@ -3565,7 +3609,7 @@ "/home/felix/projects/strudel/packages/xen/tunejs.js", "/home/felix/projects/strudel/packages/xen/xen.mjs" ], - "___id": "T000002R014014", + "___id": "T000002R014015", "___s": true } ] diff --git a/packages/core/pattern.mjs b/packages/core/pattern.mjs index 0ee73875..f6afb7df 100644 --- a/packages/core/pattern.mjs +++ b/packages/core/pattern.mjs @@ -16,8 +16,9 @@ import drawLine from './drawLine.mjs'; /** @class Class representing a pattern. */ export class Pattern { /** - * Create a pattern. - * @param {function} query - The function that maps a State to Haps . + * Create a pattern. As an end user, you will most likely not create a Pattern directly. + * + * @param {function} query - The function that maps a {@link State} to an array of {@link Hap}. */ constructor(query) { this.query = query; @@ -731,11 +732,31 @@ export class Pattern { return this._compress(span.begin, span.end); } + /** + * Speed up a pattern by the given factor. + * + * @name fast + * @memberof Pattern + * @param {number | Pattern} factor speed up factor + * @returns Pattern + * @example + * seq(e5, b4, d5, c5).fast(2) + */ _fast(factor) { const fastQuery = this.withQueryTime((t) => t.mul(factor)); return fastQuery.withHapTime((t) => t.div(factor)); } + /** + * Slow down a pattern over the given number of cycles. + * + * @name slow + * @memberof Pattern + * @param {number | Pattern} factor slow down factor + * @returns Pattern + * @example + * seq(e5, b4, d5, c5).slow(2) + */ _slow(factor) { return this._fast(Fraction(1).div(factor)); } @@ -1022,6 +1043,7 @@ export class Pattern { return this._withContext((context) => ({ ...context, velocity: (context.velocity || 1) * velocity })); } + // move this to controls? (speed and unit are controls) _loopAt(factor, cps = 1) { return this.speed((1 / factor) * cps) .unit('c') @@ -1265,8 +1287,8 @@ export function slowcatPrime(...pats) { * @return {Pattern} * @example * fastcat(e5, b4, [d5, c5]) - * sequence(e5, b4, [d5, c5]) - * seq(e5, b4, [d5, c5]) + * // sequence(e5, b4, [d5, c5]) + * // seq(e5, b4, [d5, c5]) */ export function fastcat(...pats) { return slowcat(...pats)._fast(pats.length); diff --git a/tutorial/ApiDoc.jsx b/tutorial/ApiDoc.jsx index fa752818..ef9a35fb 100644 --- a/tutorial/ApiDoc.jsx +++ b/tutorial/ApiDoc.jsx @@ -8,7 +8,8 @@ function ApiDoc() { if (!visible) { return (

      - The API Docs are a work in progress, but you can preview it by clicking here + There remaining function documentation is a work in progress, but you can preview it by clicking{' '} + here. Beware that everything is not properly ordered from this point.

      ); } @@ -16,8 +17,8 @@ function ApiDoc() { return (

      - The following Chapter is the technical API documentation. It is autogenerated from the jsdoc comments in the - source files. hide + The following Chapter is autogenerated from the jsdoc comments in the source files.{' '} + hide. Beware that everything is not properly ordered from this point.

      {docs .filter((item) => !item.name?.startsWith('_') && item.kind !== 'package') diff --git a/tutorial/Tutorial.jsx b/tutorial/Tutorial.jsx index 2e77a327..d6ef86ab 100644 --- a/tutorial/Tutorial.jsx +++ b/tutorial/Tutorial.jsx @@ -7,6 +7,8 @@ This program is free software: you can redistribute it and/or modify it under th import React from 'react'; import ReactDOM from 'react-dom'; import Tutorial from './tutorial.mdx'; +import ApiDoc from './ApiDoc' +import Api from './api.mdx'; import './style.scss'; import '@strudel.cycles/react/dist/style.css'; @@ -30,6 +32,8 @@ ReactDOM.render(
      + +
      , diff --git a/tutorial/api.mdx b/tutorial/api.mdx new file mode 100644 index 00000000..09888480 --- /dev/null +++ b/tutorial/api.mdx @@ -0,0 +1,123 @@ +import { MiniRepl } from './MiniRepl'; + +The following is generated from the source documentation. + +## TOC + +## Pattern Factories + +The following functions will return a pattern. We will see later what that means. + +### pure + +

      A discrete value that repeats once per cycle:

      + +**Parameters** + +- value (any): The value to repeat + +**Examples** + +
      + +
      + +### slowcat + +

      Concatenation: combines a list of patterns, switching between them successively, one per cycle:

      +

      synonyms: cat

      + +**Parameters** + +- items (any): The items to concatenate + +**Examples** + +
      + +
      + +### fastcat + +

      Concatenation: as with slowcat, but squashes a cycle from each pattern into one cycle

      +

      Synonyms: seq, sequence

      + +**Parameters** + +- items (any): The items to concatenate + +**Examples** + +
      + +
      + +### stack + +

      The given items are played at the same time at the same length:

      + +**Parameters** + +- items (any): The items to stack + +**Examples** + +
      + +
      + +### timeCat + +

      Like fastcat, but where each step has a temporal weight:

      + +**Parameters** + +- items (Array): The items to concatenate + +**Examples** + +
      + +
      + + + +## Pattern Modifiers + +### Pattern.slow + +

      Slow down a pattern over the given number of cycles.

      + +**Parameters** + +- factor (number|Pattern): slow down factor + +**Examples** + +
      + +
      + +### Pattern.fast + +

      Speed up a pattern by the given factor.

      + +**Parameters** + +- factor (number|Pattern): speed up factor + +**Examples** + +
      + +
      + + + + + + + +## Everything Else diff --git a/tutorial/package-lock.json b/tutorial/package-lock.json index de2d597f..42f547fa 100644 --- a/tutorial/package-lock.json +++ b/tutorial/package-lock.json @@ -21,6 +21,7 @@ "autoprefixer": "^10.4.7", "install": "^0.13.0", "npm": "^8.10.0", + "nunjucks": "^3.2.3", "postcss": "^8.4.13", "rehype-autolink-headings": "^6.1.1", "rehype-slug": "^5.0.1", @@ -795,6 +796,12 @@ "semver": "bin/semver.js" } }, + "node_modules/a-sync-waterfall": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/a-sync-waterfall/-/a-sync-waterfall-1.0.1.tgz", + "integrity": "sha512-RYTOHHdWipFUliRFMCS4X2Yn2X8M87V/OpSqWzKKOGhzqyUxzyVmhHDH9sAvG+ZuQf/TAOFsLCpMw09I1ufUnA==", + "dev": true + }, "node_modules/acorn": { "version": "7.4.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", @@ -858,6 +865,12 @@ "integrity": "sha512-e0hDa9H2Z9AwFkk2qDlwhoMYE4eToKarchkQHovNdLTCYMHZHeRjI71crOh+dio4K6u1IcwubQqo79Ga4CyAQA==", "dev": true }, + "node_modules/asap": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", + "integrity": "sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==", + "dev": true + }, "node_modules/autoprefixer": { "version": "10.4.7", "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.7.tgz", @@ -1146,6 +1159,15 @@ "url": "https://github.com/sponsors/wooorm" } }, + "node_modules/commander": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-5.1.0.tgz", + "integrity": "sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==", + "dev": true, + "engines": { + "node": ">= 6" + } + }, "node_modules/convert-source-map": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.8.0.tgz", @@ -4825,6 +4847,31 @@ "inBundle": true, "license": "ISC" }, + "node_modules/nunjucks": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/nunjucks/-/nunjucks-3.2.3.tgz", + "integrity": "sha512-psb6xjLj47+fE76JdZwskvwG4MYsQKXUtMsPh6U0YMvmyjRtKRFcxnlXGWglNybtNTNVmGdp94K62/+NjF5FDQ==", + "dev": true, + "dependencies": { + "a-sync-waterfall": "^1.0.0", + "asap": "^2.0.3", + "commander": "^5.1.0" + }, + "bin": { + "nunjucks-precompile": "bin/precompile" + }, + "engines": { + "node": ">= 6.9.0" + }, + "peerDependencies": { + "chokidar": "^3.3.0" + }, + "peerDependenciesMeta": { + "chokidar": { + "optional": true + } + } + }, "node_modules/object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", @@ -6992,6 +7039,12 @@ } } }, + "a-sync-waterfall": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/a-sync-waterfall/-/a-sync-waterfall-1.0.1.tgz", + "integrity": "sha512-RYTOHHdWipFUliRFMCS4X2Yn2X8M87V/OpSqWzKKOGhzqyUxzyVmhHDH9sAvG+ZuQf/TAOFsLCpMw09I1ufUnA==", + "dev": true + }, "acorn": { "version": "7.4.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", @@ -7040,6 +7093,12 @@ "integrity": "sha512-e0hDa9H2Z9AwFkk2qDlwhoMYE4eToKarchkQHovNdLTCYMHZHeRjI71crOh+dio4K6u1IcwubQqo79Ga4CyAQA==", "dev": true }, + "asap": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", + "integrity": "sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==", + "dev": true + }, "autoprefixer": { "version": "10.4.7", "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.7.tgz", @@ -7224,6 +7283,12 @@ "integrity": "sha512-GHuDRO12Sypu2cV70d1dkA2EUmXHgntrzbpvOB+Qy+49ypNfGgFQIC2fhhXbnyrJRynDCAARsT7Ou0M6hirpfw==", "dev": true }, + "commander": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-5.1.0.tgz", + "integrity": "sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==", + "dev": true + }, "convert-source-map": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.8.0.tgz", @@ -9740,6 +9805,17 @@ } } }, + "nunjucks": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/nunjucks/-/nunjucks-3.2.3.tgz", + "integrity": "sha512-psb6xjLj47+fE76JdZwskvwG4MYsQKXUtMsPh6U0YMvmyjRtKRFcxnlXGWglNybtNTNVmGdp94K62/+NjF5FDQ==", + "dev": true, + "requires": { + "a-sync-waterfall": "^1.0.0", + "asap": "^2.0.3", + "commander": "^5.1.0" + } + }, "object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", diff --git a/tutorial/package.json b/tutorial/package.json index 0a5dd3d6..f2e31a12 100644 --- a/tutorial/package.json +++ b/tutorial/package.json @@ -7,7 +7,8 @@ "start": "vite", "build": "npm run jsdoc-json && vite build", "preview": "vite preview", - "jsdoc-json": "jsdoc ../packages/ --template ../node_modules/jsdoc-json --destination ../doc.json -c ../jsdoc.config.json" + "jsdoc-json": "jsdoc ../packages/ --template ../node_modules/jsdoc-json --destination ../doc.json -c ../jsdoc.config.json", + "render": "npm run jsdoc-json && node ./render.js > api.mdx" }, "type": "module", "dependencies": { @@ -24,6 +25,7 @@ "autoprefixer": "^10.4.7", "install": "^0.13.0", "npm": "^8.10.0", + "nunjucks": "^3.2.3", "postcss": "^8.4.13", "rehype-autolink-headings": "^6.1.1", "rehype-slug": "^5.0.1", diff --git a/tutorial/render.js b/tutorial/render.js new file mode 100644 index 00000000..7ac6f4a8 --- /dev/null +++ b/tutorial/render.js @@ -0,0 +1,49 @@ +import nunjucks from 'nunjucks'; +import jsdoc from '../doc.json' assert { type: 'json' }; + +// TODO: load tutorial.mdx and append rendered api.mdx to the bottom (to make sure TOC works) +// TODO: split + +const env = nunjucks.configure('templates', { autoescape: false }); + +const docs = jsdoc.docs.reduce((acc, obj) => Object.assign(acc, { [obj.longname]: obj }), {}); + +function renderAsMDX(name) { + const item = docs[name]; + if (!item) { + console.warn('Not found: ' + name); + return ''; + } + return `### ${item.longname} + +${item.description.replaceAll(/\{\@link ([a-zA-Z]+)?\#?([a-zA-Z]*)\}/g, (_, a, b) => { + // console.log(_, 'a', a, 'b', b); + return `${a}${b ? `#${b}` : ''}`; +})} + +${!!item.params?.length ? '**Parameters**' : ''} + +${ + item.params + ?.map( + (param, i) => + `- ${param.name} (${param.type?.names?.join('|')}): ${param.description?.replace(/(<([^>]+)>)/gi, '')}`, + ) + .join('\n') || '' +} + +${ + item.examples?.length + ? `**Examples** + +
      + ${item.examples?.map((example, k) => ``).join('\n\n')} +
      ` + : '' +}`; +} + +env.addFilter('jsdoc', renderAsMDX); + +const rendered = nunjucks.render('api.mdx', { docs }); +console.log(rendered); diff --git a/tutorial/templates/api.mdx b/tutorial/templates/api.mdx new file mode 100644 index 00000000..53dadf31 --- /dev/null +++ b/tutorial/templates/api.mdx @@ -0,0 +1,35 @@ +import { MiniRepl } from './MiniRepl'; + +The following is generated from the source documentation. + +## TOC + +## Pattern Factories + +The following functions will return a pattern. We will see later what that means. + +{{ 'pure' | jsdoc }} + +{{ 'slowcat' | jsdoc }} + +{{ 'fastcat' | jsdoc }} + +{{ 'stack' | jsdoc }} + +{{ 'timeCat' | jsdoc }} + +{{ 'polyrhythm' | jsdoc }} + +## Pattern Modifiers + +{{ 'Pattern.slow' | jsdoc }} + +{{ 'Pattern.fast' | jsdoc }} + +{{ 'Pattern.early' | jsdoc }} + +{{ 'Pattern.late' | jsdoc }} + +{{ 'Pattern.rev' | jsdoc }} + +## Everything Else \ No newline at end of file diff --git a/tutorial/tutorial.mdx b/tutorial/tutorial.mdx index 87ade218..0be316d3 100644 --- a/tutorial/tutorial.mdx +++ b/tutorial/tutorial.mdx @@ -694,11 +694,8 @@ If you want to contribute in another way, either - [Join the Discord Channel](https://discord.gg/remJ6gQA) - [play with the Strudel REPL](https://strudel.tidalcycles.org/) -import ApiDoc from './ApiDoc'; -

      # API Docs - From cad24714d4d98a44197076e787037a81e0d85a15 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Tue, 24 May 2022 20:37:29 +0200 Subject: [PATCH 21/26] use tutorial.mdx with nunjucks --- .gitignore | 3 +- doc.json | 2 +- tutorial/Tutorial.jsx | 8 ++- tutorial/api.mdx | 123 ------------------------------------------ tutorial/package.json | 6 +-- tutorial/render.js | 4 +- tutorial/tutorial.mdx | 119 ++++++++++++++++++++++++++++++++++++++++ 7 files changed, 130 insertions(+), 135 deletions(-) delete mode 100644 tutorial/api.mdx diff --git a/.gitignore b/.gitignore index 7fcf9d28..cbe4c324 100644 --- a/.gitignore +++ b/.gitignore @@ -30,4 +30,5 @@ mytunes.ts doc out .parcel-cache -repl_old \ No newline at end of file +repl_old +tutorial.rendered.mdx \ No newline at end of file diff --git a/doc.json b/doc.json index 53b3f510..e739c923 100644 --- a/doc.json +++ b/doc.json @@ -1,7 +1,7 @@ { "docs": [ { - "comment": "/**\n * Select a sound / sample by name.\n * \n *
      \n * show all sounds\n * \n * 808 (6) 808bd (25) 808cy (25) 808hc (5) 808ht (5) 808lc (5) 808lt (5) 808mc (5) 808mt (5) 808oh (5) 808sd (25) 909 (1) ab (12) ade (10) ades2 (9) ades3 (7) ades4 (6) alex (2) alphabet (26) amencutup (32) armora (7) arp (2) arpy (11) auto (11) baa (7) baa2 (7) bass (4) bass0 (3) bass1 (30) bass2 (5) bass3 (11) bassdm (24) bassfoo (3) battles (2) bd (24) bend (4) bev (2) bin (2) birds (10) birds3 (19) bleep (13) blip (2) blue (2) bottle (13) breaks125 (2) breaks152 (1) breaks157 (1) breaks165 (1) breath (1) bubble (8) can (14) casio (3) cb (1) cc (6) chin (4) circus (3) clak (2) click (4) clubkick (5) co (4) coins (1) control (2) cosmicg (15) cp (2) cr (6) crow (4) d (4) db (13) diphone (38) diphone2 (12) dist (16) dork2 (4) dorkbot (2) dr (42) dr2 (6) dr55 (4) dr_few (8) drum (6) drumtraks (13) e (8) east (9) electro1 (13) em2 (6) erk (1) f (1) feel (7) feelfx (8) fest (1) fire (1) flick (17) fm (17) foo (27) future (17) gab (10) gabba (4) gabbaloud (4) gabbalouder (4) glasstap (3) glitch (8) glitch2 (8) gretsch (24) gtr (3) h (7) hand (17) hardcore (12) hardkick (6) haw (6) hc (6) hh (13) hh27 (13) hit (6) hmm (1) ho (6) hoover (6) house (8) ht (16) if (5) ifdrums (3) incoming (8) industrial (32) insect (3) invaders (18) jazz (8) jungbass (20) jungle (13) juno (12) jvbass (13) kicklinn (1) koy (2) kurt (7) latibro (8) led (1) less (4) lighter (33) linnhats (6) lt (16) made (7) made2 (1) mash (2) mash2 (4) metal (10) miniyeah (4) monsterb (6) moog (7) mouth (15) mp3 (4) msg (9) mt (16) mute (28) newnotes (15) noise (1) noise2 (8) notes (15) numbers (9) oc (4) odx (15) off (1) outdoor (6) pad (3) padlong (1) pebbles (1) perc (6) peri (15) pluck (17) popkick (10) print (11) proc (2) procshort (8) psr (30) rave (8) rave2 (4) ravemono (2) realclaps (4) reverbkick (1) rm (2) rs (1) sax (22) sd (2) seawolf (3) sequential (8) sf (18) sheffield (1) short (5) sid (12) sine (6) sitar (8) sn (52) space (18) speakspell (12) speech (7) speechless (10) speedupdown (9) stab (23) stomp (10) subroc3d (11) sugar (2) sundance (6) tabla (26) tabla2 (46) tablex (3) tacscan (22) tech (13) techno (7) tink (5) tok (4) toys (13) trump (11) ul (10) ulgab (5) uxay (3) v (6) voodoo (5) wind (10) wobble (1) world (3) xmas (1) yeah (31)\n * \n * more info\n * \n *
      \n *\n * @name s\n * @param {string | Pattern} sound The sound / pattern of sounds to pick\n * @example\n * s(\"bd hh\").osc()\n *\n */", + "comment": "/**\n * Select a sound / sample by name.\n *\n *
      \n * show all sounds\n *\n * 808 (6) 808bd (25) 808cy (25) 808hc (5) 808ht (5) 808lc (5) 808lt (5) 808mc (5) 808mt (5) 808oh (5) 808sd (25) 909 (1) ab (12) ade (10) ades2 (9) ades3 (7) ades4 (6) alex (2) alphabet (26) amencutup (32) armora (7) arp (2) arpy (11) auto (11) baa (7) baa2 (7) bass (4) bass0 (3) bass1 (30) bass2 (5) bass3 (11) bassdm (24) bassfoo (3) battles (2) bd (24) bend (4) bev (2) bin (2) birds (10) birds3 (19) bleep (13) blip (2) blue (2) bottle (13) breaks125 (2) breaks152 (1) breaks157 (1) breaks165 (1) breath (1) bubble (8) can (14) casio (3) cb (1) cc (6) chin (4) circus (3) clak (2) click (4) clubkick (5) co (4) coins (1) control (2) cosmicg (15) cp (2) cr (6) crow (4) d (4) db (13) diphone (38) diphone2 (12) dist (16) dork2 (4) dorkbot (2) dr (42) dr2 (6) dr55 (4) dr_few (8) drum (6) drumtraks (13) e (8) east (9) electro1 (13) em2 (6) erk (1) f (1) feel (7) feelfx (8) fest (1) fire (1) flick (17) fm (17) foo (27) future (17) gab (10) gabba (4) gabbaloud (4) gabbalouder (4) glasstap (3) glitch (8) glitch2 (8) gretsch (24) gtr (3) h (7) hand (17) hardcore (12) hardkick (6) haw (6) hc (6) hh (13) hh27 (13) hit (6) hmm (1) ho (6) hoover (6) house (8) ht (16) if (5) ifdrums (3) incoming (8) industrial (32) insect (3) invaders (18) jazz (8) jungbass (20) jungle (13) juno (12) jvbass (13) kicklinn (1) koy (2) kurt (7) latibro (8) led (1) less (4) lighter (33) linnhats (6) lt (16) made (7) made2 (1) mash (2) mash2 (4) metal (10) miniyeah (4) monsterb (6) moog (7) mouth (15) mp3 (4) msg (9) mt (16) mute (28) newnotes (15) noise (1) noise2 (8) notes (15) numbers (9) oc (4) odx (15) off (1) outdoor (6) pad (3) padlong (1) pebbles (1) perc (6) peri (15) pluck (17) popkick (10) print (11) proc (2) procshort (8) psr (30) rave (8) rave2 (4) ravemono (2) realclaps (4) reverbkick (1) rm (2) rs (1) sax (22) sd (2) seawolf (3) sequential (8) sf (18) sheffield (1) short (5) sid (12) sine (6) sitar (8) sn (52) space (18) speakspell (12) speech (7) speechless (10) speedupdown (9) stab (23) stomp (10) subroc3d (11) sugar (2) sundance (6) tabla (26) tabla2 (46) tablex (3) tacscan (22) tech (13) techno (7) tink (5) tok (4) toys (13) trump (11) ul (10) ulgab (5) uxay (3) v (6) voodoo (5) wind (10) wobble (1) world (3) xmas (1) yeah (31)\n *\n * more info\n *\n *
      \n *\n * @name s\n * @param {string | Pattern} sound The sound / pattern of sounds to pick\n * @example\n * s(\"bd hh\").osc()\n *\n */", "meta": { "filename": "controls.mjs", "lineno": 11, diff --git a/tutorial/Tutorial.jsx b/tutorial/Tutorial.jsx index d6ef86ab..f41489a4 100644 --- a/tutorial/Tutorial.jsx +++ b/tutorial/Tutorial.jsx @@ -6,9 +6,8 @@ This program is free software: you can redistribute it and/or modify it under th import React from 'react'; import ReactDOM from 'react-dom'; -import Tutorial from './tutorial.mdx'; -import ApiDoc from './ApiDoc' -import Api from './api.mdx'; +import Tutorial from './tutorial.rendered.mdx'; +// import ApiDoc from './ApiDoc'; import './style.scss'; import '@strudel.cycles/react/dist/style.css'; @@ -32,8 +31,7 @@ ReactDOM.render(
      - - + {/* */}
      , diff --git a/tutorial/api.mdx b/tutorial/api.mdx deleted file mode 100644 index 09888480..00000000 --- a/tutorial/api.mdx +++ /dev/null @@ -1,123 +0,0 @@ -import { MiniRepl } from './MiniRepl'; - -The following is generated from the source documentation. - -## TOC - -## Pattern Factories - -The following functions will return a pattern. We will see later what that means. - -### pure - -

      A discrete value that repeats once per cycle:

      - -**Parameters** - -- value (any): The value to repeat - -**Examples** - -
      - -
      - -### slowcat - -

      Concatenation: combines a list of patterns, switching between them successively, one per cycle:

      -

      synonyms: cat

      - -**Parameters** - -- items (any): The items to concatenate - -**Examples** - -
      - -
      - -### fastcat - -

      Concatenation: as with slowcat, but squashes a cycle from each pattern into one cycle

      -

      Synonyms: seq, sequence

      - -**Parameters** - -- items (any): The items to concatenate - -**Examples** - -
      - -
      - -### stack - -

      The given items are played at the same time at the same length:

      - -**Parameters** - -- items (any): The items to stack - -**Examples** - -
      - -
      - -### timeCat - -

      Like fastcat, but where each step has a temporal weight:

      - -**Parameters** - -- items (Array): The items to concatenate - -**Examples** - -
      - -
      - - - -## Pattern Modifiers - -### Pattern.slow - -

      Slow down a pattern over the given number of cycles.

      - -**Parameters** - -- factor (number|Pattern): slow down factor - -**Examples** - -
      - -
      - -### Pattern.fast - -

      Speed up a pattern by the given factor.

      - -**Parameters** - -- factor (number|Pattern): speed up factor - -**Examples** - -
      - -
      - - - - - - - -## Everything Else diff --git a/tutorial/package.json b/tutorial/package.json index f2e31a12..cdee3c3a 100644 --- a/tutorial/package.json +++ b/tutorial/package.json @@ -3,12 +3,12 @@ "private": true, "version": "0.0.0", "scripts": { - "dev": "npm run jsdoc-json && vite", + "dev": "npm run render && vite", "start": "vite", - "build": "npm run jsdoc-json && vite build", + "build": "npm run render && vite build", "preview": "vite preview", "jsdoc-json": "jsdoc ../packages/ --template ../node_modules/jsdoc-json --destination ../doc.json -c ../jsdoc.config.json", - "render": "npm run jsdoc-json && node ./render.js > api.mdx" + "render": "npm run jsdoc-json && node ./render.js > tutorial.rendered.mdx" }, "type": "module", "dependencies": { diff --git a/tutorial/render.js b/tutorial/render.js index 7ac6f4a8..38b24020 100644 --- a/tutorial/render.js +++ b/tutorial/render.js @@ -4,7 +4,7 @@ import jsdoc from '../doc.json' assert { type: 'json' }; // TODO: load tutorial.mdx and append rendered api.mdx to the bottom (to make sure TOC works) // TODO: split -const env = nunjucks.configure('templates', { autoescape: false }); +const env = nunjucks.configure('.', { autoescape: false }); const docs = jsdoc.docs.reduce((acc, obj) => Object.assign(acc, { [obj.longname]: obj }), {}); @@ -45,5 +45,5 @@ ${ env.addFilter('jsdoc', renderAsMDX); -const rendered = nunjucks.render('api.mdx', { docs }); +const rendered = nunjucks.render('tutorial.mdx', { docs }); console.log(rendered); diff --git a/tutorial/tutorial.mdx b/tutorial/tutorial.mdx index 0be316d3..b56dd27e 100644 --- a/tutorial/tutorial.mdx +++ b/tutorial/tutorial.mdx @@ -699,3 +699,122 @@ If you want to contribute in another way, either # API Docs +The following is generated from the source documentation. + +## Pattern Factories + +The following functions will return a pattern. We will see later what that means. + +### pure + +

      A discrete value that repeats once per cycle:

      + +**Parameters** + +- value (any): The value to repeat + +**Examples** + +
      + +
      + +### slowcat + +

      Concatenation: combines a list of patterns, switching between them successively, one per cycle:

      +

      + synonyms: cat +

      + +**Parameters** + +- items (any): The items to concatenate + +**Examples** + +
      + +
      + +### fastcat + +

      + Concatenation: as with slowcat, but squashes a cycle from each pattern into one cycle +

      +

      + Synonyms: seq, sequence +

      + +**Parameters** + +- items (any): The items to concatenate + +**Examples** + +
      + +
      + +### stack + +

      The given items are played at the same time at the same length:

      + +**Parameters** + +- items (any): The items to stack + +**Examples** + +
      + +
      + +### timeCat + +

      + Like fastcat, but where each step has a temporal weight: +

      + +**Parameters** + +- items (Array): The items to concatenate + +**Examples** + +
      + +
      + +## Pattern Modifiers + +### Pattern.slow + +

      Slow down a pattern over the given number of cycles.

      + +**Parameters** + +- factor (number|Pattern): slow down factor + +**Examples** + +
      + +
      + +### Pattern.fast + +

      Speed up a pattern by the given factor.

      + +**Parameters** + +- factor (number|Pattern): speed up factor + +**Examples** + +
      + +
      From e7fe1ab567a70a6ea6cb010b00cac0d93d27eccc Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Tue, 24 May 2022 20:37:53 +0200 Subject: [PATCH 22/26] delete old mdx --- tutorial/templates/api.mdx | 35 ----------------------------------- 1 file changed, 35 deletions(-) delete mode 100644 tutorial/templates/api.mdx diff --git a/tutorial/templates/api.mdx b/tutorial/templates/api.mdx deleted file mode 100644 index 53dadf31..00000000 --- a/tutorial/templates/api.mdx +++ /dev/null @@ -1,35 +0,0 @@ -import { MiniRepl } from './MiniRepl'; - -The following is generated from the source documentation. - -## TOC - -## Pattern Factories - -The following functions will return a pattern. We will see later what that means. - -{{ 'pure' | jsdoc }} - -{{ 'slowcat' | jsdoc }} - -{{ 'fastcat' | jsdoc }} - -{{ 'stack' | jsdoc }} - -{{ 'timeCat' | jsdoc }} - -{{ 'polyrhythm' | jsdoc }} - -## Pattern Modifiers - -{{ 'Pattern.slow' | jsdoc }} - -{{ 'Pattern.fast' | jsdoc }} - -{{ 'Pattern.early' | jsdoc }} - -{{ 'Pattern.late' | jsdoc }} - -{{ 'Pattern.rev' | jsdoc }} - -## Everything Else \ No newline at end of file From cc1a61d607b1ae90af013f12d9f8048c36b3d239 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Tue, 24 May 2022 20:40:12 +0200 Subject: [PATCH 23/26] use nunjucks filters --- tutorial/tutorial.mdx | 112 +++++------------------------------------- 1 file changed, 11 insertions(+), 101 deletions(-) diff --git a/tutorial/tutorial.mdx b/tutorial/tutorial.mdx index b56dd27e..e4d54205 100644 --- a/tutorial/tutorial.mdx +++ b/tutorial/tutorial.mdx @@ -705,116 +705,26 @@ The following is generated from the source documentation. The following functions will return a pattern. We will see later what that means. -### pure +{{ 'pure' | jsdoc }} -

      A discrete value that repeats once per cycle:

      +{{ 'slowcat' | jsdoc }} -**Parameters** +{{ 'fastcat' | jsdoc }} -- value (any): The value to repeat +{{ 'stack' | jsdoc }} -**Examples** +{{ 'timeCat' | jsdoc }} -
      - -
      - -### slowcat - -

      Concatenation: combines a list of patterns, switching between them successively, one per cycle:

      -

      - synonyms: cat -

      - -**Parameters** - -- items (any): The items to concatenate - -**Examples** - -
      - -
      - -### fastcat - -

      - Concatenation: as with slowcat, but squashes a cycle from each pattern into one cycle -

      -

      - Synonyms: seq, sequence -

      - -**Parameters** - -- items (any): The items to concatenate - -**Examples** - -
      - -
      - -### stack - -

      The given items are played at the same time at the same length:

      - -**Parameters** - -- items (any): The items to stack - -**Examples** - -
      - -
      - -### timeCat - -

      - Like fastcat, but where each step has a temporal weight: -

      - -**Parameters** - -- items (Array): The items to concatenate - -**Examples** - -
      - -
      +{{ 'polyrhythm' | jsdoc }} ## Pattern Modifiers -### Pattern.slow +{{ 'Pattern.slow' | jsdoc }} -

      Slow down a pattern over the given number of cycles.

      +{{ 'Pattern.fast' | jsdoc }} -**Parameters** +{{ 'Pattern.early' | jsdoc }} -- factor (number|Pattern): slow down factor +{{ 'Pattern.late' | jsdoc }} -**Examples** - -
      - -
      - -### Pattern.fast - -

      Speed up a pattern by the given factor.

      - -**Parameters** - -- factor (number|Pattern): speed up factor - -**Examples** - -
      - -
      +{{ 'Pattern.rev' | jsdoc }} From 7250824e6bc9414cd4b2a68befaf31ccd311e77b Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Tue, 24 May 2022 22:35:06 +0200 Subject: [PATCH 24/26] add superdirt params --- doc.json | 33 +++++++++-- packages/osc/osc.mjs | 12 +++- tutorial/tutorial.mdx | 134 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 172 insertions(+), 7 deletions(-) diff --git a/doc.json b/doc.json index e739c923..caec3b45 100644 --- a/doc.json +++ b/doc.json @@ -3380,6 +3380,29 @@ "___id": "T000002R000906", "___s": true }, + { + "comment": "/**\n *\n * Sends each hap as an OSC message, which can be picked up by SuperCollider or any other OSC-enabled software.\n *\n * @name osc\n * @memberof Pattern\n * @returns Pattern\n */", + "meta": { + "filename": "osc.mjs", + "lineno": 15, + "columnno": 0, + "path": "/home/felix/projects/strudel/packages/osc", + "code": {} + }, + "description": "

      Sends each hap as an OSC message, which can be picked up by SuperCollider or any other OSC-enabled software.

      ", + "name": "osc", + "memberof": "Pattern", + "returns": [ + { + "description": "

      Pattern

      " + } + ], + "scope": "static", + "longname": "Pattern.osc", + "kind": "member", + "___id": "T000002R002650", + "___s": true + }, { "comment": "/**\n * Change the pitch of each value by the given amount. Expects numbers or note strings as values.\n * The amount can be given as a number of semitones or as a string in interval short notation.\n * If you don't care about enharmonic correctness, just use numbers. Otherwise, pass the interval of\n * the form: ST where S is the degree number and T the type of interval with\n *\n * - M = major\n * - m = minor\n * - P = perfect\n * - A = augmented\n * - d = diminished\n *\n * Examples intervals:\n *\n * - 1P = unison\n * - 3M = major third\n * - 3m = minor third\n * - 4P = perfect fourth\n * - 4A = augmented fourth\n * - 5P = perfect fifth\n * - 5d = diminished fifth\n *\n * @param {string | number} amount Either number of semitones or interval string.\n * @returns Pattern\n * @memberof Pattern\n * @name transpose\n * @example\n * \"c2 c3\".fast(2).transpose(\"<0 -2 5 3>\".slow(2)).transpose(0)\n * @example\n * \"c2 c3\".fast(2).transpose(\"<1P -2M 4P 3m>\".slow(2)).transpose(0)\n */", "meta": { @@ -3416,7 +3439,7 @@ "scope": "static", "longname": "Pattern.transpose", "kind": "member", - "___id": "T000002R003715", + "___id": "T000002R003716", "___s": true }, { @@ -3453,7 +3476,7 @@ "scope": "static", "longname": "Pattern.scaleTranspose", "kind": "member", - "___id": "T000002R003719", + "___id": "T000002R003720", "___s": true }, { @@ -3490,7 +3513,7 @@ "scope": "static", "longname": "Pattern.scale", "kind": "member", - "___id": "T000002R003721", + "___id": "T000002R003722", "___s": true }, { @@ -3527,7 +3550,7 @@ "scope": "static", "longname": "Pattern.voicings", "kind": "member", - "___id": "T000002R003746", + "___id": "T000002R003747", "___s": true }, { @@ -3609,7 +3632,7 @@ "/home/felix/projects/strudel/packages/xen/tunejs.js", "/home/felix/projects/strudel/packages/xen/xen.mjs" ], - "___id": "T000002R014015", + "___id": "T000002R014016", "___s": true } ] diff --git a/packages/osc/osc.mjs b/packages/osc/osc.mjs index 4d4ed55b..e3b12823 100644 --- a/packages/osc/osc.mjs +++ b/packages/osc/osc.mjs @@ -12,17 +12,25 @@ comm.open(); const latency = 0.1; let startedAt = -1; +/** + * + * Sends each hap as an OSC message, which can be picked up by SuperCollider or any other OSC-enabled software. + * + * @name osc + * @memberof Pattern + * @returns Pattern + */ Pattern.prototype.osc = function () { return this._withHap((hap) => { const onTrigger = (time, hap, currentTime, cps, cycle, delta) => { // time should be audio time of onset // currentTime should be current time of audio context (slightly before time) if (startedAt < 0) { - startedAt = Date.now() - (currentTime * 1000); + startedAt = Date.now() - currentTime * 1000; } const controls = Object.assign({}, { cps: cps, cycle: cycle, delta: delta }, hap.value); const keyvals = Object.entries(controls).flat(); - const ts = Math.floor(startedAt + ((time + latency) * 1000)); + const ts = Math.floor(startedAt + (time + latency) * 1000); const message = new OSC.Message('/dirt/play', ...keyvals); const bundle = new OSC.Bundle([message], ts); bundle.timestamp(ts); // workaround for https://github.com/adzialocha/osc-js/issues/60 diff --git a/tutorial/tutorial.mdx b/tutorial/tutorial.mdx index e4d54205..1a3cfba3 100644 --- a/tutorial/tutorial.mdx +++ b/tutorial/tutorial.mdx @@ -728,3 +728,137 @@ The following functions will return a pattern. We will see later what that means {{ 'Pattern.late' | jsdoc }} {{ 'Pattern.rev' | jsdoc }} + +{{ 'Pattern.legato' | jsdoc }} + +## Using Superdirt via OSC + +In mainline tidal, the actual sound is generated via Superdirt, which runs inside Supercollider. +Strudel also supports using Superdirt as a backend, although it requires some developer tooling to run. + +### Getting Started + +Getting Superdirt to work with Strudel, you need to + +1. install SuperCollider + sc3 plugins, see [Tidal Docs](https://tidalcycles.org/docs/) (Install Tidal) for more info. +2. install [node.js](https://nodejs.org/en/) +3. download [Strudel Repo](https://github.com/tidalcycles/strudel/) (or git clone, if you have git installed) +4. run `npm i` in the strudel directory +5. run `npm run osc` to start the osc server, which forwards OSC messages from Strudel REPL to SuperCollider + +Now you're all set! + +### Usage + +1. Start SuperCollider, either using SuperCollider IDE or by running `sclang` in a terminal +2. Open the [Strudel REPL](https://strudel.tidalcycles.org/#cygiYmQgc2QiKS5vc2MoKQ%3D%3D) + +...or test it here: + + + +If you now hear sound, congratulations! If not, you can get help on the [#strudel channel in the TidalCycles discord](https://discord.com/invite/HGEdXmRkzT). + +{{ 'Pattern.osc' | jsdoc }} + +# Superdirt Params + +The following functions are specific to SuperDirt and won't work with other Strudel outputs. + +## Basic Types + +{{ 's' | jsdoc }} + +{{ 'n' | jsdoc }} + +{{ 'freq' | jsdoc }} + +## Filters + +{{ 'cutoff' | jsdoc }} + +{{ 'resonance' | jsdoc }} + +{{ 'hcutoff' | jsdoc }} + +{{ 'hresonance' | jsdoc }} + +{{ 'bandf' | jsdoc }} + +{{ 'bandq' | jsdoc }} + +{{ 'djf' | jsdoc }} + +{{ 'vowel' | jsdoc }} + +## Sample Editing + +{{ 'cut' | jsdoc }} + +{{ 'begin' | jsdoc }} + +{{ 'end' | jsdoc }} + +{{ 'loop' | jsdoc }} + +{{ 'fadeTime' | jsdoc }} + +{{ 'speed' | jsdoc }} + +{{ 'unit' | jsdoc }} + +## Audio Effects + +{{ 'gain' | jsdoc }} + +{{ 'amp' | jsdoc }} + +{{ 'accelerate' | jsdoc }} + +{{ 'crush' | jsdoc }} + +{{ 'coarse' | jsdoc }} + +{{ 'channel' | jsdoc }} + +{{ 'delay' | jsdoc }} + +{{ 'lock' | jsdoc }} + +{{ 'dry' | jsdoc }} + +{{ 'leslie' | jsdoc }} + +{{ 'lrate' | jsdoc }} + +{{ 'lsize' | jsdoc }} + +{{ 'orbit' | jsdoc }} + +{{ 'pan' | jsdoc }} + +{{ 'panspan' | jsdoc }} + +{{ 'pansplay' | jsdoc }} + +{{ 'room' | jsdoc }} + +{{ 'size' | jsdoc }} + +{{ 'shape' | jsdoc }} + +{{ 'squiz' | jsdoc }} + +{{ 'waveloss' | jsdoc }} + +{{ 'attack' | jsdoc }} + +{{ 'decay' | jsdoc }} + +## Synth Effects + +{{ 'octave' | jsdoc }} + +{{ 'detune' | jsdoc }} + +{{ 'tremolodepth' | jsdoc }} From 8a812dd853550b36574a1e13bf77871edad559d4 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Tue, 24 May 2022 22:48:49 +0200 Subject: [PATCH 25/26] reorder stuff --- tutorial/tutorial.mdx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tutorial/tutorial.mdx b/tutorial/tutorial.mdx index 1a3cfba3..f2eace19 100644 --- a/tutorial/tutorial.mdx +++ b/tutorial/tutorial.mdx @@ -773,6 +773,10 @@ The following functions are specific to SuperDirt and won't work with other Stru {{ 'freq' | jsdoc }} +{{ 'channel' | jsdoc }} + +{{ 'orbit' | jsdoc }} + ## Filters {{ 'cutoff' | jsdoc }} @@ -819,22 +823,16 @@ The following functions are specific to SuperDirt and won't work with other Stru {{ 'coarse' | jsdoc }} -{{ 'channel' | jsdoc }} - {{ 'delay' | jsdoc }} {{ 'lock' | jsdoc }} -{{ 'dry' | jsdoc }} - {{ 'leslie' | jsdoc }} {{ 'lrate' | jsdoc }} {{ 'lsize' | jsdoc }} -{{ 'orbit' | jsdoc }} - {{ 'pan' | jsdoc }} {{ 'panspan' | jsdoc }} @@ -845,6 +843,8 @@ The following functions are specific to SuperDirt and won't work with other Stru {{ 'size' | jsdoc }} +{{ 'dry' | jsdoc }} + {{ 'shape' | jsdoc }} {{ 'squiz' | jsdoc }} From 93e565f8df66e4dcc3099425834daf07bf315a60 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Sat, 28 May 2022 23:43:42 +0200 Subject: [PATCH 26/26] document non random signal functions --- doc.json | 318 ++++++++++++++++++++++++++++++++++----- packages/core/signal.mjs | 46 ++++++ tutorial/tutorial.mdx | 27 ++++ 3 files changed, 350 insertions(+), 41 deletions(-) diff --git a/doc.json b/doc.json index caec3b45..af56ea59 100644 --- a/doc.json +++ b/doc.json @@ -1354,7 +1354,7 @@ "meta": { "range": [ 1178, - 31622 + 31915 ], "filename": "pattern.mjs", "lineno": 17, @@ -2876,11 +2876,61 @@ "___id": "T000002R000651", "___s": true }, + { + "comment": "/**\n *\n * @param {...any} funcs\n * @returns Pattern\n * @example\n * \"<[0 1 2 0]!2 [2 3 4 ~]!2 [[4 5] [4 3] 2 [0 ~]]!2 [0 -3 0 ~]!2>\"\n * .layer(\n * x=>x,\n * x=>x.add(7).late(2),\n * x=>x.add(14).late(4),\n * x=>x.add(21).late(6),\n * )\n * .slow(3)\n * .scale('C2 major')\n * .tone((await piano()).toDestination())\n */", + "meta": { + "range": [ + 21980, + 22055 + ], + "filename": "pattern.mjs", + "lineno": 700, + "columnno": 2, + "path": "/home/felix/projects/strudel/packages/core", + "code": { + "id": "astnode100007825", + "name": "Pattern#layer", + "type": "MethodDefinition", + "paramnames": [ + "funcs" + ] + }, + "vars": { + "": null + } + }, + "params": [ + { + "type": { + "names": [ + "any" + ] + }, + "variable": true, + "name": "funcs" + } + ], + "returns": [ + { + "description": "

      Pattern

      " + } + ], + "examples": [ + "\"<[0 1 2 0]!2 [2 3 4 ~]!2 [[4 5] [4 3] 2 [0 ~]]!2 [0 -3 0 ~]!2>\"\n.layer(\n x=>x,\n x=>x.add(7).late(2),\n x=>x.add(14).late(4),\n x=>x.add(21).late(6),\n)\n.slow(3)\n.scale('C2 major')\n.tone((await piano()).toDestination())" + ], + "name": "layer", + "longname": "Pattern#layer", + "kind": "function", + "memberof": "Pattern", + "scope": "instance", + "___id": "T000002R000683", + "___s": true + }, { "comment": "/**\n * Speed up a pattern by the given factor.\n *\n * @name fast\n * @memberof Pattern\n * @param {number | Pattern} factor speed up factor\n * @returns Pattern\n * @example\n * seq(e5, b4, d5, c5).fast(2)\n */", "meta": { "filename": "pattern.mjs", - "lineno": 735, + "lineno": 750, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -2918,7 +2968,7 @@ "comment": "/**\n * Slow down a pattern over the given number of cycles.\n *\n * @name slow\n * @memberof Pattern\n * @param {number | Pattern} factor slow down factor\n * @returns Pattern\n * @example\n * seq(e5, b4, d5, c5).slow(2)\n */", "meta": { "filename": "pattern.mjs", - "lineno": 750, + "lineno": 765, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": {} @@ -2956,11 +3006,11 @@ "comment": "/**\n * Returns a new pattern where every other cycle is played once, twice as\n * fast, and offset in time by one quarter of a cycle. Creates a kind of\n * breakbeat feel.\n * @returns Pattern\n */", "meta": { "range": [ - 27788, - 27884 + 28139, + 28235 ], "filename": "pattern.mjs", - "lineno": 904, + "lineno": 919, "columnno": 2, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -2992,11 +3042,11 @@ "comment": "/** A discrete value that repeats once per cycle:\n *\n * @param {any} value - The value to repeat\n * @returns {Pattern}\n * @example\n * pure('e4')\n */", "meta": { "range": [ - 35703, - 35907 + 35996, + 36200 ], "filename": "pattern.mjs", - "lineno": 1203, + "lineno": 1217, "columnno": 0, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -3043,11 +3093,11 @@ "comment": "/** The given items are played at the same time at the same length:\n *\n * @param {...any} items - The items to stack\n * @return {Pattern}\n * @example\n * stack(g3, b3, [e4, d4])\n */", "meta": { "range": [ - 36420, - 36693 + 36713, + 36986 ], "filename": "pattern.mjs", - "lineno": 1230, + "lineno": 1244, "columnno": 0, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -3095,11 +3145,11 @@ "comment": "/** Concatenation: combines a list of patterns, switching between them successively, one per cycle:\n *\n * synonyms: {@link cat}\n *\n * @param {...any} items - The items to concatenate\n * @return {Pattern}\n * @example\n * slowcat(e5, b4, [d5, c5])\n *\n */", "meta": { "range": [ - 36947, - 37858 + 37240, + 38151 ], "filename": "pattern.mjs", - "lineno": 1247, + "lineno": 1261, "columnno": 0, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -3147,11 +3197,11 @@ "comment": "/** Concatenation: combines a list of patterns, switching between them successively, one per cycle. Unlike slowcat, this version will skip cycles.\n * @param {...any} items - The items to concatenate\n * @return {Pattern}\n */", "meta": { "range": [ - 38084, - 38356 + 38377, + 38649 ], "filename": "pattern.mjs", - "lineno": 1272, + "lineno": 1286, "columnno": 0, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -3196,11 +3246,11 @@ "comment": "/** Concatenation: as with {@link slowcat}, but squashes a cycle from each pattern into one cycle\n *\n * Synonyms: {@link seq}, {@link sequence}\n *\n * @param {...any} items - The items to concatenate\n * @return {Pattern}\n * @example\n * fastcat(e5, b4, [d5, c5])\n * // sequence(e5, b4, [d5, c5])\n * // seq(e5, b4, [d5, c5])\n */", "meta": { "range": [ - 38684, - 38766 + 38977, + 39059 ], "filename": "pattern.mjs", - "lineno": 1293, + "lineno": 1307, "columnno": 0, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -3248,11 +3298,11 @@ "comment": "/** See {@link slowcat} */", "meta": { "range": [ - 38795, - 38854 + 39088, + 39147 ], "filename": "pattern.mjs", - "lineno": 1298, + "lineno": 1312, "columnno": 0, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -3276,11 +3326,11 @@ "comment": "/** Like {@link fastcat}, but where each step has a temporal weight:\n * @param {...Array} items - The items to concatenate\n * @return {Pattern}\n * @example\n * timeCat([3,e3],[1, g3])\n */", "meta": { "range": [ - 39043, - 39402 + 39336, + 39695 ], "filename": "pattern.mjs", - "lineno": 1308, + "lineno": 1322, "columnno": 0, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -3328,11 +3378,11 @@ "comment": "/** See {@link fastcat} */", "meta": { "range": [ - 39431, - 39495 + 39724, + 39788 ], "filename": "pattern.mjs", - "lineno": 1321, + "lineno": 1335, "columnno": 0, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -3356,11 +3406,11 @@ "comment": "/** See {@link fastcat} */", "meta": { "range": [ - 39524, - 39583 + 39817, + 39876 ], "filename": "pattern.mjs", - "lineno": 1326, + "lineno": 1340, "columnno": 0, "path": "/home/felix/projects/strudel/packages/core", "code": { @@ -3380,6 +3430,192 @@ "___id": "T000002R000906", "___s": true }, + { + "comment": "/**\n * A sawtooth signal between 0 and 1.\n *\n * @return {Pattern}\n * @example\n * \"c3 [eb3,g3] g2 [g3,bb3]\".legato(saw.slow(4))\n * @example\n * saw.range(0,8).segment(8).scale('C major').slow(4)\n *\n */", + "meta": { + "range": [ + 1558, + 1598 + ], + "filename": "signal.mjs", + "lineno": 35, + "columnno": 0, + "path": "/home/felix/projects/strudel/packages/core", + "code": { + "id": "astnode100011947", + "name": "exports.saw", + "type": "VariableDeclaration" + } + }, + "description": "

      A sawtooth signal between 0 and 1.

      ", + "returns": [ + { + "type": { + "names": [ + "Pattern" + ] + } + } + ], + "examples": [ + "\"c3 [eb3,g3] g2 [g3,bb3]\".legato(saw.slow(4))", + "saw.range(0,8).segment(8).scale('C major').slow(4)" + ], + "name": "saw", + "longname": "saw", + "kind": "constant", + "scope": "global", + "___id": "T000002R001036", + "___s": true + }, + { + "comment": "/**\n * A sine signal between 0 and 1.\n *\n * @return {Pattern}\n * @example\n * sine.segment(16).range(0,15).slow(2).scale('C minor')\n *\n */", + "meta": { + "range": [ + 1841, + 1882 + ], + "filename": "signal.mjs", + "lineno": 48, + "columnno": 0, + "path": "/home/felix/projects/strudel/packages/core", + "code": { + "id": "astnode100011985", + "name": "exports.sine", + "type": "VariableDeclaration" + } + }, + "description": "

      A sine signal between 0 and 1.

      ", + "returns": [ + { + "type": { + "names": [ + "Pattern" + ] + } + } + ], + "examples": [ + "sine.segment(16).range(0,15).slow(2).scale('C minor')" + ], + "name": "sine", + "longname": "sine", + "kind": "constant", + "scope": "global", + "___id": "T000002R001042", + "___s": true + }, + { + "comment": "/**\n * A cosine signal between 0 and 1.\n *\n * @return {Pattern}\n * @example\n * stack(sine,cosine).segment(16).range(0,15).slow(2).scale('C minor')\n *\n */", + "meta": { + "range": [ + 2040, + 2094 + ], + "filename": "signal.mjs", + "lineno": 59, + "columnno": 0, + "path": "/home/felix/projects/strudel/packages/core", + "code": { + "id": "astnode100011993", + "name": "exports.cosine", + "type": "VariableDeclaration" + } + }, + "description": "

      A cosine signal between 0 and 1.

      ", + "returns": [ + { + "type": { + "names": [ + "Pattern" + ] + } + } + ], + "examples": [ + "stack(sine,cosine).segment(16).range(0,15).slow(2).scale('C minor')" + ], + "name": "cosine", + "longname": "cosine", + "kind": "constant", + "scope": "global", + "___id": "T000002R001044", + "___s": true + }, + { + "comment": "/**\n * A square signal between 0 and 1.\n *\n * @return {Pattern}\n * @example\n * square.segment(2).range(0,7).scale('C minor')\n *\n */", + "meta": { + "range": [ + 2287, + 2348 + ], + "filename": "signal.mjs", + "lineno": 71, + "columnno": 0, + "path": "/home/felix/projects/strudel/packages/core", + "code": { + "id": "astnode100012023", + "name": "exports.square", + "type": "VariableDeclaration" + } + }, + "description": "

      A square signal between 0 and 1.

      ", + "returns": [ + { + "type": { + "names": [ + "Pattern" + ] + } + } + ], + "examples": [ + "square.segment(2).range(0,7).scale('C minor')" + ], + "name": "square", + "longname": "square", + "kind": "constant", + "scope": "global", + "___id": "T000002R001048", + "___s": true + }, + { + "comment": "/**\n * A triangle signal between 0 and 1.\n *\n * @return {Pattern}\n * @example\n * triangle.segment(2).range(0,7).scale('C minor')\n *\n */", + "meta": { + "range": [ + 2531, + 2569 + ], + "filename": "signal.mjs", + "lineno": 82, + "columnno": 0, + "path": "/home/felix/projects/strudel/packages/core", + "code": { + "id": "astnode100012048", + "name": "exports.tri", + "type": "VariableDeclaration" + } + }, + "description": "

      A triangle signal between 0 and 1.

      ", + "returns": [ + { + "type": { + "names": [ + "Pattern" + ] + } + } + ], + "examples": [ + "triangle.segment(2).range(0,7).scale('C minor')" + ], + "name": "tri", + "longname": "tri", + "kind": "constant", + "scope": "global", + "___id": "T000002R001052", + "___s": true + }, { "comment": "/**\n *\n * Sends each hap as an OSC message, which can be picked up by SuperCollider or any other OSC-enabled software.\n *\n * @name osc\n * @memberof Pattern\n * @returns Pattern\n */", "meta": { @@ -3407,7 +3643,7 @@ "comment": "/**\n * Change the pitch of each value by the given amount. Expects numbers or note strings as values.\n * The amount can be given as a number of semitones or as a string in interval short notation.\n * If you don't care about enharmonic correctness, just use numbers. Otherwise, pass the interval of\n * the form: ST where S is the degree number and T the type of interval with\n *\n * - M = major\n * - m = minor\n * - P = perfect\n * - A = augmented\n * - d = diminished\n *\n * Examples intervals:\n *\n * - 1P = unison\n * - 3M = major third\n * - 3m = minor third\n * - 4P = perfect fourth\n * - 4A = augmented fourth\n * - 5P = perfect fifth\n * - 5d = diminished fifth\n *\n * @param {string | number} amount Either number of semitones or interval string.\n * @returns Pattern\n * @memberof Pattern\n * @name transpose\n * @example\n * \"c2 c3\".fast(2).transpose(\"<0 -2 5 3>\".slow(2)).transpose(0)\n * @example\n * \"c2 c3\".fast(2).transpose(\"<1P -2M 4P 3m>\".slow(2)).transpose(0)\n */", "meta": { "filename": "tonal.mjs", - "lineno": 45, + "lineno": 46, "columnno": 0, "path": "/home/felix/projects/strudel/packages/tonal", "code": {} @@ -3439,14 +3675,14 @@ "scope": "static", "longname": "Pattern.transpose", "kind": "member", - "___id": "T000002R003716", + "___id": "T000002R003717", "___s": true }, { "comment": "/**\n * Transposes notes inside the scale by the number of steps.\n * Expected to be called on a Pattern which already has a {@link Pattern#scale}\n *\n * @memberof Pattern\n * @name scaleTranspose\n * @param {offset} offset number of steps inside the scale\n * @returns Pattern\n * @example\n * \"-8 [2,4,6]\"\n * .scale('C4 bebop major')\n * .scaleTranspose(\"<0 -1 -2 -3 -4 -5 -6 -4>\")\n */", "meta": { "filename": "tonal.mjs", - "lineno": 98, + "lineno": 99, "columnno": 0, "path": "/home/felix/projects/strudel/packages/tonal", "code": {} @@ -3476,14 +3712,14 @@ "scope": "static", "longname": "Pattern.scaleTranspose", "kind": "member", - "___id": "T000002R003720", + "___id": "T000002R003721", "___s": true }, { "comment": "/**\n * Turns numbers into notes in the scale (zero indexed). Also sets scale for other scale operations, like {@link Pattern#scaleTranspose}.\n *\n * The scale name has the form \"TO? N\" wher\n *\n * - T = Tonic\n * - O = Octave (optional, defaults to 3)\n * - N = Name of scale, available names can be found [here](https://github.com/tonaljs/tonal/blob/main/packages/scale-type/data.ts).\n *\n * @memberof Pattern\n * @name scale\n * @param {string} scale Name of scale\n * @returns Pattern\n * @example \n * \"0 2 4 6 4 2\"\n * .scale(seq('C2 major', 'C2 minor').slow(2))\n */", "meta": { "filename": "tonal.mjs", - "lineno": 124, + "lineno": 125, "columnno": 0, "path": "/home/felix/projects/strudel/packages/tonal", "code": {} @@ -3513,7 +3749,7 @@ "scope": "static", "longname": "Pattern.scale", "kind": "member", - "___id": "T000002R003722", + "___id": "T000002R003723", "___s": true }, { @@ -3550,7 +3786,7 @@ "scope": "static", "longname": "Pattern.voicings", "kind": "member", - "___id": "T000002R003747", + "___id": "T000002R003748", "___s": true }, { @@ -3632,7 +3868,7 @@ "/home/felix/projects/strudel/packages/xen/tunejs.js", "/home/felix/projects/strudel/packages/xen/xen.mjs" ], - "___id": "T000002R014016", + "___id": "T000002R014017", "___s": true } ] diff --git a/packages/core/signal.mjs b/packages/core/signal.mjs index 01fdd768..b3eb2d3b 100644 --- a/packages/core/signal.mjs +++ b/packages/core/signal.mjs @@ -22,17 +22,63 @@ export const signal = (func) => { export const isaw = signal((t) => 1 - (t % 1)); export const isaw2 = isaw._toBipolar(); +/** + * A sawtooth signal between 0 and 1. + * + * @return {Pattern} + * @example + * "c3 [eb3,g3] g2 [g3,bb3]".legato(saw.slow(4)) + * @example + * saw.range(0,8).segment(8).scale('C major').slow(4) + * + */ export const saw = signal((t) => t % 1); export const saw2 = saw._toBipolar(); export const sine2 = signal((t) => Math.sin(Math.PI * 2 * t)); + +/** + * A sine signal between 0 and 1. + * + * @return {Pattern} + * @example + * sine.segment(16).range(0,15).slow(2).scale('C minor') + * + */ export const sine = sine2._fromBipolar(); + + +/** + * A cosine signal between 0 and 1. + * + * @return {Pattern} + * @example + * stack(sine,cosine).segment(16).range(0,15).slow(2).scale('C minor') + * + */ export const cosine = sine._early(Fraction(1).div(4)); export const cosine2 = sine2._early(Fraction(1).div(4)); + +/** + * A square signal between 0 and 1. + * + * @return {Pattern} + * @example + * square.segment(2).range(0,7).scale('C minor') + * + */ export const square = signal((t) => Math.floor((t * 2) % 2)); export const square2 = square._toBipolar(); +/** + * A triangle signal between 0 and 1. + * + * @return {Pattern} + * @example + * triangle.segment(2).range(0,7).scale('C minor') + * + */ export const tri = fastcat(isaw, saw); export const tri2 = fastcat(isaw2, saw2); diff --git a/tutorial/tutorial.mdx b/tutorial/tutorial.mdx index f2eace19..077d6f6d 100644 --- a/tutorial/tutorial.mdx +++ b/tutorial/tutorial.mdx @@ -731,6 +731,33 @@ The following functions will return a pattern. We will see later what that means {{ 'Pattern.legato' | jsdoc }} +## Continuous Signals + +Signals are patterns with continuous values, meaning they have theoretically infinite steps. +They can provide streams of numbers that can be sampled at discrete points in time. + +{{ 'Pattern.range' | jsdoc }} + +{{ 'saw' | jsdoc }} + +{{ 'saw2' | jsdoc }} + +{{ 'sine' | jsdoc }} + +{{ 'sine2' | jsdoc }} + +{{ 'cosine' | jsdoc }} + +{{ 'cosine2' | jsdoc }} + +{{ 'tri' | jsdoc }} + +{{ 'tri2' | jsdoc }} + +{{ 'square' | jsdoc }} + +{{ 'square2' | jsdoc }} + ## Using Superdirt via OSC In mainline tidal, the actual sound is generated via Superdirt, which runs inside Supercollider.