mirror of
https://codeberg.org/uzu/strudel
synced 2026-12-05 13:27:25 -05:00
Compare commits
44 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ef38980b12 | |||
| 6274001515 | |||
| 3dde9f49e4 | |||
| 5c4064c3ad | |||
| fff2610a19 | |||
| 4613c1d4a8 | |||
| 8315a8269c | |||
| 8248ee411c | |||
| 9605a9478a | |||
| c4cec8dd18 | |||
| 4033919a8a | |||
| 217fac5e11 | |||
| 207c9d5470 | |||
| 7a1075b746 | |||
| 34b7a81c8b | |||
| b30e3ad88f | |||
| 70b44f6694 | |||
| fdc5db6b9b | |||
| b49981aea6 | |||
| 0c38bfaf99 | |||
| db62b8b6aa | |||
| dc1fe808c0 | |||
| a61418c54c | |||
| 2b001170de | |||
| b1b026b56c | |||
| 49926243f6 | |||
| b298ac7b53 | |||
| 4694c59d74 | |||
| 9e00181020 | |||
| ad98f1050d | |||
| e1e156296a | |||
| 4db94e163c | |||
| 438eb553bd | |||
| 379c075d56 | |||
| 6e550f5a6c | |||
| 2668f4be2c | |||
| 4ddd09cf64 | |||
| 96f8c545ae | |||
| 4b3c6f90a5 | |||
| 08e9e3893e | |||
| 9e5e172931 | |||
| 1f5b8d6bcc | |||
| 11e64428dd | |||
| 551e8aed5e |
@@ -136,6 +136,15 @@ There are also eslint extensions / plugins for most editors.
|
||||
|
||||
When opening a PR, the CI runner will (once approved by a human) check the code style and eslint, as well as run all tests. You can run the same check with `pnpm check`.
|
||||
|
||||
## Publishing a change live on *.strudel.cc
|
||||
|
||||
There are a few steps to a contribution to strudel making it to https://strudel.cc/
|
||||
|
||||
1. If a maintainer adds a 'serve-hot' label to a pull request on codeberg, it is built and exposed as http://pr-1000.hot.strudel.cc (where 1000 is the pr number). This allows changes to be tried out live, without building locally. However, because it's plain http, some webaudio things etc won't work. A maintainer with server access can assign a certificate for https via a manual process if needed.
|
||||
2. When a pull request is merged into the main branch by a maintainer, it is automatically built and served under https://hot.strudel.cc/
|
||||
3. Then a maintainer can trigger an action on codeberg to rebuild https://strudel.cc/ (also known as https://warm.strudel.cc/) from the main branch. This [currently makes strudel refresh for all users](https://codeberg.org/uzu/strudel/pulls/2130), and is intended to happen around once a week, early in the week (when fewer people will be performing with it!), or more often for urgent fixes.
|
||||
4. There is also https://cold.strudel.cc/, which is intended to reflect the last package release to npm.
|
||||
|
||||
## Package Workflow
|
||||
|
||||
The project is split into multiple [packages](https://codeberg.org/uzu/strudel/src/branch/main/packages) with independent versioning.
|
||||
|
||||
+14
-2
@@ -95,6 +95,7 @@ export default [
|
||||
},
|
||||
},
|
||||
jsdoc({
|
||||
files: ['packages/**/*.{js,mjs}'],
|
||||
config: 'flat/recommended-error',
|
||||
rules: {
|
||||
'jsdoc/no-undefined-types': [
|
||||
@@ -111,13 +112,18 @@ export default [
|
||||
comment:
|
||||
'JsdocBlock:has(JsdocTag[tag="memberof"]:not([name=/\\.prototype(?:\\s|$)/]):not([description=/\\.prototype(?:\\s|$)/]))',
|
||||
context: 'any',
|
||||
message: "Use '@memberof <Name>.prototype'. Without, it's considered a static function.",
|
||||
message: "Use '@memberof <Name>.prototype' instead.",
|
||||
},
|
||||
{
|
||||
context: 'FunctionDeclaration',
|
||||
comment: 'JsdocBlock:not(:has(JsdocTag[tag=/^(global|memberof)$/]))',
|
||||
message: 'JSDoc block should be explicitly labeled as @global or @memberof.',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
'jsdoc/require-description': 'error',
|
||||
'jsdoc/no-defaults': 0, //removes defaults with not alternative
|
||||
'jsdoc/no-defaults': 0, //removes defaults with no alternative
|
||||
'jsdoc/require-jsdoc': 0,
|
||||
'jsdoc/tag-lines': 0,
|
||||
'jsdoc/require-returns-description': 0,
|
||||
@@ -129,4 +135,10 @@ export default [
|
||||
'jsdoc/reject-function-type': 0,
|
||||
},
|
||||
}),
|
||||
jsdoc({
|
||||
files: ['packages/core/**/*.{js,mjs}', 'packages/pattern/**/*.{js,mjs}'],
|
||||
rules: {
|
||||
'jsdoc/require-jsdoc': ['warn', { publicOnly: {}, enableFixer: false }],
|
||||
},
|
||||
}),
|
||||
];
|
||||
|
||||
@@ -206,10 +206,10 @@ export class StrudelMirror {
|
||||
cleanupDraw(true, id);
|
||||
}
|
||||
},
|
||||
beforeEval: async () => {
|
||||
beforeEval: async (bag) => {
|
||||
cleanupDraw(true, id);
|
||||
await this.prebaked;
|
||||
await replOptions?.beforeEval?.();
|
||||
await replOptions?.beforeEval?.(bag);
|
||||
},
|
||||
afterEval: (options) => {
|
||||
// remember for when highlighting is toggled on
|
||||
@@ -404,6 +404,7 @@ function s4() {
|
||||
* Overrides the css of highlighted events. Make sure to use single quotes!
|
||||
* @name markcss
|
||||
* @tags visualization
|
||||
* @memberof Pattern.prototype
|
||||
* @example
|
||||
* note("c a f e")
|
||||
* .markcss('text-decoration:underline')
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@strudel/codemirror",
|
||||
"version": "1.3.0",
|
||||
"version": "1.4.0",
|
||||
"description": "Codemirror Extensions for Strudel",
|
||||
"main": "index.mjs",
|
||||
"publishConfig": {
|
||||
|
||||
+410
-18
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@strudel/core",
|
||||
"version": "1.2.6",
|
||||
"version": "1.3.0",
|
||||
"description": "Port of Tidal Cycles to JavaScript",
|
||||
"main": "index.mjs",
|
||||
"type": "module",
|
||||
@@ -31,8 +31,8 @@
|
||||
},
|
||||
"homepage": "https://strudel.cc",
|
||||
"dependencies": {
|
||||
"fraction.js": "^5.2.1",
|
||||
"@strudel/pattern": "workspace:*"
|
||||
"@strudel/pattern": "workspace:*",
|
||||
"fraction.js": "^5.2.1"
|
||||
},
|
||||
"gitHead": "0e26d4e741500f5bae35b023608f062a794905c2",
|
||||
"devDependencies": {
|
||||
|
||||
@@ -13,6 +13,28 @@ import {
|
||||
setClockTime,
|
||||
} from './schedulerState.mjs';
|
||||
|
||||
/**
|
||||
* Creates a new Repl
|
||||
* @global
|
||||
* @param {object} options
|
||||
* @param {*} options.onSchedule
|
||||
* @param {*} options.defaultOutput
|
||||
* @param {*} options.onEvalError
|
||||
* @param {*} options.beforeEval
|
||||
* @param {*} options.beforeStart
|
||||
* @param {*} options.afterEval
|
||||
* @param {*} options.getTime
|
||||
* @param {*} options.transpiler
|
||||
* @param {*} options.onToggle
|
||||
* @param {*} options.editPattern
|
||||
* @param {*} options.onUpdateState
|
||||
* @param {*} options.sync = false
|
||||
* @param {*} options.setInterval
|
||||
* @param {*} options.clearInterval
|
||||
* @param {*} options.id
|
||||
* @param {*} options.mondo = false
|
||||
* @returns {object}
|
||||
*/
|
||||
export function repl({
|
||||
onSchedule,
|
||||
defaultOutput,
|
||||
|
||||
@@ -12,6 +12,7 @@ let isStarted;
|
||||
|
||||
/**
|
||||
* Get the current cycle time as a number
|
||||
* @global
|
||||
* @name getTime
|
||||
* @tags internals
|
||||
* @returns {number}
|
||||
@@ -23,6 +24,12 @@ export function getTime() {
|
||||
return time();
|
||||
}
|
||||
|
||||
/**
|
||||
* define how the cycle time should be computed
|
||||
* @global
|
||||
* @param {function():number} func
|
||||
* @tags internals
|
||||
*/
|
||||
export function setTime(func) {
|
||||
time = func;
|
||||
}
|
||||
@@ -30,6 +37,7 @@ export function setTime(func) {
|
||||
let clockTime;
|
||||
/**
|
||||
* Get the current clock time in seconds (onSchedule time)
|
||||
* @global
|
||||
* @name getClockTime
|
||||
* @tags internals
|
||||
* @returns {number}
|
||||
@@ -41,16 +49,28 @@ export function getClockTime() {
|
||||
return clockTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* define how the clock time should be computed
|
||||
* @global
|
||||
* @param {function():number} func
|
||||
*/
|
||||
export function setClockTime(func) {
|
||||
clockTime = func;
|
||||
}
|
||||
|
||||
/**
|
||||
* define how Cycles per seconds are computed
|
||||
* @global
|
||||
* @tags internals
|
||||
* @param {function():number} func
|
||||
*/
|
||||
export function setCpsFunc(func) {
|
||||
cpsFunc = func;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current cycles per second
|
||||
* @global
|
||||
* @name getCps
|
||||
* @tags internals
|
||||
* @returns {number}
|
||||
@@ -59,26 +79,51 @@ export function getCps() {
|
||||
return cpsFunc?.();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the currently running pattern
|
||||
* @param {Pattern} pat
|
||||
*/
|
||||
export function setPattern(pat) {
|
||||
pattern = pat;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the currently running pattern
|
||||
* @returns {Pattern}
|
||||
*/
|
||||
export function getPattern() {
|
||||
return pattern;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the function that applies a function for a given time and cps
|
||||
* @param {function(Pattern,number,number)} func
|
||||
*/
|
||||
export function setScheduleFunc(func) {
|
||||
scheduleFunc = func;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the function that applies a function for a given time and cps
|
||||
* @returns {function(Pattern,number,number)} taking a Pattern, the current time and cps as inputs
|
||||
*/
|
||||
export function getScheduleFunc() {
|
||||
return scheduleFunc;
|
||||
}
|
||||
|
||||
/**
|
||||
* start/stop the scheduler
|
||||
* @param {boolean | undefined} val
|
||||
*/
|
||||
export function setIsStarted(val) {
|
||||
isStarted = !!val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Has the scheduler started?
|
||||
In the repl, this returns true only after the full pattern code has successfully executed without errors, including any prebake files, or if the scheduler was already running from a previous pattern update.
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function getIsStarted() {
|
||||
return isStarted;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,19 @@
|
||||
// will move to https://github.com/felixroos/zyklus
|
||||
// TODO: started flag
|
||||
|
||||
/**
|
||||
* Creates a Web Audio Clock
|
||||
* @global
|
||||
* @param {Function} getTime
|
||||
* @param {Function} callback
|
||||
* @param {number} [duration]
|
||||
* @param {number} [interval]
|
||||
* @param {number} [overlap]
|
||||
* @param {Function} [setInterval]
|
||||
* @param {Function} [clearInterval]
|
||||
* @param {boolean} round
|
||||
* @returns {object}
|
||||
*/
|
||||
function createClock(
|
||||
getTime,
|
||||
callback, // called slightly before each cycle
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@strudel/csound",
|
||||
"version": "1.3.0",
|
||||
"version": "1.4.0",
|
||||
"description": "csound bindings for strudel",
|
||||
"main": "index.mjs",
|
||||
"type": "module",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@strudel/dough",
|
||||
"version": "1.3.2",
|
||||
"version": "1.4.0",
|
||||
"description": "dough synth integration for strudel",
|
||||
"main": "dough.mjs",
|
||||
"type": "module",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@strudel/draw",
|
||||
"version": "1.2.6",
|
||||
"version": "1.3.0",
|
||||
"description": "Helpers for drawing with Strudel",
|
||||
"main": "index.mjs",
|
||||
"type": "module",
|
||||
|
||||
@@ -308,6 +308,7 @@ Pattern.prototype.punchcard = function (options) {
|
||||
* @name wordfall
|
||||
* @tags visualization
|
||||
* @returns {Pattern}
|
||||
* @memberof Pattern.prototype
|
||||
*/
|
||||
Pattern.prototype.wordfall = function (options) {
|
||||
return this.punchcard({ vertical: 1, labels: 1, stroke: 0, fillActive: 1, active: 'white', ...options });
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@strudel/edo",
|
||||
"version": "0.1.0",
|
||||
"version": "0.2.0",
|
||||
"description": "Equal division of the octave (EDO) scale functions for strudel",
|
||||
"main": "index.mjs",
|
||||
"publishConfig": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@strudel/gamepad",
|
||||
"version": "1.2.6",
|
||||
"version": "1.3.0",
|
||||
"description": "Gamepad Inputs for strudel",
|
||||
"main": "index.mjs",
|
||||
"type": "module",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@strudel/hydra",
|
||||
"version": "1.2.6",
|
||||
"version": "1.3.0",
|
||||
"description": "Hydra integration for strudel",
|
||||
"main": "hydra.mjs",
|
||||
"type": "module",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@strudel/kabelsalat",
|
||||
"version": "1.2.6",
|
||||
"version": "1.3.0",
|
||||
"description": "kabelsalat integration for superdough",
|
||||
"main": "kabelsalat.mjs",
|
||||
"type": "module",
|
||||
@@ -29,13 +29,13 @@
|
||||
},
|
||||
"homepage": "https://codeberg.org/uzu/strudel#readme",
|
||||
"dependencies": {
|
||||
"superdough": "workspace:*",
|
||||
"@kabelsalat/lib": "^0.4.1",
|
||||
"@kabelsalat/web": "^0.4.1"
|
||||
"@kabelsalat/web": "^0.4.1",
|
||||
"superdough": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"vite": "^6.0.11",
|
||||
"vite-plugin-bundle-audioworklet":"workspace:*"
|
||||
"vite-plugin-bundle-audioworklet": "workspace:*"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
|
||||
@@ -113,6 +113,7 @@ function githubPath(base, subpath = '') {
|
||||
|
||||
/**
|
||||
* configures the default midimap, which is used when no "midimap" port is set
|
||||
* @global
|
||||
* @param {*} mapping
|
||||
* @tags external_io, midi
|
||||
* @example
|
||||
@@ -128,6 +129,7 @@ let loadCache = {};
|
||||
|
||||
/**
|
||||
* Adds midimaps to the registry. Inside each midimap, control names (e.g. lpf) are mapped to cc numbers.
|
||||
* @global
|
||||
* @param {string | object} map
|
||||
* @tags external_io, midi
|
||||
* @example
|
||||
@@ -484,6 +486,7 @@ Pattern.prototype.midi = function (midiport, options = {}) {
|
||||
|
||||
/**
|
||||
* Initialize a midi input device
|
||||
* @global
|
||||
* @param {string} input
|
||||
* @returns {MidiInput}
|
||||
*/
|
||||
@@ -526,9 +529,10 @@ const midiInputs = {};
|
||||
* The output is a function that accepts a midi cc value to query as well as (optionally) a midi channel
|
||||
*
|
||||
* @name midin
|
||||
* @global
|
||||
* @tags external_io, midi
|
||||
* @param {string | number} input MIDI device name or index defaulting to 0
|
||||
* @returns {function(number, number=): Pattern} A function from (cc, channel?) to a pattern.
|
||||
* @returns {Promise<function(number, number=): Pattern>} A function from (cc, channel?) to a pattern.
|
||||
* When queried, the pattern will produces the most recently received midi value (normalized to 0 to 1)
|
||||
* that came through that cc number (and channel, if provided)
|
||||
* @example
|
||||
@@ -558,7 +562,7 @@ export async function midin(input) {
|
||||
* @name midikeys
|
||||
* @tags external_io, midi
|
||||
* @param {string | number} input MIDI device name or index defaulting to 0
|
||||
* @returns {function((number | Pattern)=): Pattern} A function that produces a pattern.
|
||||
* @returns {Promise<function((number | Pattern)=): Pattern>} A function that produces a pattern.
|
||||
* When queried, the pattern will produces the most recently played midi notes and velocities,
|
||||
* lasting for the specified duration
|
||||
* @example
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@strudel/midi",
|
||||
"version": "1.3.0",
|
||||
"version": "1.4.0",
|
||||
"description": "Midi API for strudel",
|
||||
"main": "index.mjs",
|
||||
"type": "module",
|
||||
|
||||
@@ -8,6 +8,7 @@ import { Input, Output } from 'webmidi';
|
||||
|
||||
/**
|
||||
* Get a string listing device names for error messages.
|
||||
* @global
|
||||
* @param {Input[] | Output[]} devices
|
||||
* @returns {string}
|
||||
*/
|
||||
@@ -18,6 +19,7 @@ export function getMidiDeviceNamesString(devices) {
|
||||
/**
|
||||
* Look up a device by index or name. Otherwise return a default device, or fail if none are connected.
|
||||
*
|
||||
* @global
|
||||
* @param {string | number} indexOrName
|
||||
* @param {Input[] | Output[]} devices
|
||||
* @returns {Input | Output | undefined}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@strudel/mini",
|
||||
"version": "1.2.6",
|
||||
"version": "1.3.0",
|
||||
"description": "Mini notation for strudel",
|
||||
"main": "index.mjs",
|
||||
"type": "module",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@strudel/mondo",
|
||||
"version": "1.1.6",
|
||||
"version": "1.2.0",
|
||||
"description": "mondo notation for strudel",
|
||||
"main": "mondough.mjs",
|
||||
"type": "module",
|
||||
|
||||
+15
-15
@@ -5,7 +5,7 @@ import { signal } from '@strudel/core';
|
||||
/**
|
||||
* The accelerometer's x-axis value ranges from 0 to 1.
|
||||
* @name accelerationX
|
||||
* @returns {Pattern}
|
||||
* @type {Pattern}
|
||||
* @synonyms accX
|
||||
* @tags external_io
|
||||
* @example
|
||||
@@ -16,7 +16,7 @@ import { signal } from '@strudel/core';
|
||||
/**
|
||||
* The accelerometer's y-axis value ranges from 0 to 1.
|
||||
* @name accelerationY
|
||||
* @returns {Pattern}
|
||||
* @type {Pattern}
|
||||
* @synonyms accY
|
||||
* @tags external_io
|
||||
* @example
|
||||
@@ -27,7 +27,7 @@ import { signal } from '@strudel/core';
|
||||
/**
|
||||
* The accelerometer's z-axis value ranges from 0 to 1.
|
||||
* @name accelerationZ
|
||||
* @returns {Pattern}
|
||||
* @type {Pattern}
|
||||
* @synonyms accZ
|
||||
* @tags external_io
|
||||
* @example
|
||||
@@ -38,7 +38,7 @@ import { signal } from '@strudel/core';
|
||||
/**
|
||||
* The device's gravity x-axis value ranges from 0 to 1.
|
||||
* @name gravityX
|
||||
* @returns {Pattern}
|
||||
* @type {Pattern}
|
||||
* @synonyms gravX
|
||||
* @tags external_io
|
||||
* @example
|
||||
@@ -49,7 +49,7 @@ import { signal } from '@strudel/core';
|
||||
/**
|
||||
* The device's gravity y-axis value ranges from 0 to 1.
|
||||
* @name gravityY
|
||||
* @returns {Pattern}
|
||||
* @type {Pattern}
|
||||
* @synonyms gravY
|
||||
* @tags external_io
|
||||
* @example
|
||||
@@ -60,7 +60,7 @@ import { signal } from '@strudel/core';
|
||||
/**
|
||||
* The device's gravity z-axis value ranges from 0 to 1.
|
||||
* @name gravityZ
|
||||
* @returns {Pattern}
|
||||
* @type {Pattern}
|
||||
* @synonyms gravZ
|
||||
* @tags external_io
|
||||
* @example
|
||||
@@ -71,7 +71,7 @@ import { signal } from '@strudel/core';
|
||||
/**
|
||||
* The device's rotation around the alpha-axis value ranges from 0 to 1.
|
||||
* @name rotationAlpha
|
||||
* @returns {Pattern}
|
||||
* @type {Pattern}
|
||||
* @synonyms rotA, rotZ, rotationZ
|
||||
* @tags external_io
|
||||
* @example
|
||||
@@ -82,7 +82,7 @@ import { signal } from '@strudel/core';
|
||||
/**
|
||||
* The device's rotation around the beta-axis value ranges from 0 to 1.
|
||||
* @name rotationBeta
|
||||
* @returns {Pattern}
|
||||
* @type {Pattern}
|
||||
* @synonyms rotB, rotX, rotationX
|
||||
* @tags external_io
|
||||
* @example
|
||||
@@ -93,7 +93,7 @@ import { signal } from '@strudel/core';
|
||||
/**
|
||||
* The device's rotation around the gamma-axis value ranges from 0 to 1.
|
||||
* @name rotationGamma
|
||||
* @returns {Pattern}
|
||||
* @type {Pattern}
|
||||
* @synonyms rotG, rotY, rotationY
|
||||
* @tags external_io
|
||||
* @example
|
||||
@@ -104,7 +104,7 @@ import { signal } from '@strudel/core';
|
||||
/**
|
||||
* The device's orientation alpha value ranges from 0 to 1.
|
||||
* @name orientationAlpha
|
||||
* @returns {Pattern}
|
||||
* @type {Pattern}
|
||||
* @synonyms oriA, oriZ, orientationZ
|
||||
* @tags external_io
|
||||
* @example
|
||||
@@ -115,7 +115,7 @@ import { signal } from '@strudel/core';
|
||||
/**
|
||||
* The device's orientation beta value ranges from 0 to 1.
|
||||
* @name orientationBeta
|
||||
* @returns {Pattern}
|
||||
* @type {Pattern}
|
||||
* @synonyms oriB, oriX, orientationX
|
||||
* @tags external_io
|
||||
* @example
|
||||
@@ -126,7 +126,7 @@ import { signal } from '@strudel/core';
|
||||
/**
|
||||
* The device's orientation gamma value ranges from 0 to 1.
|
||||
* @name orientationGamma
|
||||
* @returns {Pattern}
|
||||
* @type {Pattern}
|
||||
* @synonyms oriG, oriY, orientationY
|
||||
* @tags external_io
|
||||
* @example
|
||||
@@ -137,7 +137,7 @@ import { signal } from '@strudel/core';
|
||||
/**
|
||||
* The device's absolute orientation alpha value ranges from 0 to 1.
|
||||
* @name absoluteOrientationAlpha
|
||||
* @returns {Pattern}
|
||||
* @type {Pattern}
|
||||
* @synonyms absOriA, absOriZ, absoluteOrientationZ
|
||||
* @tags external_io
|
||||
* @example
|
||||
@@ -148,7 +148,7 @@ import { signal } from '@strudel/core';
|
||||
/**
|
||||
* The device's absolute orientation beta value ranges from 0 to 1.
|
||||
* @name absoluteOrientationBeta
|
||||
* @returns {Pattern}
|
||||
* @type {Pattern}
|
||||
* @synonyms absOriB, absOriX, absoluteOrientationX
|
||||
* @tags external_io
|
||||
* @example
|
||||
@@ -159,7 +159,7 @@ import { signal } from '@strudel/core';
|
||||
/**
|
||||
* The device's absolute orientation gamma value ranges from 0 to 1.
|
||||
* @name absoluteOrientationGamma
|
||||
* @returns {Pattern}
|
||||
* @type {Pattern}
|
||||
* @synonyms absOriG, absOriY, absoluteOrientationY
|
||||
* @tags external_io
|
||||
* @example
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@strudel/motion",
|
||||
"version": "1.2.6",
|
||||
"version": "1.3.0",
|
||||
"description": "DeviceMotion API for strudel",
|
||||
"main": "index.mjs",
|
||||
"type": "module",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@strudel/mqtt",
|
||||
"version": "1.2.6",
|
||||
"version": "1.3.0",
|
||||
"description": "MQTT API for strudel",
|
||||
"main": "mqtt.mjs",
|
||||
"type": "module",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@strudel/osc",
|
||||
"version": "1.3.2",
|
||||
"version": "1.4.0",
|
||||
"description": "OSC messaging for strudel",
|
||||
"main": "osc.mjs",
|
||||
"bin": "./server.js",
|
||||
|
||||
@@ -15,10 +15,11 @@ import Fraction, { gcd } from './fraction.mjs';
|
||||
* - "-" hold previous value
|
||||
* - "." silence
|
||||
*
|
||||
* @tags visualization
|
||||
* @tags internal, visualization
|
||||
* @param {Pattern} pat the pattern to use
|
||||
* @param {number} chars max number of characters (approximately)
|
||||
* @returns {string}
|
||||
* @global
|
||||
* @example
|
||||
* const line = drawLine("0 [1 2 3]", 10); // |0--123|0--123
|
||||
* console.log(line);
|
||||
|
||||
@@ -4,6 +4,12 @@ let debounce = 1000,
|
||||
lastMessage,
|
||||
lastTime;
|
||||
|
||||
/**
|
||||
* Logs an error to the system and/or Strudel REPL console.
|
||||
* @global
|
||||
* @param {*} e
|
||||
* @param {string} origin
|
||||
*/
|
||||
export function errorLogger(e, origin = 'cyclist') {
|
||||
if (typeof process !== 'undefined' && process.env.NODE_ENV === 'development') {
|
||||
console.error(e);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@strudel/pattern",
|
||||
"version": "1.2.6",
|
||||
"version": "1.3.0",
|
||||
"description": "Port of Tidal Cycles to JavaScript. This package contains only the pattern representation.",
|
||||
"main": "index.mjs",
|
||||
"type": "module",
|
||||
|
||||
+101
-17
@@ -1063,6 +1063,8 @@ Pattern.prototype.collect = function () {
|
||||
/**
|
||||
* Selects indices in in stacked notes.
|
||||
* @tags temporal
|
||||
* @name arpWith
|
||||
* @memberof Pattern.prototype
|
||||
* @example
|
||||
* note("<[c,eb,g]!2 [c,f,ab] [d,f,ab]>")
|
||||
* .arpWith(haps => haps[2])
|
||||
@@ -1078,6 +1080,8 @@ export const arpWith = register('arpWith', (func, pat) => {
|
||||
/**
|
||||
* Selects indices in in stacked notes.
|
||||
* @tags temporal
|
||||
* @name arp
|
||||
* @memberof Pattern.prototype
|
||||
* @example
|
||||
* note("<[c,eb,g]!2 [c,f,ab] [d,f,ab]>")
|
||||
* .arp("0 [0,2] 1 [0,2]")
|
||||
@@ -1489,7 +1493,6 @@ const ALIGNMENT_KEYS = ALIGNMENTS.map((how) => how.toLowerCase());
|
||||
*
|
||||
* @param {...any} args
|
||||
* @tags temporal
|
||||
* @memberof Pattern.prototype
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* note("c [eb,g] d [eb,g]").mask("<1 [0 1]>")
|
||||
@@ -1505,7 +1508,6 @@ const ALIGNMENT_KEYS = ALIGNMENTS.map((how) => how.toLowerCase());
|
||||
*
|
||||
* @param {...any} args
|
||||
* @tags temporal
|
||||
* @memberof Pattern.prototype
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* s("[<bd lt> sd]*2, hh*8").reset("<x@3 x(5,8)>")
|
||||
@@ -1522,7 +1524,6 @@ const ALIGNMENT_KEYS = ALIGNMENTS.map((how) => how.toLowerCase());
|
||||
*
|
||||
* @param {...any} args
|
||||
* @tags temporal
|
||||
* @memberof Pattern.prototype
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* s("[<bd lt> sd]*2, hh*8").restart("<x@3 x(5,8)>")
|
||||
@@ -1609,6 +1610,7 @@ export const nothing = gap(0);
|
||||
/**
|
||||
* A discrete value that repeats once per cycle.
|
||||
*
|
||||
* @global
|
||||
* @param {number} value
|
||||
* @tags generators
|
||||
* @returns {Pattern}
|
||||
@@ -1625,6 +1627,11 @@ export function pure(value) {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* checks if the given thing is an pattern
|
||||
* @param {*} thing
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function isPattern(thing) {
|
||||
// thing?.constructor?.name !== 'Pattern' // <- this will fail when code is mangled
|
||||
const is = thing instanceof Pattern || thing?._Pattern;
|
||||
@@ -1641,6 +1648,11 @@ export function isPattern(thing) {
|
||||
return is;
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns something into a pattern via pure(), unless it's already a pattern. If a string parser is set via {@link setStringParser}, that is used to reify strings.
|
||||
* @param {*} thing
|
||||
* @returns {Pattern}
|
||||
*/
|
||||
export function reify(thing) {
|
||||
// Turns something into a pattern, unless it's already a pattern
|
||||
if (isPattern(thing)) {
|
||||
@@ -1654,6 +1666,7 @@ export function reify(thing) {
|
||||
|
||||
/**
|
||||
* Takes a list of patterns, and returns a pattern of lists.
|
||||
* @global
|
||||
* @param {Pattern[]} pats
|
||||
* @returns {Pattern}
|
||||
* @tags temporal
|
||||
@@ -1672,6 +1685,8 @@ export function sequenceP(pats) {
|
||||
* @param {...any} pats
|
||||
* @tags temporal
|
||||
* @returns {Pattern}
|
||||
* @name stack
|
||||
* @memberof Pattern.prototype
|
||||
* @synonyms polyrhythm, pr
|
||||
* @example
|
||||
* stack("g3", "b3", ["e4", "d4"]).note()
|
||||
@@ -1732,6 +1747,7 @@ function _stackWith(func, pats) {
|
||||
* @name stackLeft
|
||||
* @tags temporal, stepwise, combiners
|
||||
* @returns {Pattern}
|
||||
* @memberof Pattern.prototype
|
||||
* @example
|
||||
* stackLeft("0 1 2 3", "3 4", "[4 5 6] 7 8 9 10").scale("c:minor").note()
|
||||
* @example
|
||||
@@ -1752,6 +1768,7 @@ export function stackLeft(...pats) {
|
||||
* @name stackRight
|
||||
* @tags temporal, stepwise, combiners
|
||||
* @returns {Pattern}
|
||||
* @memberof Pattern.prototype
|
||||
* @example
|
||||
* stackRight("0 1 2 3", "3 4", "[4 5 6] 7 8 9 10").scale("c:minor").note()
|
||||
* @example
|
||||
@@ -1772,6 +1789,7 @@ export function stackRight(...pats) {
|
||||
* @tags temporal, stepwise, combiners
|
||||
* @synonyms stackCentre
|
||||
* @returns {Pattern}
|
||||
* @memberof Pattern.prototype
|
||||
* @example
|
||||
* stackCenter("0 1 2 3", "3 4", "[4 5 6] 7 8 9 10").scale("c:minor").note()
|
||||
* @example
|
||||
@@ -1802,6 +1820,7 @@ export function stackCentre(...pats) {
|
||||
* @name stackRepeat
|
||||
* @tags temporal, stepwise, combiners
|
||||
* @returns {Pattern}
|
||||
* @memberof Pattern.prototype
|
||||
* @example
|
||||
* stackRepeat("0 1 2 3", "3 4", "[4 5 6] 7 8 9 10").scale("c:minor").note()
|
||||
* @example
|
||||
@@ -1865,6 +1884,7 @@ export function slowcat(...pats) {
|
||||
}
|
||||
|
||||
/** Concatenation: combines a list of patterns, switching between them successively, one per cycle. Unlike slowcat, this version will skip cycles.
|
||||
* @global
|
||||
* @tags combiners
|
||||
* @param {...any} pats The items to concatenate
|
||||
* @returns {Pattern}
|
||||
@@ -1906,6 +1926,7 @@ export function cat(...pats) {
|
||||
* Allows to arrange multiple patterns together over multiple cycles.
|
||||
* Takes a variable number of arrays with two elements specifying the number of cycles and the pattern to use.
|
||||
*
|
||||
* @global
|
||||
* @param {...any} sections
|
||||
* @tags combiners
|
||||
* @returns {Pattern}
|
||||
@@ -2208,6 +2229,7 @@ export const ceil = register('ceil', function (pat) {
|
||||
* @tags math
|
||||
* @returns {Pattern}
|
||||
* @noAutocomplete
|
||||
* @memberof Pattern.prototype
|
||||
*/
|
||||
export const toBipolar = register('toBipolar', function (pat) {
|
||||
return pat.fmap((x) => x * 2 - 1);
|
||||
@@ -2219,6 +2241,7 @@ export const toBipolar = register('toBipolar', function (pat) {
|
||||
* @tags math
|
||||
* @returns {Pattern}
|
||||
* @noAutocomplete
|
||||
* @memberof Pattern.prototype
|
||||
*/
|
||||
export const fromBipolar = register('fromBipolar', function (pat) {
|
||||
return pat.fmap((x) => (x + 1) / 2);
|
||||
@@ -2296,6 +2319,8 @@ export const ratio = register('ratio', (pat) =>
|
||||
|
||||
/** Compress each cycle into the given timespan, leaving a gap
|
||||
* @tags temporal
|
||||
* @name compress
|
||||
* @memberof Pattern.prototype
|
||||
* @example
|
||||
* cat(
|
||||
* s("bd sd").compress(.25,.75),
|
||||
@@ -2320,6 +2345,7 @@ export const { compressSpan, compressspan } = register(['compressSpan', 'compres
|
||||
* @tags temporal
|
||||
* @name fastGap
|
||||
* @synonyms fastgap
|
||||
* @memberof Pattern.prototype
|
||||
* @example
|
||||
* s("bd sd").fastGap(2)
|
||||
*/
|
||||
@@ -2356,6 +2382,7 @@ export const { fastGap, fastgap } = register(['fastGap', 'fastgap'], function (f
|
||||
/**
|
||||
* Similar to `compress`, but doesn't leave gaps, and the 'focus' can be bigger than a cycle
|
||||
* @tags temporal
|
||||
* @memberof Pattern.prototype
|
||||
* @example
|
||||
* s("bd hh sd hh").focus(1/4, 3/4)
|
||||
*/
|
||||
@@ -2374,6 +2401,8 @@ export const { focusSpan, focusspan } = register(['focusSpan', 'focusspan'], fun
|
||||
|
||||
/** The ply function repeats each event the given number of times.
|
||||
* @tags temporal
|
||||
* @name ply
|
||||
* @memberof Pattern.prototype
|
||||
* @example
|
||||
* s("bd ~ sd cp").ply("<1 2 3>")
|
||||
*/
|
||||
@@ -2433,6 +2462,8 @@ export const { slow, sparsity } = register(['slow', 'sparsity'], function (facto
|
||||
/**
|
||||
* Carries out an operation 'inside' a cycle.
|
||||
* @tags temporal
|
||||
* @name inside
|
||||
* @memberof Pattern.prototype
|
||||
* @example
|
||||
* "0 1 2 3 4 3 2 1".inside(4, rev).scale('C major').note()
|
||||
* // "0 1 2 3 4 3 2 1".slow(4).rev().fast(4).scale('C major').note()
|
||||
@@ -2444,6 +2475,8 @@ export const inside = register('inside', function (factor, f, pat) {
|
||||
/**
|
||||
* Carries out an operation 'outside' a cycle.
|
||||
* @tags temporal
|
||||
* @name outside
|
||||
* @memberof Pattern.prototype
|
||||
* @example
|
||||
* "<[0 1] 2 [3 4] 5>".outside(4, rev).scale('C major').note()
|
||||
* // "<[0 1] 2 [3 4] 5>".fast(4).rev().slow(4).scale('C major').note()
|
||||
@@ -2502,6 +2535,7 @@ export const { firstOf, every } = register(['firstOf', 'every'], function (n, fu
|
||||
* Applies the given function to the pattern. Like layer, but with a single function:
|
||||
* @tags combiners
|
||||
* @name apply
|
||||
* @memberof Pattern.prototype
|
||||
* @example
|
||||
* "<c3 eb3 g3>".scale('C minor').apply(scaleTranspose("0,2,4")).note()
|
||||
*/
|
||||
@@ -2513,6 +2547,8 @@ export const apply = register('apply', function (func, pat) {
|
||||
* Plays the pattern at the given cycles per minute.
|
||||
* @tags temporal
|
||||
* @deprecated
|
||||
* @name cpm
|
||||
* @memberof Pattern.prototype
|
||||
* @example
|
||||
* s("<bd sd>,hh*2").cpm(90) // = 90 bpm
|
||||
*/
|
||||
@@ -2567,6 +2603,8 @@ export const late = register(
|
||||
* Plays a portion of a pattern, specified by the beginning and end of a time span. The new resulting pattern is played over the time period of the original pattern:
|
||||
*
|
||||
* @tags temporal
|
||||
* @name zoom
|
||||
* @memberof Pattern.prototype
|
||||
* @example
|
||||
* s("bd*2 hh*3 [sd bd]*2 perc").zoom(0.25, 0.75)
|
||||
* // s("hh*3 [sd bd]*2") // equivalent
|
||||
@@ -2596,6 +2634,7 @@ export const { zoomArc, zoomarc } = register(['zoomArc', 'zoomarc'], function (a
|
||||
* @tags temporal
|
||||
* @param {number} number of slices
|
||||
* @param {number} slices to play
|
||||
* @memberof Pattern.prototype
|
||||
* @example
|
||||
* note("0 1 2 3 4 5 6 7".scale('c:mixolydian'))
|
||||
* .bite(4, "3 2 1 0")
|
||||
@@ -2691,6 +2730,8 @@ export const { isobite, cyclestruct, cycleStruct } = register(
|
||||
* Selects the given fraction of the pattern and repeats that part to fill the remainder of the cycle.
|
||||
* @tags temporal
|
||||
* @param {number} fraction fraction to select
|
||||
* @name linger
|
||||
* @memberof Pattern.prototype
|
||||
* @example
|
||||
* s("lt ht mt cp, [hh oh]*2").linger("<1 .5 .25 .125>")
|
||||
*/
|
||||
@@ -2714,6 +2755,7 @@ export const linger = register(
|
||||
* @name segment
|
||||
* @synonyms seg
|
||||
* @param {number} segments number of segments per cycle
|
||||
* @memberof Pattern.prototype
|
||||
* @example
|
||||
* note(saw.range(40,52).segment(24))
|
||||
*/
|
||||
@@ -2726,6 +2768,8 @@ export const { segment, seg } = register(['segment', 'seg'], function (rate, pat
|
||||
* @tags temporal
|
||||
* @param {number} subdivision
|
||||
* @param {number} offset
|
||||
* @name swingBy
|
||||
* @memberof Pattern.prototype
|
||||
* @example
|
||||
* s("hh*8").swingBy(1/3, 4)
|
||||
*/
|
||||
@@ -2737,6 +2781,8 @@ export const swingBy = register('swingBy', (swing, n, pat) =>
|
||||
* Shorthand for swingBy with 1/3:
|
||||
* @tags temporal
|
||||
* @param {number} subdivision
|
||||
* @name swing
|
||||
* @memberof Pattern.prototype
|
||||
* @example
|
||||
* s("hh*8").swing(4)
|
||||
* // s("hh*8").swingBy(1/3, 4)
|
||||
@@ -2748,6 +2794,7 @@ export const swing = register('swing', (n, pat) => pat.swingBy(1 / 3, n));
|
||||
* @tags temporal
|
||||
* @name invert
|
||||
* @synonyms inv
|
||||
* @memberof Pattern.prototype
|
||||
* @example
|
||||
* s("bd").struct("1 0 0 1 0 0 1 0".lastOf(4, invert))
|
||||
*/
|
||||
@@ -2862,6 +2909,7 @@ export const revv = register('revv', function (pat) {
|
||||
* event is shifted. pressBy(0.5) is the same as press, while
|
||||
* pressBy(1/3) shifts each event by a third of its timespan.
|
||||
* @tags temporal
|
||||
* @memberof Pattern.prototype
|
||||
* @example
|
||||
* stack(s("hh*4"),
|
||||
* s("bd mt sd ht").pressBy("<0 0.5 0.25>")
|
||||
@@ -2874,6 +2922,7 @@ export const pressBy = register('pressBy', function (r, pat) {
|
||||
/**
|
||||
* Syncopates a rhythm, by shifting each event halfway into its timespan.
|
||||
* @tags temporal
|
||||
* @memberof Pattern.prototype
|
||||
* @example
|
||||
* stack(s("hh*4"),
|
||||
* s("bd mt sd ht").every(4, press)
|
||||
@@ -2886,7 +2935,6 @@ export const press = register('press', function (pat) {
|
||||
/**
|
||||
* Silences a pattern.
|
||||
* @tags temporal
|
||||
* @memberof Pattern.prototype
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* stack(
|
||||
@@ -2901,6 +2949,8 @@ Pattern.prototype.hush = function () {
|
||||
/**
|
||||
* Applies `rev` to a pattern every other cycle, so that the pattern alternates between forwards and backwards.
|
||||
* @tags temporal
|
||||
* @name palindrome
|
||||
* @memberof Pattern.prototype
|
||||
* @example
|
||||
* note("c d e g").palindrome()
|
||||
*/
|
||||
@@ -2921,6 +2971,7 @@ export const palindrome = register(
|
||||
* @param {number} times how many times to repeat
|
||||
* @param {number} time cycle offset between iterations
|
||||
* @param {Function} func function to apply, given the pattern and the iteration index
|
||||
* @memberof Pattern.prototype
|
||||
* @example
|
||||
* "<0 [2 4]>"
|
||||
* .echoWith(4, 1/8, (p,n) => p.add(n*2))
|
||||
@@ -2948,6 +2999,7 @@ export const applyN = register('applyN', function (n, func, p) {
|
||||
* @synonyms plywith
|
||||
* @param {number} factor how many times to repeat
|
||||
* @param {Function} func function to apply, given the pattern
|
||||
* @memberof Pattern.prototype
|
||||
* @example
|
||||
* "<0 [2 4]>"
|
||||
* .plyWith(4, (p) => p.add(2))
|
||||
@@ -2971,6 +3023,7 @@ export const plyWith = register(['plyWith', 'plywith'], function (factor, func,
|
||||
* @synonyms plyforeach
|
||||
* @param {number} factor how many times to repeat
|
||||
* @param {Function} func function to apply, given the pattern and the iteration index
|
||||
* @memberof Pattern.prototype
|
||||
* @example
|
||||
* "<0 [2 4]>"
|
||||
* .plyForEach(4, (p,n) => p.add(n*2))
|
||||
@@ -3188,6 +3241,7 @@ export const bypass = register(
|
||||
* @synonyms rib
|
||||
* @param {number} offset start point of loop in cycles
|
||||
* @param {number} cycles loop length in cycles
|
||||
* @memberof Pattern.prototype
|
||||
* @example
|
||||
* note("<c d e f>").ribbon(1, 2)
|
||||
* @example
|
||||
@@ -3224,6 +3278,7 @@ Pattern.prototype.tag = function (tag) {
|
||||
* @name filter
|
||||
* @tags temporal, functional
|
||||
* @param {Function} test function to test Hap
|
||||
* @memberof Pattern.prototype
|
||||
* @example
|
||||
* s("hh!7 oh").filter(hap => hap.value.s === 'hh')
|
||||
*/
|
||||
@@ -3234,6 +3289,7 @@ export const filter = register('filter', (test, pat) => pat.withHaps((haps) => h
|
||||
* @name filterWhen
|
||||
* @tags temporal, functional
|
||||
* @param {Function} test function to test Hap.whole.begin
|
||||
* @memberof Pattern.prototype
|
||||
* @example
|
||||
* oneCycle: s("bd*4").filterWhen((t) => t < 1)
|
||||
*/
|
||||
@@ -3246,6 +3302,7 @@ export const filterWhen = register('filterWhen', (test, pat) => pat.filter((h) =
|
||||
* @param {number} start start within cycle (0 - 1)
|
||||
* @param {number} end end within cycle (0 - 1). Must be > start
|
||||
* @param {Function} func function to be applied to the sub-pattern
|
||||
* @memberof Pattern.prototype
|
||||
*/
|
||||
export const within = register('within', (a, b, fn, pat) =>
|
||||
stack(
|
||||
@@ -3318,6 +3375,8 @@ export function _match(span, hap_p) {
|
||||
*
|
||||
* Speeds a pattern up or down, to fit to the given number of steps per cycle.
|
||||
* @tags stepwise
|
||||
* @name pace
|
||||
* @memberof Pattern.prototype
|
||||
* @example
|
||||
* sound("bd sd cp").pace(4)
|
||||
* // The same as sound("{bd sd cp}%4") or sound("<bd sd cp>*4")
|
||||
@@ -3393,6 +3452,7 @@ export function polymeter(...args) {
|
||||
/** 'Concatenates' patterns like `fastcat`, but proportional to a number of steps per cycle.
|
||||
* The steps can either be inferred from the pattern, or provided as a [length, pattern] pair.
|
||||
* Has the alias `timecat`.
|
||||
* @global
|
||||
* @param {...any} timepats
|
||||
* @name stepcat
|
||||
* @tags stepwise
|
||||
@@ -3453,6 +3513,7 @@ export function stepcat(...timepats) {
|
||||
* Concatenates patterns stepwise, according to an inferred 'steps per cycle'.
|
||||
* Similar to `stepcat`, but if an argument is a list, the whole pattern will alternate between the elements in the list.
|
||||
*
|
||||
* @global
|
||||
* @param {...any} groups
|
||||
* @tags stepwise
|
||||
* @returns {Pattern}
|
||||
@@ -3482,6 +3543,8 @@ export function stepalt(...groups) {
|
||||
* Takes the given number of steps from a pattern (dropping the rest).
|
||||
* A positive number will take steps from the start of a pattern, and a negative number from the end.
|
||||
* @tags stepwise
|
||||
* @name take
|
||||
* @memberof Pattern.prototype
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* "bd cp ht mt".take("2").sound()
|
||||
@@ -3526,8 +3589,10 @@ export const take = stepRegister('take', function (i, pat) {
|
||||
*
|
||||
* Drops the given number of steps from a pattern.
|
||||
* A positive number will drop steps from the start of a pattern, and a negative number from the end.
|
||||
* @name drop
|
||||
* @tags stepwise
|
||||
* @returns {Pattern}
|
||||
* @memberof Pattern.prototype
|
||||
* @example
|
||||
* "tha dhi thom nam".drop("1").sound().bank("mridangam")
|
||||
* @example
|
||||
@@ -3555,7 +3620,9 @@ export const drop = stepRegister('drop', function (i, pat) {
|
||||
* `extend` is similar to `fast` in that it increases its density, but it also increases the step count
|
||||
* accordingly. So `stepcat("a b".extend(2), "c d")` would be the same as `"a b a b c d"`, whereas
|
||||
* `stepcat("a b".fast(2), "c d")` would be the same as `"[a b] [a b] c d"`.
|
||||
* @name extend
|
||||
* @tags stepwise
|
||||
* @memberof Pattern.prototype
|
||||
* @example
|
||||
* stepcat(
|
||||
* sound("bd bd - <cp hh>").extend(2),
|
||||
@@ -3572,6 +3639,7 @@ export const extend = stepRegister('extend', function (factor, pat) {
|
||||
* `replicate` is similar to `extend`, except that `replicate` will "replicate" the thing being extended. This will only differ from `extend` when the input pattern differs from cycle to cycle.
|
||||
*
|
||||
* @tags stepwise
|
||||
* @memberof Pattern.prototype
|
||||
* @example
|
||||
* stepcat(
|
||||
* sound("bd bd - <cp hh>").replicate(2),
|
||||
@@ -3586,7 +3654,9 @@ export const replicate = stepRegister('replicate', function (factor, pat) {
|
||||
* *Experimental*
|
||||
*
|
||||
* Expands the step size of the pattern by the given factor.
|
||||
* @name expand
|
||||
* @tags stepwise
|
||||
* @memberof Pattern.prototype
|
||||
* @example
|
||||
* sound("tha dhi thom nam").bank("mridangam").expand("3 2 1 1 2 3").pace(8)
|
||||
*/
|
||||
@@ -3599,6 +3669,8 @@ export const expand = stepRegister('expand', function (factor, pat) {
|
||||
*
|
||||
* Contracts the step size of the pattern by the given factor. See also `expand`.
|
||||
* @tags stepwise
|
||||
* @name contract
|
||||
* @memberof Pattern.prototype
|
||||
* @example
|
||||
* sound("tha dhi thom nam").bank("mridangam").contract("3 2 1 1 2 3").pace(8)
|
||||
*/
|
||||
@@ -3660,6 +3732,8 @@ export const growlist = (amount, pat) => pat.growlist(amount);
|
||||
* A positive number will progressively drop steps from the start of a pattern, and a negative number from the end.
|
||||
* @tags stepwise
|
||||
* @returns {Pattern}
|
||||
* @name shrink
|
||||
* @memberof Pattern.prototype
|
||||
* @example
|
||||
* "tha dhi thom nam".shrink("1").sound()
|
||||
* .bank("mridangam")
|
||||
@@ -3700,6 +3774,8 @@ export const shrink = register(
|
||||
* A positive number will progressively grow steps from the start of a pattern, and a negative number from the end.
|
||||
* @tags stepwise
|
||||
* @returns {Pattern}
|
||||
* @name grow
|
||||
* @memberof Pattern.prototype
|
||||
* @example
|
||||
* "tha dhi thom nam".grow("1").sound()
|
||||
* .bank("mridangam")
|
||||
@@ -3743,6 +3819,8 @@ export const grow = register(
|
||||
* @param {...any} many
|
||||
* @tags stepwise
|
||||
* @returns {Pattern}
|
||||
* @name tour
|
||||
* @memberof Pattern.prototype
|
||||
* @example
|
||||
* "[c g]".tour("e f", "e f g", "g f e c").note()
|
||||
* .sound("folkharp")
|
||||
@@ -3769,6 +3847,7 @@ Pattern.prototype.tour = function (...many) {
|
||||
* Using `pace` to set the number of steps per cycle is therefore usually recommended.
|
||||
*
|
||||
* @param {...any} pats
|
||||
* @global
|
||||
* @tags stepwise
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
@@ -3783,7 +3862,7 @@ export const zip = function (...pats) {
|
||||
return zipped._fast(steps).setSteps(steps);
|
||||
};
|
||||
|
||||
/** Aliases for `stepcat` */
|
||||
// Aliases for `stepcat`
|
||||
export const timecat = stepcat;
|
||||
export const timeCat = stepcat;
|
||||
|
||||
@@ -3827,18 +3906,6 @@ export const ref = (accessor) =>
|
||||
.withValue(() => reify(accessor()))
|
||||
.innerJoin();
|
||||
|
||||
/**
|
||||
* creates a structure pattern from divisions of a cycle
|
||||
* especially useful for creating rhythms
|
||||
* @param {Function} join
|
||||
* @name beat
|
||||
* @tags temporal
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* s("bd").beat("0,7,10", 16)
|
||||
* @example
|
||||
* s("sd").beat("4,12", 16)
|
||||
*/
|
||||
const __beat = (join) => (t, div, pat) => {
|
||||
t = Fraction(t).mod(div);
|
||||
div = Fraction(div);
|
||||
@@ -3847,6 +3914,23 @@ const __beat = (join) => (t, div, pat) => {
|
||||
return join(pat.fmap((x) => pure(x)._compress(b, e)));
|
||||
};
|
||||
|
||||
/**
|
||||
* Changes the structure of a pattern by dividing the cycle into equal segments (total number of beats) and allowing to specify at which segment (beat) the pattern is played.
|
||||
* @param {number[] | Pattern} beat - sections of the beat that should play the sound. Multiple beats can be stacked in a pattern
|
||||
* @param {number} number of total beats to divide the cycle into
|
||||
* @name beat
|
||||
* @tags temporal
|
||||
* @returns {Pattern}
|
||||
* @memberof Pattern.prototype
|
||||
* @example
|
||||
* s("bd").beat("0,7,10", 16)
|
||||
* @example
|
||||
* s("sd").beat("4,12", 16)
|
||||
* @example
|
||||
* s("sd").beat("0,3,6", 8)
|
||||
* //same as
|
||||
* s("sd - - sd - - sd -")
|
||||
*/
|
||||
export const { beat } = register(
|
||||
['beat'],
|
||||
__beat((x) => x.innerJoin()),
|
||||
|
||||
+42
-24
@@ -26,12 +26,22 @@ const _pick = function (lookup, pat, modulo = true) {
|
||||
});
|
||||
};
|
||||
|
||||
export const pick = function (lookup, pat) {
|
||||
// backward compatibility - the args used to be flipped
|
||||
if (Array.isArray(pat)) {
|
||||
[pat, lookup] = [lookup, pat];
|
||||
}
|
||||
return __pick(lookup, pat);
|
||||
};
|
||||
|
||||
/** * Picks patterns (or plain values) either from a list (by index) or a lookup table (by name).
|
||||
* Similar to `inhabit`, but maintains the structure of the original patterns.
|
||||
* The lookup can also be a pattern of objects, such as a pattern of controls, in which case each of its events is used as the lookup table.
|
||||
* @tags combiners
|
||||
* @param {Pattern} pat
|
||||
* @param {*} xs
|
||||
* @name pick
|
||||
* @memberof Pattern.prototype
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* note("<0 1 2!2 3>".pick(["g a", "e f", "f g f g" , "g c d"]))
|
||||
@@ -46,15 +56,6 @@ const _pick = function (lookup, pat, modulo = true) {
|
||||
* const pat = sound("bd cp").speed("<2 3>")
|
||||
* pat.fast("speed".pick(pat))
|
||||
*/
|
||||
|
||||
export const pick = function (lookup, pat) {
|
||||
// backward compatibility - the args used to be flipped
|
||||
if (Array.isArray(pat)) {
|
||||
[pat, lookup] = [lookup, pat];
|
||||
}
|
||||
return __pick(lookup, pat);
|
||||
};
|
||||
|
||||
const __pick = register('pick', function (lookup, pat) {
|
||||
return _pick(lookup, pat, false).innerJoin();
|
||||
});
|
||||
@@ -66,9 +67,10 @@ const __pick = register('pick', function (lookup, pat) {
|
||||
* @tags combiners
|
||||
* @param {Pattern} pat
|
||||
* @param {*} xs
|
||||
* @name pickmod
|
||||
* @memberof Pattern.prototype
|
||||
* @returns {Pattern}
|
||||
*/
|
||||
|
||||
export const pickmod = register('pickmod', function (lookup, pat) {
|
||||
return _pick(lookup, pat, true).innerJoin();
|
||||
});
|
||||
@@ -78,6 +80,8 @@ export const pickmod = register('pickmod', function (lookup, pat) {
|
||||
* @param {Pattern} pat
|
||||
* @param {Pattern} lookup a pattern of indices or names
|
||||
* @param {Function[] | object} lookup the array or lookup object of functions from which to pull
|
||||
* @name pickF
|
||||
* @memberof Pattern.prototype
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* s("bd [rim hh]").pickF("<0 1 2>", [rev,jux(rev),fast(2)])
|
||||
@@ -98,6 +102,8 @@ export const pickF = register('pickF', function (pickPattern, lookup, pat) {
|
||||
* @param {Pattern} pat
|
||||
* @param {Pattern} lookup a pattern of indices or names
|
||||
* @param {Function[] | object} lookup the array or lookup object of functions from which to pull
|
||||
* @name pickmodF
|
||||
* @memberof Pattern.prototype
|
||||
* @returns {Pattern}
|
||||
*/
|
||||
export const pickmodF = register('pickmodF', function (pickPattern, lookup, pat) {
|
||||
@@ -108,6 +114,7 @@ export const pickmodF = register('pickmodF', function (pickPattern, lookup, pat)
|
||||
* @tags combiners
|
||||
* @param {Pattern} pat
|
||||
* @param {*} xs
|
||||
* @memberof Pattern.prototype
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* note("<0*4 1 2*2 3*3>".pickOut(["g a", "e f", "f g f g" , "g c d"]))
|
||||
@@ -121,6 +128,7 @@ export const pickOut = register('pickOut', function (lookup, pat) {
|
||||
* @tags combiners
|
||||
* @param {Pattern} pat
|
||||
* @param {*} xs
|
||||
* @memberof Pattern.prototype
|
||||
* @returns {Pattern}
|
||||
*/
|
||||
export const pickmodOut = register('pickmodOut', function (lookup, pat) {
|
||||
@@ -131,26 +139,30 @@ export const pickmodOut = register('pickmodOut', function (lookup, pat) {
|
||||
* @tags combiners
|
||||
* @param {Pattern} pat
|
||||
* @param {*} xs
|
||||
* @name pickRestart
|
||||
* @memberof Pattern.prototype
|
||||
* @returns {Pattern}
|
||||
*/
|
||||
export const pickRestart = register('pickRestart', function (lookup, pat) {
|
||||
return _pick(lookup, pat, false).restartJoin();
|
||||
});
|
||||
|
||||
/** * The same as `pickRestart`, but if you pick a number greater than the size of the list,
|
||||
* it wraps around, rather than sticking at the maximum value.
|
||||
* @tags combiners
|
||||
* @param {Pattern} pat
|
||||
* @param {*} xs
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* "<a@2 b@2 c@2 d@2>".pickRestart({
|
||||
a: n("0 1 2 0"),
|
||||
b: n("2 3 4 ~"),
|
||||
c: n("[4 5] [4 3] 2 0"),
|
||||
d: n("0 -3 0 ~")
|
||||
}).scale("C:major").s("piano")
|
||||
*/
|
||||
/** The same as `pickRestart`, but if you pick a number greater than the size of the list,
|
||||
* it wraps around, rather than sticking at the maximum value.
|
||||
* @tags combiners
|
||||
* @param {Pattern} pat
|
||||
* @param {*} xs
|
||||
* @name pickmodRestart
|
||||
* @memberof Pattern.prototype
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* "<a@2 b@2 c@2 d@2>".pickRestart({
|
||||
a: n("0 1 2 0"),
|
||||
b: n("2 3 4 ~"),
|
||||
c: n("[4 5] [4 3] 2 0"),
|
||||
d: n("0 -3 0 ~")
|
||||
}).scale("C:major").s("piano")
|
||||
*/
|
||||
export const pickmodRestart = register('pickmodRestart', function (lookup, pat) {
|
||||
return _pick(lookup, pat, true).restartJoin();
|
||||
});
|
||||
@@ -159,6 +171,8 @@ export const pickmodRestart = register('pickmodRestart', function (lookup, pat)
|
||||
* @tags combiners
|
||||
* @param {Pattern} pat
|
||||
* @param {*} xs
|
||||
* @name pickReset
|
||||
* @memberof Pattern.prototype
|
||||
* @returns {Pattern}
|
||||
*/
|
||||
export const pickReset = register('pickReset', function (lookup, pat) {
|
||||
@@ -170,6 +184,8 @@ export const pickReset = register('pickReset', function (lookup, pat) {
|
||||
* @tags combiners
|
||||
* @param {Pattern} pat
|
||||
* @param {*} xs
|
||||
* @name pickmodReset
|
||||
* @memberof Pattern.prototype
|
||||
* @returns {Pattern}
|
||||
*/
|
||||
export const pickmodReset = register('pickmodReset', function (lookup, pat) {
|
||||
@@ -183,6 +199,7 @@ export const pickmodReset = register('pickmodReset', function (lookup, pat) {
|
||||
* @synonyms pickSqueeze
|
||||
* @param {Pattern} pat
|
||||
* @param {*} xs
|
||||
* @memberof Pattern.prototype
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* let a = s("bd(3,8)")
|
||||
@@ -206,6 +223,7 @@ export const { inhabit, pickSqueeze } = register(['inhabit', 'pickSqueeze'], fun
|
||||
* @tags combiners
|
||||
* @param {Pattern} pat
|
||||
* @param {*} xs
|
||||
* @memberof Pattern.prototype
|
||||
* @returns {Pattern}
|
||||
*/
|
||||
|
||||
|
||||
+35
-26
@@ -21,7 +21,6 @@ import TimeSpan from './timespan.mjs';
|
||||
* @returns {Pattern}
|
||||
*/
|
||||
export function steady(value) {
|
||||
// A continuous value
|
||||
return new Pattern((state) => [new Hap(undefined, state.span, value)]);
|
||||
}
|
||||
|
||||
@@ -213,27 +212,6 @@ export const itri2 = fastcat(isaw2, saw2);
|
||||
*/
|
||||
export const time = signal(id);
|
||||
|
||||
/**
|
||||
* The mouse's x position value ranges from 0 to 1.
|
||||
* @name mousex
|
||||
* @synonyms mouseX
|
||||
* @returns {Pattern}
|
||||
* @tags external_io
|
||||
* @example
|
||||
* n(mousex.segment(4).range(0,7)).scale("C:minor")
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* The mouse's y position value ranges from 0 to 1.
|
||||
* @name mousey
|
||||
* @synonyms mouseY
|
||||
* @returns {Pattern}
|
||||
* @tags external_io
|
||||
* @example
|
||||
* n(mousey.segment(4).range(0,7)).scale("C:minor")
|
||||
*
|
||||
*/
|
||||
let _mouseY = 0,
|
||||
_mouseX = 0;
|
||||
if (typeof window !== 'undefined') {
|
||||
@@ -244,8 +222,29 @@ if (typeof window !== 'undefined') {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* The mouse's y position value ranges from 0 to 1.
|
||||
* @name mousey
|
||||
* @synonyms mouseY
|
||||
* @type {Pattern}
|
||||
* @tags external_io
|
||||
* @example
|
||||
* n(mousey.segment(4).range(0,7)).scale("C:minor")
|
||||
*
|
||||
*/
|
||||
export const mousey = signal(() => _mouseY);
|
||||
export const mouseY = signal(() => _mouseY);
|
||||
|
||||
/**
|
||||
* The mouse's x position value ranges from 0 to 1.
|
||||
* @name mousex
|
||||
* @synonyms mouseX
|
||||
* @type {Pattern}
|
||||
* @tags external_io
|
||||
* @example
|
||||
* n(mousex.segment(4).range(0,7)).scale("C:minor")
|
||||
*
|
||||
*/
|
||||
export const mousex = signal(() => _mouseX);
|
||||
export const mouseX = signal(() => _mouseX);
|
||||
|
||||
@@ -514,6 +513,7 @@ export const withSeed = (func, pat) => {
|
||||
* @name seed
|
||||
* @tags math
|
||||
* @param {number} n A new seed. Can be any number.
|
||||
* @memberof Pattern.prototype
|
||||
* @example
|
||||
* $: s("hh*4").degrade();
|
||||
* $: s("bd*4").degrade().seed(1); // Will degrade different events from the hi-hat
|
||||
@@ -648,6 +648,7 @@ export const chooseIn = (...xs) => chooseInWith(rand, xs);
|
||||
* Chooses from the given list of values (or patterns of values), according
|
||||
* to the pattern that the method is called on. The pattern should be in
|
||||
* the range 0 .. 1.
|
||||
* @name choose
|
||||
* @tags temporal
|
||||
* @param {...any} xs
|
||||
* @memberof Pattern.prototype
|
||||
@@ -660,6 +661,7 @@ Pattern.prototype.choose = function (...xs) {
|
||||
/**
|
||||
* As with choose, but the pattern that this method is called on should be
|
||||
* in the range -1 .. 1
|
||||
* @name choose2
|
||||
* @tags temporal
|
||||
* @param {...any} xs
|
||||
* @memberof Pattern.prototype
|
||||
@@ -1060,7 +1062,6 @@ export const never = register('never', function (_, pat) {
|
||||
});
|
||||
|
||||
/**
|
||||
*
|
||||
* Shorthand for `.sometimesBy(1, fn)` (always calls fn)
|
||||
*
|
||||
* @tags temporal
|
||||
@@ -1074,8 +1075,11 @@ export const always = register('always', function (func, pat) {
|
||||
return func(pat);
|
||||
});
|
||||
|
||||
//keyname: string | Array<string>
|
||||
//keyname reference: https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values
|
||||
/**
|
||||
* checks if a key is down
|
||||
* @param {string | Array<string>} keyname reference: https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function _keyDown(keyname) {
|
||||
if (Array.isArray(keyname) === false) {
|
||||
keyname = [keyname];
|
||||
@@ -1116,7 +1120,6 @@ export const whenKey = register('whenKey', function (input, func, pat) {
|
||||
* @example
|
||||
* keyDown("Control:j").pick([s("bd(5,8)"), s("cp(3,8)")])
|
||||
*/
|
||||
|
||||
export const keyDown = register('keyDown', function (pat) {
|
||||
return pat.fmap(_keyDown);
|
||||
});
|
||||
@@ -1129,6 +1132,7 @@ export const keyDown = register('keyDown', function (pat) {
|
||||
* See also its reciprocal, `per`, also known as `perCycle`.
|
||||
*
|
||||
* @tags temporal
|
||||
* @type {Pattern}
|
||||
* @example
|
||||
* // Shorter events are lower in pitch
|
||||
* sound("saw saw [saw saw] saw")
|
||||
@@ -1165,8 +1169,10 @@ export const sper = secondsPer;
|
||||
* event durations, from the pattern that it is combined with.
|
||||
* For example `per.struct("1 1 [1 1] 1")` would give the same as `"4 4 [8 8] 4"`.
|
||||
* See also its reciprocal, `cyclesPer`.
|
||||
* @global
|
||||
* @tags temporal
|
||||
* @synonyms perCycle
|
||||
* @type {Pattern}
|
||||
* @example
|
||||
* // Shorter events are more distorted
|
||||
* n("0 0*2 0 0*2 0 [0 0 0]@2").sound("bd")
|
||||
@@ -1184,6 +1190,7 @@ export const perCycle = per;
|
||||
* returned value increases by one. `perx.struct("1 1 [1 [1 1]] 1")` would therefore be
|
||||
* the same as `"3 3 [4 [5 5]] 3"`.
|
||||
* @tags temporal
|
||||
* @type {Pattern}
|
||||
*/
|
||||
export const perx = new Pattern(function (state) {
|
||||
const n = Fraction(1).div(state.span.duration);
|
||||
@@ -1195,6 +1202,7 @@ export const perx = new Pattern(function (state) {
|
||||
* Mainly useful in combination with other functions that reset the cycle. See also
|
||||
* `close`.
|
||||
* @tags temporal
|
||||
* @type {Pattern}
|
||||
* @example
|
||||
* sound("bd sd [- bd] sd".fast(2))
|
||||
* .lpf(open.slow(4).range(300,3000)) // close envelope over 4 cycles
|
||||
@@ -1206,6 +1214,7 @@ export const open = signal((t) => t.min(1));
|
||||
* The same as `open`, but goes from `1` to `0` over one cycle, and then
|
||||
* stays on `0` forever.
|
||||
* @tags temporal
|
||||
* @type {Pattern}
|
||||
* @example
|
||||
* sound("bd sd [- bd] sd".fast(2))
|
||||
* .lpf(close.slow(4).range(300,3000)) // close envelope over 4 cycles
|
||||
|
||||
@@ -212,6 +212,11 @@ export function curry(func, overload, arity = func.length) {
|
||||
return fn;
|
||||
}
|
||||
|
||||
/**
|
||||
* parses a number. supports midi notes as strings
|
||||
* @param {number | string} numOrString
|
||||
* @returns {number}
|
||||
*/
|
||||
export function parseNumeral(numOrString) {
|
||||
const asNumber = Number(numOrString);
|
||||
if (!isNaN(asNumber)) {
|
||||
@@ -223,10 +228,20 @@ export function parseNumeral(numOrString) {
|
||||
throw new Error(`cannot parse as numeral: "${numOrString}"`);
|
||||
}
|
||||
|
||||
/**
|
||||
* map over the arguments of a function
|
||||
* @param {Function} fn
|
||||
* @param {Function} mapFn
|
||||
* @returns {Function}
|
||||
*/
|
||||
export function mapArgs(fn, mapFn) {
|
||||
return (...args) => fn(...args.map(mapFn));
|
||||
}
|
||||
|
||||
/** converts the arguments of a function into numbers
|
||||
* @param {Function} fn
|
||||
* @returns {Function}
|
||||
*/
|
||||
export function numeralArgs(fn) {
|
||||
return mapArgs(fn, parseNumeral);
|
||||
}
|
||||
@@ -328,7 +343,12 @@ export const sol2note = (n, notation = 'letters') => {
|
||||
return note + oct;
|
||||
};
|
||||
|
||||
// Remove duplicates from list
|
||||
/**
|
||||
* Remove duplicates from list
|
||||
* @template T
|
||||
* @param {T[]} a
|
||||
* @returns {T[]}
|
||||
*/
|
||||
export function uniq(a) {
|
||||
var seen = {};
|
||||
return a.filter(function (item) {
|
||||
@@ -336,14 +356,26 @@ export function uniq(a) {
|
||||
});
|
||||
}
|
||||
|
||||
// Remove duplicates from list, sorting in the process. Mutates argument!
|
||||
/**
|
||||
* Remove duplicate primitives from list, sorting in the process. Mutates argument!
|
||||
* Use {@link uniqsortr} for objects instead.
|
||||
* @template T
|
||||
* @param {T[]} a (only primitives)
|
||||
* @returns {T[]}
|
||||
*/
|
||||
export function uniqsort(a) {
|
||||
return a.sort().filter(function (item, pos, ary) {
|
||||
return !pos || item != ary[pos - 1];
|
||||
});
|
||||
}
|
||||
|
||||
// rational version
|
||||
/**
|
||||
* Remove duplicate objects from list, sorting in the process. Mutates argument!
|
||||
* Use {@link uniqsort} for primitives instead.
|
||||
* @template T
|
||||
* @param {T[]} a (only objects)
|
||||
* @returns {T[]}
|
||||
*/
|
||||
export function uniqsortr(a) {
|
||||
return a
|
||||
.sort((x, y) => x.compare(y))
|
||||
@@ -375,22 +407,47 @@ export function base64ToUnicode(base64String) {
|
||||
return decodedText;
|
||||
}
|
||||
|
||||
/**
|
||||
* converts unicode text into a URL hash
|
||||
* @ignore
|
||||
* @param {string} code
|
||||
* @returns {string}
|
||||
*/
|
||||
export function code2hash(code) {
|
||||
return encodeURIComponent(unicodeToBase64(code));
|
||||
//return '#' + encodeURIComponent(btoa(code));
|
||||
}
|
||||
|
||||
/**
|
||||
* converts the URL hash into unicode text
|
||||
* @ignore
|
||||
* @param {string} hash
|
||||
* @returns {string}
|
||||
*/
|
||||
export function hash2code(hash) {
|
||||
return base64ToUnicode(decodeURIComponent(hash));
|
||||
//return atob(decodeURIComponent(codeParam || ''));
|
||||
}
|
||||
|
||||
/**
|
||||
* maps over the entries of an object
|
||||
* @param {object} obj
|
||||
* @param {Function} fn
|
||||
* @returns {object}
|
||||
*/
|
||||
export function objectMap(obj, fn) {
|
||||
if (Array.isArray(obj)) {
|
||||
return obj.map(fn);
|
||||
}
|
||||
return Object.fromEntries(Object.entries(obj).map(([k, v], i) => [k, fn(v, k, i)]));
|
||||
}
|
||||
|
||||
/**
|
||||
* converts the cycle into seconds
|
||||
* @param {number} cycle
|
||||
* @param {number} cps
|
||||
* @returns {number} `cycle / cps`
|
||||
*/
|
||||
export function cycleToSeconds(cycle, cps) {
|
||||
return cycle / cps;
|
||||
}
|
||||
@@ -454,6 +511,10 @@ export class ClockCollator {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The total time that strudel has been running
|
||||
* @returns {number}
|
||||
*/
|
||||
export function getPerformanceTimeSeconds() {
|
||||
return performance.now() * 0.001;
|
||||
}
|
||||
@@ -474,6 +535,10 @@ export const keyAlias = new Map([
|
||||
]);
|
||||
let keyState;
|
||||
|
||||
/**
|
||||
* returns the all the keys currently being pressed or released
|
||||
* @returns {object | void}
|
||||
*/
|
||||
export function getCurrentKeyboardState() {
|
||||
if (keyState == null) {
|
||||
keyState = {};
|
||||
@@ -513,8 +578,13 @@ export function getCurrentKeyboardState() {
|
||||
// return lcm((x * y) / gcd(x, y), ...z);
|
||||
// };
|
||||
|
||||
// Takes values -- typically derived from events, i.e. `hap`s -- and renders them
|
||||
// into a readable format
|
||||
/**
|
||||
* Takes values -- typically derived from events, i.e. `hap`s -- and renders them
|
||||
* into a readable format
|
||||
* @param {*} value
|
||||
* @param {boolean} [compact=false] creates a compacter version
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function stringifyValues(value, compact = false) {
|
||||
return typeof value === 'object'
|
||||
? compact
|
||||
|
||||
@@ -7,6 +7,12 @@ This program is free software: you can redistribute it and/or modify it under th
|
||||
import { curry } from './util.mjs';
|
||||
import { logger } from './logger.mjs';
|
||||
|
||||
/** combine two objects into one
|
||||
* @param {object} a
|
||||
* @param {object} b
|
||||
* @param {Function} func
|
||||
* @returns {object}
|
||||
*/
|
||||
export function unionWithObj(a, b, func) {
|
||||
if (b?.value !== undefined && Object.keys(b).length === 1) {
|
||||
// https://codeberg.org/uzu/strudel/issues/1026
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@strudel/repl",
|
||||
"version": "1.3.0",
|
||||
"version": "1.4.0",
|
||||
"description": "Strudel REPL as a Web Component",
|
||||
"module": "index.mjs",
|
||||
"publishConfig": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@strudel/sampler",
|
||||
"version": "0.2.4",
|
||||
"version": "0.3.0",
|
||||
"description": "",
|
||||
"keywords": [
|
||||
"tidalcycles",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@strudel/serial",
|
||||
"version": "1.2.6",
|
||||
"version": "1.3.0",
|
||||
"description": "Webserial API for strudel",
|
||||
"main": "serial.mjs",
|
||||
"type": "module",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@strudel/soundfonts",
|
||||
"version": "1.3.0",
|
||||
"version": "1.4.0",
|
||||
"description": "Soundsfont support for strudel",
|
||||
"main": "index.mjs",
|
||||
"publishConfig": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "superdough",
|
||||
"version": "1.3.0",
|
||||
"version": "1.4.0",
|
||||
"description": "simple web audio synth and sampler intended for live coding. inspired by superdirt and webdirt.",
|
||||
"main": "index.mjs",
|
||||
"type": "module",
|
||||
|
||||
@@ -35,7 +35,7 @@ function humanFileSize(bytes, si) {
|
||||
* Has optional param `n` (for instance, the `2` in `s("casio:2")`)
|
||||
*
|
||||
* Note: `must` be called with await, otherwise you'll get a pending Promise object.
|
||||
*
|
||||
* @global
|
||||
* @name getDuration
|
||||
* @synonyms getDur
|
||||
* @tags samples
|
||||
@@ -260,6 +260,7 @@ export async function fetchSampleMap(url) {
|
||||
/**
|
||||
* Loads a collection of samples to use with `s`
|
||||
* @tags samples
|
||||
* @global
|
||||
* @example
|
||||
* samples('github:tidalcycles/dirt-samples');
|
||||
* s("[bd ~]*2, [~ hh]*2, ~ sd")
|
||||
|
||||
@@ -39,6 +39,7 @@ export let maxPolyphony = DEFAULT_MAX_POLYPHONY;
|
||||
* start to die out in first-in-first-out order once the max polyphony has been hit
|
||||
*
|
||||
* @name setMaxPolyphony
|
||||
* @global
|
||||
* @tags superdough
|
||||
* @param {number} polyphony Max polyphony. Defaults to 128
|
||||
* @example
|
||||
@@ -76,7 +77,7 @@ export function applyGainCurve(val) {
|
||||
/**
|
||||
* Apply a function to all gains provided in patterns. Can be used to rescale gain to be
|
||||
* quadratic, exponential, etc. rather than linear
|
||||
*
|
||||
* @global
|
||||
* @name setGainCurve
|
||||
* @tags amplitude, superdough
|
||||
* @param {Function} newGainCurveFunc function to apply to all gain values
|
||||
@@ -130,9 +131,10 @@ async function aliasBankPath(path) {
|
||||
|
||||
/**
|
||||
* Register an alias for a bank of sounds.
|
||||
* @global
|
||||
* @param {...any} args either one or two arguments. first argument is bank to alias. Second argument is alias to use for the bank.
|
||||
* Optionally accepts a single argument map of bank aliases.
|
||||
* Optionally accepts a single argument string of a path to a JSON file containing bank aliases.
|
||||
* @param {...any} args either one or two arguments. first argument is bank to alias. Second argument is alias to use for the bank.
|
||||
* @returns {void}
|
||||
* @tags samples
|
||||
*/
|
||||
@@ -153,6 +155,7 @@ export async function aliasBank(...args) {
|
||||
|
||||
/**
|
||||
* Register an alias for a sound.
|
||||
* @global
|
||||
* @tags samples
|
||||
* @param {string} original - The original sound name
|
||||
* @param {string} alias - The alias to use for the sound
|
||||
|
||||
@@ -111,6 +111,7 @@ export function getCommonSampleInfo(hapValue, bank) {
|
||||
}
|
||||
|
||||
/** Selects entries from `source` and renames them via `map`
|
||||
* @global
|
||||
* @tags internals
|
||||
* @param {object} source
|
||||
* @param {*} map
|
||||
|
||||
@@ -184,7 +184,7 @@ export function registerWaveTable(key, tables, params) {
|
||||
|
||||
/**
|
||||
* Loads a collection of wavetables to use with `s`
|
||||
*
|
||||
* @global
|
||||
* @param {string} url
|
||||
* @param {*} frameLen
|
||||
* @param {string} json
|
||||
|
||||
@@ -850,6 +850,8 @@ registerProcessor('pulse-oscillator', PulseOscillatorProcessor);
|
||||
|
||||
/** BYTE BEATS
|
||||
* @tags internals
|
||||
* @global
|
||||
* @typedef Chyx
|
||||
*/
|
||||
const chyx = {
|
||||
/*bit*/ bitC: function (x, y, z) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@strudel/tonal",
|
||||
"version": "1.2.6",
|
||||
"version": "1.3.0",
|
||||
"description": "Tonal functions for strudel",
|
||||
"main": "index.mjs",
|
||||
"publishConfig": {
|
||||
|
||||
@@ -196,6 +196,7 @@ export const rootNotes = register('rootNotes', function (octave, pat) {
|
||||
* @name voicing
|
||||
* @tags tonal
|
||||
* @returns {Pattern}
|
||||
* @memberof Pattern.prototype
|
||||
* @example
|
||||
* n("0 1 2 3").chord("<C Am F G>").voicing()
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@strudel/transpiler",
|
||||
"version": "1.2.6",
|
||||
"version": "1.3.0",
|
||||
"description": "Transpiler for strudel user code. Converts syntactically correct but semantically meaningless JS into evaluatable strudel code.",
|
||||
"main": "index.mjs",
|
||||
"type": "module",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@strudel/web",
|
||||
"version": "1.3.0",
|
||||
"version": "1.4.0",
|
||||
"description": "Easy to setup, opiniated bundle of Strudel for the browser.",
|
||||
"module": "web.mjs",
|
||||
"publishConfig": {
|
||||
|
||||
+37
-3
@@ -12,7 +12,10 @@ import { initAudioOnFirstClick, registerSynthSounds, webaudioRepl } from '@strud
|
||||
import { evaluate as _evaluate, transpiler } from '@strudel/transpiler';
|
||||
import { miniAllStrings } from '@strudel/mini';
|
||||
|
||||
// init logic
|
||||
/**
|
||||
* init logic
|
||||
* @global
|
||||
*/
|
||||
export async function defaultPrebake() {
|
||||
const loadModules = evalScope(
|
||||
evalScope,
|
||||
@@ -30,6 +33,28 @@ export async function defaultPrebake() {
|
||||
let initDone;
|
||||
|
||||
let repl;
|
||||
/** initiates strudel
|
||||
* @global
|
||||
* @param {object} options
|
||||
* @param {*} options.onSchedule
|
||||
* @param {*} options.defaultOutput
|
||||
* @param {*} options.onEvalError
|
||||
* @param {*} options.beforeEval
|
||||
* @param {*} options.beforeStart
|
||||
* @param {*} options.afterEval
|
||||
* @param {*} options.getTime
|
||||
* @param {*} options.transpiler
|
||||
* @param {*} options.onToggle
|
||||
* @param {*} options.editPattern
|
||||
* @param {*} options.onUpdateState
|
||||
* @param {*} options.sync = false
|
||||
* @param {*} options.setInterval
|
||||
* @param {*} options.clearInterval
|
||||
* @param {*} options.id
|
||||
* @param {*} options.mondo = false
|
||||
* @param {*} options.prebake
|
||||
* @returns {object}
|
||||
*/
|
||||
export function initStrudel(options = {}) {
|
||||
initAudioOnFirstClick();
|
||||
options.miniAllStrings !== false && miniAllStrings();
|
||||
@@ -58,12 +83,21 @@ Pattern.prototype.play = function () {
|
||||
return this;
|
||||
};
|
||||
|
||||
// stop playback
|
||||
/**
|
||||
* stop playback
|
||||
* @global
|
||||
*/
|
||||
export function hush() {
|
||||
repl.stop();
|
||||
}
|
||||
|
||||
// evaluate and play the given code using the transpiler
|
||||
/**
|
||||
* evaluate and play the given code using the transpiler
|
||||
* @global
|
||||
* @param {*} code
|
||||
* @param {*} autoplay
|
||||
* @returns {*}
|
||||
*/
|
||||
export async function evaluate(code, autoplay = true) {
|
||||
return repl.evaluate(code, autoplay);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@strudel/webaudio",
|
||||
"version": "1.3.0",
|
||||
"version": "1.4.0",
|
||||
"description": "Web Audio helpers for Strudel",
|
||||
"main": "index.mjs",
|
||||
"type": "module",
|
||||
|
||||
@@ -99,6 +99,7 @@ function clearScreen(smear = 0, smearRGB = `0,0,0`, ctx = getDrawContext()) {
|
||||
* Renders an oscilloscope for the frequency domain of the audio signal.
|
||||
* @name fscope
|
||||
* @tags visualization
|
||||
* @memberof Pattern.prototype
|
||||
* @param {object} config object that may have the following arguments
|
||||
* @param {string} config.color line color as hex or color name. defaults to white.
|
||||
* @param {number} config.scale scales the y-axis. Defaults to 0.25
|
||||
@@ -124,6 +125,7 @@ Pattern.prototype.fscope = function (config = {}) {
|
||||
/**
|
||||
* Renders an oscilloscope for the time domain of the audio signal.
|
||||
* @name scope
|
||||
* @memberof Pattern.prototype
|
||||
* @synonyms tscope
|
||||
* @tags visualization
|
||||
* @param {object} config optional config with options:
|
||||
|
||||
@@ -5,6 +5,7 @@ import { analysers, getAnalyzerData } from 'superdough';
|
||||
/**
|
||||
* Renders a spectrum analyzer for the incoming audio signal.
|
||||
* @name spectrum
|
||||
* @memberof Pattern.prototype
|
||||
* @tags visualization
|
||||
* @param {object} config optional config with options:
|
||||
* @param {number} [thickness=3] line thickness in px (default 3)
|
||||
|
||||
@@ -93,7 +93,7 @@ export async function renderPatternAudio(
|
||||
|
||||
/**
|
||||
* Renders a whole pattern to an OfflineAudioContext in one go.
|
||||
*
|
||||
* @global
|
||||
* @param {OfflineAudioContext} audioContext The OfflineAudioContext to render to
|
||||
* @param {Pattern} pattern The pattern to render
|
||||
* @param {ExportCheckpoint[]} checkpoints A list of checkpoints indicating the cps changes throughout the song
|
||||
@@ -122,7 +122,7 @@ async function renderPatternAudioWhole(audioContext, pattern, checkpoints) {
|
||||
* overall audio graph smaller.
|
||||
*
|
||||
* Not suppoerted on Firefox
|
||||
*
|
||||
* @global
|
||||
* @param {OfflineAudioContext} audioContext
|
||||
* @param {Pattern} pattern
|
||||
* @param {ExportCheckpoint[]} checkpoints
|
||||
@@ -184,7 +184,7 @@ async function renderPatternAudioInChunks(audioContext, pattern, checkpoints) {
|
||||
|
||||
/**
|
||||
* Schedule all haps between 2 checkpoints
|
||||
*
|
||||
* @global
|
||||
* @param {Pattern} pattern The pattern to render
|
||||
* @param {number} chunkStartTime The time in seconds where the chunk starts
|
||||
* @param {ExportCheckpoint} checkpointA The starting checkpoint of the chunk
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@strudel/websocket",
|
||||
"version": "1.0.0",
|
||||
"version": "1.1.0",
|
||||
"description": "Websocket input for strudel",
|
||||
"main": "index.mjs",
|
||||
"type": "module",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@strudel/xen",
|
||||
"version": "1.2.6",
|
||||
"version": "1.3.0",
|
||||
"description": "Xenharmonic API for strudel",
|
||||
"main": "index.mjs",
|
||||
"type": "module",
|
||||
|
||||
@@ -7,7 +7,12 @@ This program is free software: you can redistribute it and/or modify it under th
|
||||
import { register, _mod, parseNumeral, removeUndefineds, Pattern, parray, State } from '@strudel/core';
|
||||
import Tune from './tunejs.js';
|
||||
|
||||
// returns a list of frequency ratios for given edo scale
|
||||
/**
|
||||
* returns a list of frequency ratios for given edo scale
|
||||
* @param {string} name
|
||||
* @returns {number[]}
|
||||
* @global
|
||||
*/
|
||||
export function edo(name) {
|
||||
if (!/^[1-9]+[0-9]*edo$/.test(name)) {
|
||||
throw new Error('not an edo scale: "' + name + '"');
|
||||
|
||||
@@ -1,5 +1,98 @@
|
||||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
||||
|
||||
exports[`runs examples > example "__pick" example index 0 1`] = `
|
||||
[
|
||||
"[ 0/1 → 1/2 | note:g ]",
|
||||
"[ 1/2 → 1/1 | note:a ]",
|
||||
"[ 1/1 → 3/2 | note:e ]",
|
||||
"[ 3/2 → 2/1 | note:f ]",
|
||||
"[ 2/1 → 9/4 | note:f ]",
|
||||
"[ 9/4 → 5/2 | note:g ]",
|
||||
"[ 5/2 → 11/4 | note:f ]",
|
||||
"[ 11/4 → 3/1 | note:g ]",
|
||||
"[ 3/1 → 13/4 | note:f ]",
|
||||
"[ 13/4 → 7/2 | note:g ]",
|
||||
"[ 7/2 → 15/4 | note:f ]",
|
||||
"[ 15/4 → 4/1 | note:g ]",
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`runs examples > example "__pick" example index 1 1`] = `
|
||||
[
|
||||
"[ 0/1 → 1/2 | s:bd ]",
|
||||
"[ 1/2 → 1/1 | s:sd ]",
|
||||
"[ 1/1 → 3/2 | s:cp ]",
|
||||
"[ 3/2 → 2/1 | s:cp ]",
|
||||
"[ 2/1 → 5/2 | s:hh ]",
|
||||
"[ 2/1 → 5/2 | s:bd ]",
|
||||
"[ 5/2 → 3/1 | s:hh ]",
|
||||
"[ 5/2 → 3/1 | s:sd ]",
|
||||
"[ 3/1 → 7/2 | s:bd ]",
|
||||
"[ 7/2 → 4/1 | s:sd ]",
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`runs examples > example "__pick" example index 2 1`] = `
|
||||
[
|
||||
"[ 0/1 → 1/8 | s:bd ]",
|
||||
"[ 3/8 → 1/2 | s:bd ]",
|
||||
"[ 3/4 → 7/8 | s:bd ]",
|
||||
"[ 1/1 → 9/8 | s:bd ]",
|
||||
"[ 11/8 → 3/2 | s:bd ]",
|
||||
"[ 7/4 → 15/8 | s:bd ]",
|
||||
"[ 2/1 → 17/8 | s:bd ]",
|
||||
"[ 2/1 → 5/2 | s:sd ]",
|
||||
"[ 19/8 → 5/2 | s:bd ]",
|
||||
"[ 5/2 → 3/1 | s:sd ]",
|
||||
"[ 11/4 → 23/8 | s:bd ]",
|
||||
"[ 3/1 → 7/2 | s:sd ]",
|
||||
"[ 7/2 → 4/1 | s:sd ]",
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`runs examples > example "__pick" example index 3 1`] = `
|
||||
[
|
||||
"[ 0/1 → 1/8 | s:bd ]",
|
||||
"[ 3/8 → 1/2 | s:bd ]",
|
||||
"[ 3/4 → 7/8 | s:bd ]",
|
||||
"[ 1/1 → 9/8 | s:bd ]",
|
||||
"[ 11/8 → 3/2 | s:bd ]",
|
||||
"[ 7/4 → 15/8 | s:bd ]",
|
||||
"[ 2/1 → 17/8 | s:bd ]",
|
||||
"[ 2/1 → 5/2 | s:sd ]",
|
||||
"[ 19/8 → 5/2 | s:bd ]",
|
||||
"[ 5/2 → 3/1 | s:sd ]",
|
||||
"[ 11/4 → 23/8 | s:bd ]",
|
||||
"[ 3/1 → 7/2 | s:sd ]",
|
||||
"[ 7/2 → 4/1 | s:sd ]",
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`runs examples > example "__pick" example index 4 1`] = `
|
||||
[
|
||||
"[ 0/1 → 1/4 | s:bd speed:2 ]",
|
||||
"[ 1/4 → 1/2 | s:cp speed:2 ]",
|
||||
"[ 1/2 → 3/4 | s:bd speed:3 ]",
|
||||
"[ 3/4 → 1/1 | s:cp speed:3 ]",
|
||||
"[ 1/1 → 7/6 | s:bd speed:3 ]",
|
||||
"[ 7/6 → 4/3 | s:cp speed:3 ]",
|
||||
"[ 4/3 → 3/2 | s:bd speed:2 ]",
|
||||
"[ 3/2 → 5/3 | s:cp speed:2 ]",
|
||||
"[ 5/3 → 11/6 | s:bd speed:3 ]",
|
||||
"[ 11/6 → 2/1 | s:cp speed:3 ]",
|
||||
"[ 2/1 → 9/4 | s:bd speed:2 ]",
|
||||
"[ 9/4 → 5/2 | s:cp speed:2 ]",
|
||||
"[ 5/2 → 11/4 | s:bd speed:3 ]",
|
||||
"[ 11/4 → 3/1 | s:cp speed:3 ]",
|
||||
"[ 3/1 → 19/6 | s:bd speed:3 ]",
|
||||
"[ 19/6 → 10/3 | s:cp speed:3 ]",
|
||||
"[ 10/3 → 7/2 | s:bd speed:2 ]",
|
||||
"[ 7/2 → 11/3 | s:cp speed:2 ]",
|
||||
"[ 11/3 → 23/6 | s:bd speed:3 ]",
|
||||
"[ 23/6 → 4/1 | s:cp speed:3 ]",
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`runs examples > example "_euclidRot" example index 0 1`] = `
|
||||
[
|
||||
"[ 0/1 → 1/5 | note:c3 ]",
|
||||
@@ -1325,6 +1418,23 @@ exports[`runs examples > example "beat" example index 1 1`] = `
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`runs examples > example "beat" example index 2 1`] = `
|
||||
[
|
||||
"[ 0/1 → 1/8 | s:sd ]",
|
||||
"[ 3/8 → 1/2 | s:sd ]",
|
||||
"[ 3/4 → 7/8 | s:sd ]",
|
||||
"[ 1/1 → 9/8 | s:sd ]",
|
||||
"[ 11/8 → 3/2 | s:sd ]",
|
||||
"[ 7/4 → 15/8 | s:sd ]",
|
||||
"[ 2/1 → 17/8 | s:sd ]",
|
||||
"[ 19/8 → 5/2 | s:sd ]",
|
||||
"[ 11/4 → 23/8 | s:sd ]",
|
||||
"[ 3/1 → 25/8 | s:sd ]",
|
||||
"[ 27/8 → 7/2 | s:sd ]",
|
||||
"[ 15/4 → 31/8 | s:sd ]",
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`runs examples > example "begin" example index 0 1`] = `
|
||||
[
|
||||
"[ 0/1 → 1/2 | s:rave begin:0 ]",
|
||||
|
||||
@@ -65,7 +65,7 @@ export default defineConfig({
|
||||
tailwind(),
|
||||
AstroPWA({
|
||||
experimental: { directoryAndTrailingSlashHandler: true },
|
||||
registerType: 'autoUpdate',
|
||||
registerType: 'prompt', // see pwa.ts
|
||||
injectRegister: 'auto',
|
||||
workbox: {
|
||||
maximumFileSizeToCacheInBytes: 4194304, // 4MB
|
||||
|
||||
+63
-17
@@ -2,20 +2,23 @@ import jsdoc from '../../../doc.json'; // doc.json is built with `npm run jsdoc-
|
||||
const docs = jsdoc.docs.reduce((acc, obj) => Object.assign(acc, { [obj.longname]: obj }), {});
|
||||
import { MiniRepl } from './MiniRepl';
|
||||
|
||||
export function JsDoc({ name, h = 3, hideDescription, punchcard, canvasHeight }) {
|
||||
/**
|
||||
*
|
||||
* @param {Object} arguments
|
||||
* @param {number} [arguments.h] Adds a heading (like 3 for h3). Deprecated, add the heading in MDX instead.
|
||||
* @returns
|
||||
*/
|
||||
export function JsDoc({ name, h = undefined, hideDescription, punchcard, canvasHeight, hideMiniRepl }) {
|
||||
const item = docs[name];
|
||||
if (!item) {
|
||||
console.warn('Not found: ' + name);
|
||||
return <div />;
|
||||
console.warn(`JsDoc for ${name} not found`);
|
||||
return <div>Could not load docs for ${name}</div>;
|
||||
}
|
||||
const CustomHeading = `h${h}`;
|
||||
const description =
|
||||
item.description?.replaceAll(/\{@link ([a-zA-Z\.]+)?#?([a-zA-Z]*)\}/g, (_, a, b) => {
|
||||
return `<a href="#${a.replaceAll('.', '').toLowerCase()}${b ? `-${b}` : ''}">${a}${b ? `#${b}` : ''}</a>`;
|
||||
}) || '';
|
||||
const CustomHeading = h ? `h${h}` : undefined;
|
||||
const description = parseAndReplaceLink(item.description ?? '');
|
||||
return (
|
||||
<>
|
||||
{!!h && <CustomHeading>{item.longname}</CustomHeading>}
|
||||
{!!h && <CustomHeading id={name}>{item.longname}</CustomHeading>}
|
||||
{!hideDescription && (
|
||||
<>
|
||||
{!!item.synonyms_text && (
|
||||
@@ -26,19 +29,43 @@ export function JsDoc({ name, h = 3, hideDescription, punchcard, canvasHeight })
|
||||
<div dangerouslySetInnerHTML={{ __html: description }} />
|
||||
</>
|
||||
)}
|
||||
{item.params && item.params.length > 0 && <p className="font-bold">Arguments</p>}
|
||||
<ul>
|
||||
{item.params?.map((param, i) => (
|
||||
<li key={i}>
|
||||
{param.name} ({param.type?.names?.join('|')}): {param.description?.replace(/(<([^>]+)>)/gi, '')}
|
||||
</li>
|
||||
))}
|
||||
{item.params?.map(({ name, type, description }, i) => {
|
||||
// Check if the param is actually the parameter of an object
|
||||
const objParamSeperator = name.indexOf('.');
|
||||
const isObjectParam = objParamSeperator !== -1;
|
||||
|
||||
return (
|
||||
<li key={i} className={isObjectParam ? 'list-none' : ''}>
|
||||
{isObjectParam ? name.substring(objParamSeperator + 1) : name} : {type?.names?.join(' | ')}{' '}
|
||||
{description ? <> - {removeHtmlTags(description)}</> : ''}
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
{item.returns && (
|
||||
<p>
|
||||
<span className="font-bold">Returns</span>{' '}
|
||||
{item.returns
|
||||
.map((returnValue) => {
|
||||
const description = returnValue.description ? `- ${removeHtmlTags(returnValue.description)}` : '';
|
||||
return `${returnValue.type?.names?.join(' | ')} ${description}`;
|
||||
})
|
||||
.join(' or ')}
|
||||
</p>
|
||||
)}
|
||||
|
||||
{item.examples?.length ? (
|
||||
<div className="space-y-2">
|
||||
{item.examples?.map((example, k) => (
|
||||
<MiniRepl tune={example} key={k} {...{ punchcard, canvasHeight }} />
|
||||
))}
|
||||
{item.examples?.map((example, k) => {
|
||||
const key = `${item.longname}_example_${k}`;
|
||||
return hideMiniRepl ? (
|
||||
<pre key={key}>{example}</pre>
|
||||
) : (
|
||||
<MiniRepl tune={example} key={key} {...{ punchcard, canvasHeight }} />
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
) : (
|
||||
<div />
|
||||
@@ -46,3 +73,22 @@ export function JsDoc({ name, h = 3, hideDescription, punchcard, canvasHeight })
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Replaces the jsDocs link with something else.
|
||||
* @param {string} string
|
||||
* @param {(name:string,longname: string) => string} [replaceWith]
|
||||
*/
|
||||
export const parseAndReplaceLink = (string, replaceWith) => {
|
||||
const jsDocsLinkRegex = /\{@link ([a-zA-Z\.#]+)\}/g;
|
||||
const fun = replaceWith ?? ((name, longname) => `<a target="_blank" href="/reference#${longname}">${name}</a>`);
|
||||
|
||||
return string
|
||||
.replaceAll(/<a href="https:\/\//g, `<a target="_blank" href="https://`)
|
||||
.replaceAll(jsDocsLinkRegex, (_, longname) => {
|
||||
const name = [...longname.matchAll(/[a-zA-Z]+[\.#]([a-zA-Z]+)/g)].at(0)?.at(1); //take the string after . or #
|
||||
return fun(name ?? longname, longname);
|
||||
});
|
||||
};
|
||||
|
||||
const removeHtmlTags = (string) => string.replace(/(<([^>]+)>)/gi, '');
|
||||
|
||||
@@ -10,11 +10,15 @@ import { loadModules, setVersionDefaultsFrom } from '../repl/util.mjs';
|
||||
import Claviature from '@components/Claviature';
|
||||
import useClient from '@src/useClient.mjs';
|
||||
|
||||
let prebaked, modulesLoading, audioReady;
|
||||
if (typeof window !== 'undefined') {
|
||||
prebaked = prebake();
|
||||
modulesLoading = loadModules();
|
||||
audioReady = initAudioOnFirstClick();
|
||||
let prebaked, modulesLoading, audioReady, initicated;
|
||||
|
||||
export function initMiniRepl() {
|
||||
if (typeof window !== 'undefined' && !initicated) {
|
||||
prebaked = prebake();
|
||||
modulesLoading = loadModules();
|
||||
audioReady = initAudioOnFirstClick();
|
||||
initicated = true;
|
||||
}
|
||||
}
|
||||
|
||||
export function MiniRepl({
|
||||
@@ -44,6 +48,7 @@ export function MiniRepl({
|
||||
const [activeNotes, setActiveNotes] = useState([]);
|
||||
|
||||
const init = useCallback(({ code, autodraw }) => {
|
||||
initMiniRepl();
|
||||
const drawContext = canvasId ? document.querySelector('#' + canvasId)?.getContext('2d') : getDrawContext();
|
||||
|
||||
const editor = new StrudelMirror({
|
||||
@@ -85,7 +90,7 @@ export function MiniRepl({
|
||||
}
|
||||
},
|
||||
beforeStart: () => audioReady,
|
||||
afterEval: ({ code }) => setVersionDefaultsFrom(code),
|
||||
beforeEval: ({ code }) => setVersionDefaultsFrom(code),
|
||||
mondo,
|
||||
});
|
||||
// init settings
|
||||
|
||||
+66
-66
@@ -1,67 +1,68 @@
|
||||
export const examples = [
|
||||
`// "coastline" @by eddyflux
|
||||
// @version 1.0
|
||||
samples('github:eddyflux/crate')
|
||||
setcps(.75)
|
||||
let chords = chord("<Bbm9 Fm9>/4").dict('ireal')
|
||||
stack(
|
||||
stack( // DRUMS
|
||||
s("bd").struct("<[x*<1 2> [~@3 x]] x>"),
|
||||
s("~ [rim, sd:<2 3>]").room("<0 .2>"),
|
||||
n("[0 <1 3>]*<2!3 4>").s("hh"),
|
||||
s("rd:<1!3 2>*2").mask("<0 0 1 1>/16").gain(.5)
|
||||
).bank('crate')
|
||||
.mask("<[0 1] 1 1 1>/16".early(.5))
|
||||
, // CHORDS
|
||||
chords.offset(-1).voicing().s("gm_epiano1:1")
|
||||
.phaser(4).room(.5)
|
||||
, // MELODY
|
||||
n("<0!3 1*2>").set(chords).mode("root:g2")
|
||||
.voicing().s("gm_acoustic_bass"),
|
||||
chords.n("[0 <4 3 <2 5>>*2](<3 5>,8)")
|
||||
.anchor("D5").voicing()
|
||||
.segment(4).clip(rand.range(.4,.8))
|
||||
.room(.75).shape(.3).delay(.25)
|
||||
.fm(sine.range(3,8).slow(8))
|
||||
.lpf(sine.range(500,1000).slow(8)).lpq(5)
|
||||
.rarely(ply("2")).chunk(4, fast(2))
|
||||
.gain(perlin.range(.6, .9))
|
||||
.mask("<0 1 1 0>/16")
|
||||
)
|
||||
.late("[0 .01]*4").late("[0 .01]*2").size(4)`,
|
||||
// @version 1.0
|
||||
samples('github:eddyflux/crate')
|
||||
setcps(.75)
|
||||
let chords = chord("<Bbm9 Fm9>/4").dict('ireal')
|
||||
|
||||
// DRUMS
|
||||
$: stack(
|
||||
s("bd").struct("<[x*<1 2> [~@3 x]] x>"),
|
||||
s("~ [rim, sd:<2 3>]").room("<0 .2>"),
|
||||
n("[0 <1 3>]*<2!3 4>").s("hh"),
|
||||
s("rd:<1!3 2>*2").mask("<0 0 1 1>/16").gain(.5)
|
||||
).bank('crate')
|
||||
.mask("<[0 1] 1 1 1>/16".early(.5))
|
||||
// CHORDS
|
||||
$: chords.offset(-1).voicing().s("gm_epiano1:1")
|
||||
.phaser(4).room(.5)
|
||||
// BASS
|
||||
$: n("<0!3 1*2>").set(chords).mode("root:g1")
|
||||
.voicing().s("gm_acoustic_bass")
|
||||
// MELODY
|
||||
$: chords.n("[0 <4 3 <2 5>>*2](<3 5>,8)")
|
||||
.anchor("D5").voicing()
|
||||
.segment(4).clip(rand.range(.4,.8))
|
||||
.room(.75).shape(.3).delay(.25)
|
||||
.fm(sine.range(3,8).slow(8))
|
||||
.lpf(sine.range(500,1000).slow(8)).lpq(5)
|
||||
.rarely(ply("2")).chunk(4, fast(2))
|
||||
.gain(perlin.range(.6, .9))
|
||||
.mask("<0 1 1 0>/16")
|
||||
// swing everything
|
||||
all(x=>x.late("[0 .01]*4").late("[0 .01]*2").size(4))`,
|
||||
`// "broken cut 1" @by froos
|
||||
// @version 1.0
|
||||
|
||||
samples('github:tidalcycles/dirt-samples')
|
||||
samples({
|
||||
'slap': 'https://cdn.freesound.org/previews/495/495416_10350281-lq.mp3',
|
||||
'whirl': 'https://cdn.freesound.org/previews/495/495313_10350281-lq.mp3',
|
||||
'attack': 'https://cdn.freesound.org/previews/494/494947_10350281-lq.mp3'
|
||||
})
|
||||
|
||||
setcps(1.25)
|
||||
|
||||
note("[c2 ~](3,8)*2,eb,g,bb,d").s("sawtooth")
|
||||
.noise(0.3)
|
||||
.lpf(perlin.range(800,2000).mul(0.6))
|
||||
.lpenv(perlin.range(1,5)).lpa(.25).lpd(.1).lps(0)
|
||||
.add.mix(note("<0!3 [1 <4!3 12>]>")).late(.5)
|
||||
.vib("4:.2")
|
||||
.room(1).roomsize(4).slow(4)
|
||||
.stack(
|
||||
s("bd").late("<0.01 .251>"),
|
||||
s("breaks165:1/2").fit()
|
||||
.chop(4).sometimesBy(.4, ply("2"))
|
||||
.sometimesBy(.1, ply("4")).release(.01)
|
||||
.gain(1.5).sometimes(mul(speed("1.05"))).cut(1)
|
||||
,
|
||||
s("<whirl attack>?").delay(".8:.1:.8").room(2).slow(8).cut(2),
|
||||
).reset("<x@30 [x*[8 [8 [16 32]]]]@2>".late(2))`,
|
||||
// @version 1.0
|
||||
|
||||
samples('github:tidalcycles/dirt-samples')
|
||||
samples({
|
||||
'slap': 'https://cdn.freesound.org/previews/495/495416_10350281-lq.mp3',
|
||||
'whirl': 'https://cdn.freesound.org/previews/495/495313_10350281-lq.mp3',
|
||||
'attack': 'https://cdn.freesound.org/previews/494/494947_10350281-lq.mp3'
|
||||
})
|
||||
|
||||
setcps(1.25)
|
||||
|
||||
$: note("[c2 ~](3,8)*2,eb,g,bb,d").s("sawtooth")
|
||||
.noise(0.3)
|
||||
.lpf(perlin.range(300,800).mul(0.6)).lpq(10)
|
||||
.lpenv(perlin.range(1,5)).lpa(.25).lpd(.1).lps(0)
|
||||
.add.mix(note("<0!3 [1 <4!3 12>]>")).late(.5)
|
||||
.vib("4:.2")
|
||||
.room(1).roomsize(4).slow(4)
|
||||
$: s("bd").late("<0.01 .251>")
|
||||
$: s("breaks165:1/2").fit()
|
||||
.chop(4).sometimesBy(.4, ply("2"))
|
||||
.sometimesBy(.1, ply("4")).release(.01)
|
||||
.gain(1.5).sometimes(mul(speed("1.05"))).cut(1)
|
||||
|
||||
$: s("<whirl attack>?").delay(".8:.1:.8").room(2).slow(8).cut(2)
|
||||
all(x=>x.reset("<x@30 [x*[8 [8 [16 32]]]]@2>".late(2)))`,
|
||||
`// "acidic tooth" @by eddyflux
|
||||
// @version 1.0
|
||||
// @version 1.0
|
||||
setcps(1)
|
||||
stack(
|
||||
note("[<g1 f1>/8](<3 5>,8)")
|
||||
|
||||
$: note("[<g1 f1>/8](<3 5>,8)")
|
||||
.clip(perlin.range(.15,1.5))
|
||||
.release(.1)
|
||||
.s("sawtooth")
|
||||
@@ -74,11 +75,10 @@ note("[c2 ~](3,8)*2,eb,g,bb,d").s("sawtooth")
|
||||
.room(.2).shape(.3).postgain(.5)
|
||||
.superimpose(x=>x.add(note(12)).delay(.5).bpf(1000))
|
||||
.gain("[.2 1@3]*2") // fake sidechain
|
||||
,
|
||||
stack(
|
||||
s("bd*2").mask("<0@4 1@16>"),
|
||||
s("hh*8").gain(saw.mul(saw.fast(2))).clip(sine)
|
||||
.mask("<0@8 1@16>")
|
||||
).bank('RolandTR909')
|
||||
)`,
|
||||
|
||||
$: stack(
|
||||
s("bd*2").mask("<0@4 1@16>"),
|
||||
s("hh*8").gain(saw.mul(saw.fast(2))).clip(sine)
|
||||
.mask("<0@8 1@16>")
|
||||
).bank('RolandTR909')`,
|
||||
];
|
||||
|
||||
@@ -134,7 +134,7 @@ This group of functions allows to modify the value of events.
|
||||
|
||||
## as
|
||||
|
||||
<JsDoc client:idle name="as" h={0} />
|
||||
<JsDoc client:idle name="Pattern#as" h={0} />
|
||||
|
||||
# Custom Parameters
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ import { JsDoc } from '../../docs/JsDoc';
|
||||
|
||||
## echoWith
|
||||
|
||||
<JsDoc client:idle name="echoWith" h={0} />
|
||||
<JsDoc client:idle name="Pattern#echoWith" h={0} />
|
||||
|
||||
## stut
|
||||
|
||||
|
||||
@@ -34,11 +34,11 @@ import { JsDoc } from '../../docs/JsDoc';
|
||||
|
||||
## arp
|
||||
|
||||
<JsDoc client:idle name="arp" h={0} />
|
||||
<JsDoc client:idle name="Pattern#arp" h={0} />
|
||||
|
||||
## arpWith 🧪
|
||||
|
||||
<JsDoc client:idle name="arpWith" h={0} />
|
||||
<JsDoc client:idle name="Pattern#arpWith" h={0} />
|
||||
|
||||
## struct
|
||||
|
||||
@@ -62,47 +62,47 @@ import { JsDoc } from '../../docs/JsDoc';
|
||||
|
||||
## invert
|
||||
|
||||
<JsDoc client:idle name="invert" h={0} />
|
||||
<JsDoc client:idle name="Pattern#invert" h={0} />
|
||||
|
||||
## pick
|
||||
|
||||
<JsDoc client:idle name="pick" h={0} />
|
||||
<JsDoc client:idle name="Pattern#pick" h={0} />
|
||||
|
||||
## pickmod
|
||||
|
||||
<JsDoc client:idle name="pickmod" h={0} />
|
||||
<JsDoc client:idle name="Pattern#pickmod" h={0} />
|
||||
|
||||
## pickF
|
||||
|
||||
<JsDoc client:idle name="pickF" h={0} />
|
||||
<JsDoc client:idle name="Pattern#pickF" h={0} />
|
||||
|
||||
## pickmodF
|
||||
|
||||
<JsDoc client:idle name="pickmodF" h={0} />
|
||||
<JsDoc client:idle name="Pattern#pickmodF" h={0} />
|
||||
|
||||
## pickRestart
|
||||
|
||||
<JsDoc client:idle name="pickRestart" h={0} />
|
||||
<JsDoc client:idle name="Pattern#pickRestart" h={0} />
|
||||
|
||||
## pickmodRestart
|
||||
|
||||
<JsDoc client:idle name="pickmodRestart" h={0} />
|
||||
<JsDoc client:idle name="Pattern#pickmodRestart" h={0} />
|
||||
|
||||
## pickReset
|
||||
|
||||
<JsDoc client:idle name="pickReset" h={0} />
|
||||
<JsDoc client:idle name="Pattern#pickReset" h={0} />
|
||||
|
||||
## pickmodReset
|
||||
|
||||
<JsDoc client:idle name="pickmodReset" h={0} />
|
||||
<JsDoc client:idle name="Pattern#pickmodReset" h={0} />
|
||||
|
||||
## inhabit
|
||||
|
||||
<JsDoc client:idle name="inhabit" h={0} />
|
||||
<JsDoc client:idle name="Pattern#inhabit" h={0} />
|
||||
|
||||
## inhabitmod
|
||||
|
||||
<JsDoc client:idle name="inhabitmod" h={0} />
|
||||
<JsDoc client:idle name="Pattern#inhabitmod" h={0} />
|
||||
|
||||
## squeeze
|
||||
|
||||
|
||||
@@ -150,35 +150,35 @@ Each filter has 2 parameters:
|
||||
|
||||
## lpf
|
||||
|
||||
<JsDoc client:idle name="lpf" h={0} />
|
||||
<JsDoc client:idle name="Pattern#lpf" h={0} />
|
||||
|
||||
## lpq
|
||||
|
||||
<JsDoc client:idle name="lpq" h={0} />
|
||||
<JsDoc client:idle name="Pattern#lpq" h={0} />
|
||||
|
||||
## hpf
|
||||
|
||||
<JsDoc client:idle name="hpf" h={0} />
|
||||
<JsDoc client:idle name="Pattern#hpf" h={0} />
|
||||
|
||||
## hpq
|
||||
|
||||
<JsDoc client:idle name="hpq" h={0} />
|
||||
<JsDoc client:idle name="Pattern#hpq" h={0} />
|
||||
|
||||
## bpf
|
||||
|
||||
<JsDoc client:idle name="bpf" h={0} />
|
||||
<JsDoc client:idle name="Pattern#bpf" h={0} />
|
||||
|
||||
## bpq
|
||||
|
||||
<JsDoc client:idle name="bpq" h={0} />
|
||||
<JsDoc client:idle name="Pattern#bpq" h={0} />
|
||||
|
||||
## ftype
|
||||
|
||||
<JsDoc client:idle name="ftype" h={0} />
|
||||
<JsDoc client:idle name="Pattern#ftype" h={0} />
|
||||
|
||||
## vowel
|
||||
|
||||
<JsDoc client:idle name="vowel" h={0} />
|
||||
<JsDoc client:idle name="Pattern#vowel" h={0} />
|
||||
|
||||
# Amplitude Modulation
|
||||
|
||||
@@ -186,27 +186,27 @@ Amplitude modulation changes the amplitude (gain) periodically over time.
|
||||
|
||||
## tremolo
|
||||
|
||||
<JsDoc client:idle name="tremolo" h={0} />
|
||||
<JsDoc client:idle name="Pattern#tremolo" h={0} />
|
||||
|
||||
## tremolosync
|
||||
|
||||
<JsDoc client:idle name="tremolosync" h={0} />
|
||||
<JsDoc client:idle name="Pattern#tremolosync" h={0} />
|
||||
|
||||
## tremolodepth
|
||||
|
||||
<JsDoc client:idle name="tremolodepth" h={0} />
|
||||
<JsDoc client:idle name="Pattern#tremolodepth" h={0} />
|
||||
|
||||
## tremoloskew
|
||||
|
||||
<JsDoc client:idle name="tremoloskew" h={0} />
|
||||
<JsDoc client:idle name="Pattern#tremoloskew" h={0} />
|
||||
|
||||
## tremolophase
|
||||
|
||||
<JsDoc client:idle name="tremolophase" h={0} />
|
||||
<JsDoc client:idle name="Pattern#tremolophase" h={0} />
|
||||
|
||||
## tremoloshape
|
||||
|
||||
<JsDoc client:idle name="tremoloshape" h={0} />
|
||||
<JsDoc client:idle name="Pattern#tremoloshape" h={0} />
|
||||
|
||||
# Amplitude Envelope
|
||||
|
||||
@@ -219,23 +219,23 @@ Strudel uses ADSR envelopes, which are probably the most common way to describe
|
||||
|
||||
## attack
|
||||
|
||||
<JsDoc client:idle name="attack" h={0} />
|
||||
<JsDoc client:idle name="Pattern#attack" h={0} />
|
||||
|
||||
## decay
|
||||
|
||||
<JsDoc client:idle name="decay" h={0} />
|
||||
<JsDoc client:idle name="Pattern#decay" h={0} />
|
||||
|
||||
## sustain
|
||||
|
||||
<JsDoc client:idle name="sustain" h={0} />
|
||||
<JsDoc client:idle name="Pattern#sustain" h={0} />
|
||||
|
||||
## release
|
||||
|
||||
<JsDoc client:idle name="release" h={0} />
|
||||
<JsDoc client:idle name="Pattern#release" h={0} />
|
||||
|
||||
## adsr
|
||||
|
||||
<JsDoc client:idle name="adsr" h={0} />
|
||||
<JsDoc client:idle name="Pattern#adsr" h={0} />
|
||||
|
||||
# Filter Envelope
|
||||
|
||||
@@ -271,23 +271,23 @@ There is one filter envelope for each filter type and thus one set of envelope f
|
||||
|
||||
## lpattack
|
||||
|
||||
<JsDoc client:idle name="lpattack" h={0} />
|
||||
<JsDoc client:idle name="Pattern#lpattack" h={0} />
|
||||
|
||||
## lpdecay
|
||||
|
||||
<JsDoc client:idle name="lpdecay" h={0} />
|
||||
<JsDoc client:idle name="Pattern#lpdecay" h={0} />
|
||||
|
||||
## lpsustain
|
||||
|
||||
<JsDoc client:idle name="lpsustain" h={0} />
|
||||
<JsDoc client:idle name="Pattern#lpsustain" h={0} />
|
||||
|
||||
## lprelease
|
||||
|
||||
<JsDoc client:idle name="lprelease" h={0} />
|
||||
<JsDoc client:idle name="Pattern#lprelease" h={0} />
|
||||
|
||||
## lpenv
|
||||
|
||||
<JsDoc client:idle name="lpenv" h={0} />
|
||||
<JsDoc client:idle name="Pattern#lpenv" h={0} />
|
||||
|
||||
# Pitch Envelope
|
||||
|
||||
@@ -321,45 +321,45 @@ Let's break down all pitch envelope controls:
|
||||
|
||||
## pattack
|
||||
|
||||
<JsDoc client:idle name="pattack" h={0} />
|
||||
<JsDoc client:idle name="Pattern#pattack" h={0} />
|
||||
|
||||
## pdecay
|
||||
|
||||
<JsDoc client:idle name="pdecay" h={0} />
|
||||
<JsDoc client:idle name="Pattern#pdecay" h={0} />
|
||||
|
||||
## prelease
|
||||
|
||||
<JsDoc client:idle name="prelease" h={0} />
|
||||
<JsDoc client:idle name="Pattern#prelease" h={0} />
|
||||
|
||||
## penv
|
||||
|
||||
<JsDoc client:idle name="penv" h={0} />
|
||||
<JsDoc client:idle name="Pattern#penv" h={0} />
|
||||
|
||||
## pcurve
|
||||
|
||||
<JsDoc client:idle name="pcurve" h={0} />
|
||||
<JsDoc client:idle name="Pattern#pcurve" h={0} />
|
||||
|
||||
## panchor
|
||||
|
||||
<JsDoc client:idle name="panchor" h={0} />
|
||||
<JsDoc client:idle name="Pattern#panchor" h={0} />
|
||||
|
||||
# Dynamics
|
||||
|
||||
## gain
|
||||
|
||||
<JsDoc client:idle name="gain" h={0} />
|
||||
<JsDoc client:idle name="Pattern#gain" h={0} />
|
||||
|
||||
## velocity
|
||||
|
||||
<JsDoc client:idle name="velocity" h={0} />
|
||||
<JsDoc client:idle name="Pattern#velocity" h={0} />
|
||||
|
||||
## compressor
|
||||
|
||||
<JsDoc client:idle name="compressor" h={0} />
|
||||
<JsDoc client:idle name="Pattern#compressor" h={0} />
|
||||
|
||||
## postgain
|
||||
|
||||
<JsDoc client:idle name="postgain" h={0} />
|
||||
<JsDoc client:idle name="Pattern#postgain" h={0} />
|
||||
|
||||
## xfade
|
||||
|
||||
@@ -377,21 +377,21 @@ Let's break down all pitch envelope controls:
|
||||
|
||||
## pan
|
||||
|
||||
<JsDoc client:idle name="pan" h={0} />
|
||||
<JsDoc client:idle name="Pattern#pan" h={0} />
|
||||
|
||||
# Waveshaping
|
||||
|
||||
## coarse
|
||||
|
||||
<JsDoc client:idle name="coarse" h={0} />
|
||||
<JsDoc client:idle name="Pattern#coarse" h={0} />
|
||||
|
||||
## crush
|
||||
|
||||
<JsDoc client:idle name="crush" h={0} />
|
||||
<JsDoc client:idle name="Pattern#crush" h={0} />
|
||||
|
||||
## distort
|
||||
|
||||
<JsDoc client:idle name="distort" h={0} />
|
||||
<JsDoc client:idle name="Pattern#distort" h={0} />
|
||||
|
||||
# Global Effects
|
||||
|
||||
@@ -402,78 +402,78 @@ global effects use the same chain for all events of the same orbit:
|
||||
|
||||
## orbit
|
||||
|
||||
<JsDoc client:idle name="orbit" h={0} />
|
||||
<JsDoc client:idle name="Pattern#orbit" h={0} />
|
||||
|
||||
## Delay
|
||||
|
||||
### delay
|
||||
|
||||
<JsDoc client:idle name="delay" h={0} />
|
||||
<JsDoc client:idle name="Pattern#delay" h={0} />
|
||||
|
||||
### delaytime
|
||||
|
||||
<JsDoc client:idle name="delaytime" h={0} />
|
||||
<JsDoc client:idle name="Pattern#delaytime" h={0} />
|
||||
|
||||
### delayfeedback
|
||||
|
||||
<JsDoc client:idle name="delayfeedback" h={0} />
|
||||
<JsDoc client:idle name="Pattern#delayfeedback" h={0} />
|
||||
|
||||
## Reverb
|
||||
|
||||
### room
|
||||
|
||||
<JsDoc client:idle name="room" h={0} />
|
||||
<JsDoc client:idle name="Pattern#room" h={0} />
|
||||
|
||||
### roomsize
|
||||
|
||||
<JsDoc client:idle name="roomsize" h={0} />
|
||||
<JsDoc client:idle name="Pattern#roomsize" h={0} />
|
||||
|
||||
### roomfade
|
||||
|
||||
<JsDoc client:idle name="roomfade" h={0} />
|
||||
<JsDoc client:idle name="Pattern#roomfade" h={0} />
|
||||
|
||||
### roomlp
|
||||
|
||||
<JsDoc client:idle name="roomlp" h={0} />
|
||||
<JsDoc client:idle name="Pattern#roomlp" h={0} />
|
||||
|
||||
### roomdim
|
||||
|
||||
<JsDoc client:idle name="roomdim" h={0} />
|
||||
<JsDoc client:idle name="Pattern#roomdim" h={0} />
|
||||
|
||||
### iresponse
|
||||
|
||||
<JsDoc client:idle name="iresponse" h={0} />
|
||||
<JsDoc client:idle name="Pattern#iresponse" h={0} />
|
||||
|
||||
## Phaser
|
||||
|
||||
### phaser
|
||||
|
||||
<JsDoc client:idle name="phaser" h={0} />
|
||||
<JsDoc client:idle name="Pattern#phaser" h={0} />
|
||||
|
||||
### phaserdepth
|
||||
|
||||
<JsDoc client:idle name="phaserdepth" h={0} />
|
||||
<JsDoc client:idle name="Pattern#phaserdepth" h={0} />
|
||||
|
||||
### phasercenter
|
||||
|
||||
<JsDoc client:idle name="phasercenter" h={0} />
|
||||
<JsDoc client:idle name="Pattern#phasercenter" h={0} />
|
||||
|
||||
### phasersweep
|
||||
|
||||
<JsDoc client:idle name="phasersweep" h={0} />
|
||||
<JsDoc client:idle name="Pattern#phasersweep" h={0} />
|
||||
|
||||
## Duck
|
||||
|
||||
### duckorbit
|
||||
|
||||
<JsDoc client:idle name="duckorbit" h={0} />
|
||||
<JsDoc client:idle name="Pattern#duckorbit" h={0} />
|
||||
|
||||
### duckattack
|
||||
|
||||
<JsDoc client:idle name="duckattack" h={0} />
|
||||
<JsDoc client:idle name="Pattern#duckattack" h={0} />
|
||||
|
||||
### duckdepth
|
||||
|
||||
<JsDoc client:idle name="duckdepth" h={0} />
|
||||
<JsDoc client:idle name="Pattern#duckdepth" h={0} />
|
||||
|
||||
Next, we'll look at input / output via [MIDI, OSC and other methods](/learn/input-output).
|
||||
|
||||
@@ -30,7 +30,7 @@ These are the equivalents used by the Mini Notation:
|
||||
|
||||
## stack
|
||||
|
||||
<JsDoc client:idle name="stack" h={0} />
|
||||
<JsDoc client:idle name="Pattern#stack" h={0} />
|
||||
|
||||
## stepcat
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ $: midiport('IAC Driver');
|
||||
$: note('c a f e').midiport('<0 1 2 3>').midi();
|
||||
```
|
||||
|
||||
<JsDoc client:idle name="midiport" h={0} />
|
||||
<JsDoc client:idle name="Pattern#midiport" h={0} />
|
||||
|
||||
## midichan(number)
|
||||
|
||||
|
||||
@@ -329,7 +329,7 @@ Sampler effects are functions that can be used to change the behaviour of sample
|
||||
|
||||
### begin
|
||||
|
||||
<JsDoc client:idle name="begin" h={0} />
|
||||
<JsDoc client:idle name="Pattern#begin" h={0} />
|
||||
|
||||
### end
|
||||
|
||||
@@ -337,23 +337,23 @@ Sampler effects are functions that can be used to change the behaviour of sample
|
||||
|
||||
### loop
|
||||
|
||||
<JsDoc client:idle name="loop" h={0} />
|
||||
<JsDoc client:idle name="Pattern#loop" h={0} />
|
||||
|
||||
### loopBegin
|
||||
|
||||
<JsDoc client:idle name="loopBegin" h={0} />
|
||||
<JsDoc client:idle name="Pattern#loopBegin" h={0} />
|
||||
|
||||
### loopEnd
|
||||
|
||||
<JsDoc client:idle name="loopEnd" h={0} />
|
||||
<JsDoc client:idle name="Pattern#loopEnd" h={0} />
|
||||
|
||||
### cut
|
||||
|
||||
<JsDoc client:idle name="cut" h={0} />
|
||||
<JsDoc client:idle name="Pattern#cut" h={0} />
|
||||
|
||||
### clip
|
||||
|
||||
<JsDoc client:idle name="clip" h={0} />
|
||||
<JsDoc client:idle name="Pattern#clip" h={0} />
|
||||
|
||||
### loopAt
|
||||
|
||||
@@ -385,6 +385,6 @@ Sampler effects are functions that can be used to change the behaviour of sample
|
||||
|
||||
### speed
|
||||
|
||||
<JsDoc client:idle name="speed" h={0} />
|
||||
<JsDoc client:idle name="Pattern#speed" h={0} />
|
||||
|
||||
After samples, let's see what [Synths](/learn/synths) afford us.
|
||||
|
||||
@@ -82,7 +82,7 @@ Earlier versions of many of these functions had `s_` prefixes, and the `pace` fu
|
||||
|
||||
### pace
|
||||
|
||||
<JsDoc client:idle name="pace" h={0} />
|
||||
<JsDoc client:idle name="Pattern#pace" h={0} />
|
||||
|
||||
### stepcat
|
||||
|
||||
@@ -94,23 +94,23 @@ Earlier versions of many of these functions had `s_` prefixes, and the `pace` fu
|
||||
|
||||
### expand
|
||||
|
||||
<JsDoc client:idle name="expand" h={0} />
|
||||
<JsDoc client:idle name="Pattern#expand" h={0} />
|
||||
|
||||
### contract
|
||||
|
||||
<JsDoc client:idle name="contract" h={0} />
|
||||
<JsDoc client:idle name="Pattern#contract" h={0} />
|
||||
|
||||
### extend
|
||||
|
||||
<JsDoc client:idle name="extend" h={0} />
|
||||
<JsDoc client:idle name="Pattern#extend" h={0} />
|
||||
|
||||
### take
|
||||
|
||||
<JsDoc client:idle name="take" h={0} />
|
||||
<JsDoc client:idle name="Pattern#take" h={0} />
|
||||
|
||||
### drop
|
||||
|
||||
<JsDoc client:idle name="drop" h={0} />
|
||||
<JsDoc client:idle name="Pattern#drop" h={0} />
|
||||
|
||||
### polymeter
|
||||
|
||||
@@ -118,15 +118,15 @@ Earlier versions of many of these functions had `s_` prefixes, and the `pace` fu
|
||||
|
||||
### shrink
|
||||
|
||||
<JsDoc client:idle name="shrink" h={0} />
|
||||
<JsDoc client:idle name="Pattern#shrink" h={0} />
|
||||
|
||||
### grow
|
||||
|
||||
<JsDoc client:idle name="grow" h={0} />
|
||||
<JsDoc client:idle name="Pattern#grow" h={0} />
|
||||
|
||||
### tour
|
||||
|
||||
<JsDoc client:idle name="tour" h={0} />
|
||||
<JsDoc client:idle name="Pattern#tour" h={0} />
|
||||
|
||||
### zip
|
||||
|
||||
|
||||
@@ -141,11 +141,11 @@ These phases too can be declared in Strudel and can give your sounds interesting
|
||||
|
||||
### vib
|
||||
|
||||
<JsDoc client:idle name="vib" h={0} />
|
||||
<JsDoc client:idle name="Pattern#vib" h={0} />
|
||||
|
||||
### vibmod
|
||||
|
||||
<JsDoc client:idle name="vibmod" h={0} />
|
||||
<JsDoc client:idle name="Pattern#vibmod" h={0} />
|
||||
|
||||
## FM Synthesis
|
||||
|
||||
@@ -155,27 +155,27 @@ You can use fm with any of the above waveforms, although the below examples all
|
||||
|
||||
### fm
|
||||
|
||||
<JsDoc client:idle name="fm" h={0} />
|
||||
<JsDoc client:idle name="Pattern#fm" h={0} />
|
||||
|
||||
### fmh
|
||||
|
||||
<JsDoc client:idle name="fmh" h={0} />
|
||||
<JsDoc client:idle name="Pattern#fmh" h={0} />
|
||||
|
||||
### fmattack
|
||||
|
||||
<JsDoc client:idle name="fmattack" h={0} />
|
||||
<JsDoc client:idle name="Pattern#fmattack" h={0} />
|
||||
|
||||
### fmdecay
|
||||
|
||||
<JsDoc client:idle name="fmdecay" h={0} />
|
||||
<JsDoc client:idle name="Pattern#fmdecay" h={0} />
|
||||
|
||||
### fmsustain
|
||||
|
||||
<JsDoc client:idle name="fmsustain" h={0} />
|
||||
<JsDoc client:idle name="Pattern#fmsustain" h={0} />
|
||||
|
||||
### fmenv
|
||||
|
||||
<JsDoc client:idle name="fmenv" h={0} />
|
||||
<JsDoc client:idle name="Pattern#fmenv" h={0} />
|
||||
|
||||
## Wavetable Synthesis
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ Some of these have equivalent operators in the Mini Notation:
|
||||
|
||||
## clip / legato
|
||||
|
||||
<JsDoc client:idle name="clip" h={0} />
|
||||
<JsDoc client:idle name="Pattern#clip" h={0} />
|
||||
|
||||
## euclid
|
||||
|
||||
@@ -56,7 +56,7 @@ Some of these have equivalent operators in the Mini Notation:
|
||||
|
||||
## palindrome
|
||||
|
||||
<JsDoc client:idle name="palindrome" h={0} />
|
||||
<JsDoc client:idle name="Pattern#palindrome" h={0} />
|
||||
|
||||
## iter
|
||||
|
||||
@@ -68,50 +68,50 @@ Some of these have equivalent operators in the Mini Notation:
|
||||
|
||||
## ply
|
||||
|
||||
<JsDoc client:idle name="ply" h={0} />
|
||||
<JsDoc client:idle name="Pattern#ply" h={0} />
|
||||
|
||||
## segment
|
||||
|
||||
<JsDoc client:idle name="segment" h={0} />
|
||||
<JsDoc client:idle name="Pattern#segment" h={0} />
|
||||
|
||||
## compress
|
||||
|
||||
<JsDoc client:idle name="compress" h={0} />
|
||||
<JsDoc client:idle name="Pattern#compress" h={0} />
|
||||
|
||||
## zoom
|
||||
|
||||
<JsDoc client:idle name="zoom" h={0} />
|
||||
<JsDoc client:idle name="Pattern#zoom" h={0} />
|
||||
|
||||
## linger
|
||||
|
||||
<JsDoc client:idle name="linger" h={0} />
|
||||
<JsDoc client:idle name="Pattern#linger" h={0} />
|
||||
|
||||
## fastGap
|
||||
|
||||
<JsDoc client:idle name="fastGap" h={0} />
|
||||
<JsDoc client:idle name="Pattern#fastGap" h={0} />
|
||||
|
||||
## inside
|
||||
|
||||
<JsDoc client:idle name="inside" h={0} />
|
||||
<JsDoc client:idle name="Pattern#inside" h={0} />
|
||||
|
||||
## outside
|
||||
|
||||
<JsDoc client:idle name="outside" h={0} />
|
||||
<JsDoc client:idle name="Pattern#outside" h={0} />
|
||||
|
||||
## cpm
|
||||
|
||||
<JsDoc client:idle name="cpm" h={0} />
|
||||
<JsDoc client:idle name="Pattern#cpm" h={0} />
|
||||
|
||||
## ribbon
|
||||
|
||||
<JsDoc client:idle name="ribbon" h={0} />
|
||||
<JsDoc client:idle name="Pattern#ribbon" h={0} />
|
||||
|
||||
## swingBy
|
||||
|
||||
<JsDoc client:idle name="swingBy" h={0} />
|
||||
<JsDoc client:idle name="Pattern#swingBy" h={0} />
|
||||
|
||||
## swing
|
||||
|
||||
<JsDoc client:idle name="swing" h={0} />
|
||||
<JsDoc client:idle name="Pattern#swing" h={0} />
|
||||
|
||||
Apart from modifying time, there are ways to [Control Parameters](/functions/value-modifiers/).
|
||||
|
||||
@@ -12,7 +12,7 @@ These functions use [tonaljs](https://github.com/tonaljs/tonal) to provide helpe
|
||||
|
||||
### voicing()
|
||||
|
||||
<JsDoc client:idle name="voicing" h={0} />
|
||||
<JsDoc client:idle name="Pattern#voicing" h={0} />
|
||||
|
||||
Here's an example of how you can play chords and a bassline:
|
||||
|
||||
@@ -29,7 +29,7 @@ Here's an example of how you can play chords and a bassline:
|
||||
|
||||
### scale(name)
|
||||
|
||||
<JsDoc client:idle name="scale" h={0} />
|
||||
<JsDoc client:idle name="Pattern#scale" h={0} />
|
||||
|
||||
### transpose(semitones)
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ What follows is the API doc of all the options you can pass:
|
||||
|
||||
## Scope
|
||||
|
||||
<JsDoc client:idle name="scope" h={0} />
|
||||
<JsDoc client:idle name="Pattern#scope" h={0} />
|
||||
|
||||
## Pitchwheel
|
||||
|
||||
@@ -101,7 +101,7 @@ What follows is the API doc of all the options you can pass:
|
||||
|
||||
## Spectrum
|
||||
|
||||
<JsDoc client:idle name="spectrum" h={0} />
|
||||
<JsDoc client:idle name="Pattern#spectrum" h={0} />
|
||||
|
||||
## Print
|
||||
|
||||
@@ -109,4 +109,4 @@ What follows is the API doc of all the options you can pass:
|
||||
|
||||
## markcss
|
||||
|
||||
<JsDoc client:idle name="markcss" h={0} />
|
||||
<JsDoc client:idle name="Pattern#markcss" h={0} />
|
||||
|
||||
+27
-2
@@ -1,12 +1,37 @@
|
||||
// @ts-ignore
|
||||
import { registerSW } from 'virtual:pwa-register';
|
||||
|
||||
registerSW({
|
||||
immediate: true,
|
||||
function h(html: string): HTMLElement {
|
||||
const template = document.createElement('template');
|
||||
template.innerHTML = html;
|
||||
return template.content.firstElementChild as HTMLElement;
|
||||
}
|
||||
|
||||
function showUpdateModal() {
|
||||
const hint = h(`
|
||||
<div style="position:fixed;bottom:8px;right:8px;z-index:99999;padding:10px;background:var(--background);color:var(--foreground);border:2px solid var(--gutterForeground)">
|
||||
<p style="margin-bottom:10px">A new strudel version is available. Update now?</p>
|
||||
<button style="border:1px solid var(--gutterForeground);padding:4px" id="updateButton">update</button>
|
||||
<button style="border:1px solid var(--gutterForeground);padding:4px" id="cancelButton">cancel</button>
|
||||
</div>`);
|
||||
document.body.appendChild(hint);
|
||||
hint.querySelector<HTMLButtonElement>('#updateButton')!.onclick = () => {
|
||||
updateSW();
|
||||
hint.remove();
|
||||
};
|
||||
hint.querySelector<HTMLButtonElement>('#cancelButton')!.onclick = () => {
|
||||
hint.remove();
|
||||
};
|
||||
}
|
||||
// https://vite-pwa-org.netlify.app/frameworks/#prompt-for-update
|
||||
const updateSW = registerSW({
|
||||
onRegisteredSW(swScriptUrl) {
|
||||
// console.log('SW registered: ', swScriptUrl)
|
||||
},
|
||||
onOfflineReady() {
|
||||
// console.log('PWA application ready to work offline')
|
||||
},
|
||||
onNeedRefresh() {
|
||||
showUpdateModal();
|
||||
},
|
||||
});
|
||||
|
||||
@@ -3,6 +3,7 @@ import { memo, useEffect, useMemo, useState, Fragment } from 'react';
|
||||
import jsdocJson from '../../../../../doc.json';
|
||||
import { Textbox } from '@src/repl/components/panel/SettingsTab';
|
||||
import { settingsMap, useSettings } from '@src/settings.mjs';
|
||||
import { JsDoc } from '@src/docs/JsDoc';
|
||||
import { computeAvailableFunctions } from '@src/jsDocsUtils.mjs';
|
||||
|
||||
const availableFunctions = computeAvailableFunctions(jsdocJson);
|
||||
@@ -178,48 +179,7 @@ export const Reference = memo(function Reference() {
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
{!!entry.synonyms_text && (
|
||||
<p>
|
||||
Synonyms: <code>{entry.synonyms_text}</code>
|
||||
</p>
|
||||
)}
|
||||
|
||||
<p
|
||||
dangerouslySetInnerHTML={{
|
||||
// If we have an external url make sure it opens in another tab to not interrupt the player
|
||||
__html: entry.description.replaceAll(/<a href="https:\/\//g, `<a target="_blank" href="https://`),
|
||||
}}
|
||||
></p>
|
||||
{entry.params && entry.params.length > 0 && <p className="font-bold">Arguments</p>}
|
||||
<ul>
|
||||
{entry.params?.map(({ name, type, description }, i) => {
|
||||
// Check if the param is actually the parameter of an object
|
||||
const objParamSeperator = name.indexOf('.');
|
||||
const isObjectParam = objParamSeperator !== -1;
|
||||
|
||||
return (
|
||||
<li key={i} className={isObjectParam ? 'list-none' : ''}>
|
||||
{isObjectParam ? name.substring(objParamSeperator + 1) : name} : {type?.names?.join(' | ')}{' '}
|
||||
{description ? <> - {getInnerText(description)}</> : ''}
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
{entry.returns && (
|
||||
<p>
|
||||
<span className="font-bold">Returns</span>{' '}
|
||||
{entry.returns.map(({ type, description }) => (
|
||||
<>
|
||||
{type?.names?.join(' | ')} {description ? <> - {getInnerText(description)}</> : ''}
|
||||
</>
|
||||
))}
|
||||
</p>
|
||||
)}
|
||||
{entry.examples?.map((example, j) => (
|
||||
<pre className="bg-background border border-muted" key={j}>
|
||||
{example}
|
||||
</pre>
|
||||
))}
|
||||
<JsDoc name={entry.longname} hideMiniRepl></JsDoc>
|
||||
</section>
|
||||
)) || <p className="font-sans">Search or select a tag to get started.</p>}
|
||||
{detailVisibleFunctions.length > 0 && <div className="h-screen" />}
|
||||
|
||||
@@ -101,7 +101,10 @@ export function useReplContext() {
|
||||
clearHydra();
|
||||
}
|
||||
},
|
||||
beforeEval: () => audioReady,
|
||||
beforeEval: ({ code }) => {
|
||||
setVersionDefaultsFrom(code);
|
||||
return audioReady;
|
||||
},
|
||||
afterEval: (all) => {
|
||||
const { code } = all;
|
||||
//post to iframe parent (like Udels) if it exists...
|
||||
@@ -115,7 +118,6 @@ export function useReplContext() {
|
||||
}
|
||||
setDocumentTitle(code);
|
||||
const viewingPatternData = getViewingPatternData();
|
||||
setVersionDefaultsFrom(code);
|
||||
const data = { ...viewingPatternData, code };
|
||||
let id = data.id;
|
||||
const isExamplePattern = viewingPatternData.collection !== userPattern.collection;
|
||||
|
||||
@@ -15,6 +15,14 @@ const { code2hash, errorLogger, evalScope, hash2code, logger } = strudelCore;
|
||||
export const supabase = createClient(
|
||||
'https://pidxdsxphlhzjnzmifth.supabase.co',
|
||||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InBpZHhkc3hwaGxoempuem1pZnRoIiwicm9sZSI6ImFub24iLCJpYXQiOjE2NTYyMzA1NTYsImV4cCI6MTk3MTgwNjU1Nn0.bqlw7802fsWRnqU5BLYtmXk_k-D1VFmbkHMywWc15NM',
|
||||
{
|
||||
// avoid "Uncaught (in promise) Error: Acquiring an exclusive Navigator LockManager lock ... immediately failed"
|
||||
auth: {
|
||||
persistSession: false,
|
||||
autoRefreshToken: false,
|
||||
detectSessionInUrl: false,
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
let dbLoaded;
|
||||
|
||||
Reference in New Issue
Block a user