mirror of
https://codeberg.org/uzu/strudel
synced 2026-11-30 11:16:48 -05:00
Compare commits
106 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f805560827 | |||
| f8bb10d2a0 | |||
| a160f76d23 | |||
| 3fc1cc871c | |||
| 2c2c6bc6bf | |||
| 089187b9b2 | |||
| dc441e68df | |||
| c6253789ab | |||
| b8b59d911f | |||
| a5079db6f7 | |||
| 36647afbbf | |||
| d13f040617 | |||
| 92b7db3a97 | |||
| aad846a45f | |||
| 4a060f20f2 | |||
| 3a5d917d7d | |||
| 893cd9e051 | |||
| c019be29ac | |||
| e263096efa | |||
| e74be00a7c | |||
| d90dd71bd9 | |||
| a14aaacc4f | |||
| aa3aea4398 | |||
| dcca8e45b1 | |||
| 16b2dba3b1 | |||
| 041815e466 | |||
| df27ef6fa9 | |||
| f6315df48a | |||
| faf8522de0 | |||
| c7d5ace20a | |||
| 441950898f | |||
| bd9d3f475b | |||
| c465eda72f | |||
| 03b0ac7e7b | |||
| 034f7d4332 | |||
| 7d195eb63f | |||
| 844ff20ce3 | |||
| f9aceecd5a | |||
| 5604087bc9 | |||
| bf49b35e59 | |||
| 636e97297f | |||
| 02a8f9ef36 | |||
| a85d7793ed | |||
| 9851807be7 | |||
| 4c237e49c3 | |||
| f9f5d853b2 | |||
| b87648ef11 | |||
| daa9065216 | |||
| b556b604aa | |||
| 57872d459f | |||
| 4b989018a7 | |||
| 4530ed9a3a | |||
| f331eda10d | |||
| 0eeeca8fb1 | |||
| b11ba9f2d9 | |||
| fc271a8879 | |||
| fdf243acee | |||
| 429dbcd80e | |||
| 6a85f711d2 | |||
| eca9f57e68 | |||
| d87abea11c | |||
| 08d2a4e3ae | |||
| 1756713096 | |||
| 841abc4827 | |||
| 46f01053da | |||
| 9feb0f44cf | |||
| e12e980e04 | |||
| d25df719df | |||
| 62b8ec2402 | |||
| 24baaf7933 | |||
| 55dc8650f1 | |||
| 3b2208bc36 | |||
| d6e231a9fd | |||
| 6c345ed827 | |||
| 84ef32eec8 | |||
| f111271d40 | |||
| 6e1a5126df | |||
| d71526d946 | |||
| cac73dc558 | |||
| 4068d85e2d | |||
| 47a500ca33 | |||
| 63aeb31644 | |||
| 0cb6341299 | |||
| 7a343930aa | |||
| 266e5da109 | |||
| 3b06afdc9c | |||
| 530e9630bf | |||
| 897ec4971d | |||
| d784f62d4d | |||
| f47caac716 | |||
| 0a88f2608a | |||
| 32d295d668 | |||
| 7d2d5db95d | |||
| 8408af21a6 | |||
| b1bb29e040 | |||
| 9dc19fb9bf | |||
| 4a158db9d2 | |||
| 55839e7ee8 | |||
| 9aaa9bee6b | |||
| 1834d689ef | |||
| 77a7a148f0 | |||
| 52931e879d | |||
| d5c9be1c30 | |||
| 2b30ab3008 | |||
| 13cbeb3f67 | |||
| 352d8659ec |
@@ -44,6 +44,7 @@ Dirt-Samples
|
||||
tidal-drum-machines
|
||||
webaudiofontdata
|
||||
src-tauri/target
|
||||
mise.local.toml
|
||||
|
||||
# BEGIN JetBrains -> END JetBrains
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
In line with [our humane policy](POLICY.md#post-ai-humane-policy-for-live-coding-development), code and documentation
|
||||
should not be written by LLM agents. To this end, agents should not
|
||||
edit the codebase or make any commits that are intended to be
|
||||
contributed upstream. Likewise, LLM output should not be pasted into
|
||||
issues, comments, pull requests and so on.
|
||||
|
||||
A contributor's personal use of LLMs and related technology is their
|
||||
own business, whether for research, analysis, bug discovery or other
|
||||
assistive technology, so long as the output is not included in any
|
||||
contributions to our projects.
|
||||
|
||||
Strudel is [AGPL licensed](LICENSE), and so any code integrated with it also
|
||||
comes under that license. This should be carefully considered before
|
||||
distributing software integrated with strudel, including making it
|
||||
available over a network.
|
||||
|
||||
Strudel has purposefully moved away from github.com, as a closed
|
||||
source platform with ethical issues. Please do not fork strudel back
|
||||
to that platform, or similar corporate platforms.
|
||||
|
||||
Projects using strudel must not use "strudel" in their name, unless
|
||||
they are 'official' projects, or have the blessing of the strudel
|
||||
community.
|
||||
@@ -41,6 +41,8 @@ Licensing info for the default sound banks can be found over on the [dough-sampl
|
||||
|
||||
There are many ways to contribute to this project! See [contribution guide](./CONTRIBUTING.md). You can find the full list of contributors [here](https://codeberg.org/uzu/strudel/activity/contributors).
|
||||
|
||||
Please see [POLICY.md](POLICY.md) for our code of conduct and humane AI/LLM policy.
|
||||
|
||||
## Community
|
||||
|
||||
Strudel is a member of the 'Uzu' family of pattern-based live coding languages, along with TidalCycles and friends.
|
||||
|
||||
@@ -5,6 +5,7 @@ import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import js from '@eslint/js';
|
||||
import { FlatCompat } from '@eslint/eslintrc';
|
||||
import { jsdoc } from 'eslint-plugin-jsdoc';
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
@@ -93,4 +94,39 @@ export default [
|
||||
},
|
||||
},
|
||||
},
|
||||
jsdoc({
|
||||
config: 'flat/recommended-error',
|
||||
rules: {
|
||||
'jsdoc/no-undefined-types': [
|
||||
'error',
|
||||
{ definedTypes: ['Pattern', 'Pattern.prototype', 'Hap', 'KabelsalatExpression'] },
|
||||
],
|
||||
'jsdoc/check-tag-names': ['error', { definedTags: ['tags', 'synonyms', 'noAutocomplete', 'superdirtOnly'] }],
|
||||
'jsdoc/no-restricted-syntax': [
|
||||
'error',
|
||||
{
|
||||
contexts: [
|
||||
{
|
||||
//@memberof without a .prototype
|
||||
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.",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
'jsdoc/require-description': 'error',
|
||||
'jsdoc/no-defaults': 0, //removes defaults with not alternative
|
||||
'jsdoc/require-jsdoc': 0,
|
||||
'jsdoc/tag-lines': 0,
|
||||
'jsdoc/require-returns-description': 0,
|
||||
'jsdoc/require-param-description': 0,
|
||||
'jsdoc/no-multi-asterisks': 0,
|
||||
'jsdoc/multiline-blocks': 0,
|
||||
'jsdoc/check-alignment': 0,
|
||||
'jsdoc/reject-any-type': 0,
|
||||
'jsdoc/reject-function-type': 0,
|
||||
},
|
||||
}),
|
||||
];
|
||||
|
||||
@@ -3,9 +3,12 @@
|
||||
"includePattern": ".+\\.(js(doc|x)?|mjs)$",
|
||||
"excludePattern": "node_modules|shift-parser|shift-reducer|shift-traverser|dist"
|
||||
},
|
||||
"plugins": ["plugins/markdown", "jsdoc/jsdoc-synonyms"],
|
||||
"plugins": [
|
||||
"plugins/markdown",
|
||||
"jsdoc/jsdoc-synonyms"
|
||||
],
|
||||
"opts": {
|
||||
"destination": "./out/",
|
||||
"recurse": true
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
-2
@@ -67,14 +67,15 @@
|
||||
"dependency-tree": "^11.0.1",
|
||||
"eslint": "^9.19.0",
|
||||
"eslint-plugin-import": "^2.31.0",
|
||||
"eslint-plugin-jsdoc": "^65.5.3",
|
||||
"events": "^3.3.0",
|
||||
"globals": "^15.14.0",
|
||||
"jsdoc": "^4.0.4",
|
||||
"jsdoc-json": "^2.0.2",
|
||||
"lerna": "^8.1.9",
|
||||
"prettier": "^3.4.2",
|
||||
"vitest": "^3.0.4",
|
||||
"vite-plugin-bundle-audioworklet": "workspace:*"
|
||||
"vite-plugin-bundle-audioworklet": "workspace:*",
|
||||
"vitest": "^3.0.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
|
||||
@@ -19,7 +19,7 @@ import { isAutoCompletionEnabled } from './autocomplete.mjs';
|
||||
import { basicSetup } from './basicSetup.mjs';
|
||||
import { flash, isFlashEnabled } from './flash.mjs';
|
||||
import { highlightMiniLocations, isPatternHighlightingEnabled, updateMiniLocations } from './highlight.mjs';
|
||||
import { keybindings } from './keybindings.mjs';
|
||||
import { editorActions, keybindings } from './keybindings.mjs';
|
||||
import { sliderPlugin, updateSliderWidgets } from './slider.mjs';
|
||||
import { activateTheme, initTheme, theme } from './themes.mjs';
|
||||
import { isTooltipEnabled } from './tooltip.mjs';
|
||||
@@ -101,6 +101,7 @@ export function initEditor({ initialCode = '', onChange, onEvaluate, onStop, roo
|
||||
syntaxHighlighting(defaultHighlightStyle),
|
||||
EditorView.updateListener.of((v) => onChange(v)),
|
||||
drawSelection({ cursorBlinkRate: 0 }),
|
||||
editorActions.of({ onEvaluate, onStop }),
|
||||
Prec.highest(
|
||||
keymap.of([
|
||||
{
|
||||
@@ -398,7 +399,7 @@ function s4() {
|
||||
/**
|
||||
* Overrides the css of highlighted events. Make sure to use single quotes!
|
||||
* @name markcss
|
||||
* @tag visualization
|
||||
* @tags visualization
|
||||
* @example
|
||||
* note("c a f e")
|
||||
* .markcss('text-decoration:underline')
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
import { defaultKeymap } from '@codemirror/commands';
|
||||
import { Prec, EditorState } from '@codemirror/state';
|
||||
import { defaultKeymap, toggleLineComment } from '@codemirror/commands';
|
||||
import { Facet, Prec, EditorState } from '@codemirror/state';
|
||||
import { keymap, ViewPlugin } from '@codemirror/view';
|
||||
// import { searchKeymap } from '@codemirror/search';
|
||||
import { emacs } from '@replit/codemirror-emacs';
|
||||
import { vim } from '@replit/codemirror-vim';
|
||||
import { vim, Vim } from '@replit/codemirror-vim';
|
||||
// import { vim } from './vim_test.mjs';
|
||||
import { vscodeKeymap } from '@replit/codemirror-vscode-keymap';
|
||||
|
||||
// Per-editor way to plumb down { onEvaluate, onStop }, provided by initEditor.
|
||||
export const editorActions = Facet.define({ combine: (values) => values[0] ?? {} });
|
||||
|
||||
const vscodePlugin = ViewPlugin.fromClass(
|
||||
class {
|
||||
constructor() {}
|
||||
@@ -26,7 +29,18 @@ const keymaps = {
|
||||
vscode: vscodeExtension,
|
||||
};
|
||||
|
||||
export { Vim } from '@replit/codemirror-vim';
|
||||
export { Vim }; // export for patterns/prebake to define custom actions
|
||||
|
||||
Vim.defineEx('write', 'w', (cm) => cm.cm6.state.facet(editorActions).onEvaluate?.());
|
||||
Vim.defineEx('quit', 'q', (cm) => cm.cm6.state.facet(editorActions).onStop?.());
|
||||
|
||||
Vim.defineOperator('toggleComment', (cm, _args, _ranges, oldAnchor) => {
|
||||
// By the time an operator runs, vim has selected the motion's range in the
|
||||
// real editor so we can just call the normal codemirror command
|
||||
toggleLineComment(cm.cm6);
|
||||
return oldAnchor;
|
||||
});
|
||||
Vim.mapCommand('gc', 'operator', 'toggleComment', {}, { isEdit: true });
|
||||
|
||||
export function keybindings(name) {
|
||||
const active = keymaps[name];
|
||||
|
||||
@@ -113,15 +113,17 @@ export const sliderPlugin = ViewPlugin.fromClass(
|
||||
},
|
||||
);
|
||||
|
||||
/* eslint jsdoc/check-param-names: "off" */
|
||||
/**
|
||||
* Displays a slider widget to allow the user manipulate a value
|
||||
*
|
||||
* @name slider
|
||||
* @tags external_io, visualization
|
||||
* @param {number} value Initial value
|
||||
* @param {number} min Minimum value - optional, defaults to 0
|
||||
* @param {number} max Maximum value - optional, defaults to 1
|
||||
* @param {number} step Step size - optional
|
||||
* @param {number} [min=0] Minimum value - optional, defaults to 0
|
||||
* @param {number} [max=1] Maximum value - optional, defaults to 1
|
||||
* @param {number} [step] Step size - optional
|
||||
* @returns {Pattern}
|
||||
*/
|
||||
export let slider = (value) => {
|
||||
console.warn('slider will only work when the transpiler is used... passing value as is');
|
||||
|
||||
@@ -104,6 +104,32 @@ function getCanvasWidget(id, options = {}) {
|
||||
return canvas;
|
||||
}
|
||||
|
||||
function getListWidget(id, options = {}) {
|
||||
const { width = 600, height = 100 } = options;
|
||||
let el = document.getElementById(id) || document.createElement('div');
|
||||
el.style.width = width + 'px';
|
||||
el.style.height = height + 'px';
|
||||
el.style.overflowY = 'auto';
|
||||
el.style.overflowX = 'auto';
|
||||
el.style.boxSizing = 'border-box';
|
||||
el.style.padding = '4px';
|
||||
el.style.fontFamily = 'monospace';
|
||||
el.style.lineHeight = '1.4';
|
||||
el.style.whiteSpace = 'pre';
|
||||
el.style.background = 'var(--background)';
|
||||
el.style.color = 'var(--foreground)';
|
||||
el.style.border = '1px solid var(--lineHighlight)';
|
||||
// reset on every (re-)evaluation instead of persisting scroll state across it
|
||||
el.replaceChildren();
|
||||
el.scrollTop = 0;
|
||||
el.follow = true;
|
||||
el.onscroll = () => {
|
||||
el.follow = el.scrollHeight - el.scrollTop - el.clientHeight < 4;
|
||||
};
|
||||
setWidget(id, el);
|
||||
return el;
|
||||
}
|
||||
|
||||
registerWidget('_pianoroll', (id, options = {}, pat) => {
|
||||
const ctx = getCanvasWidget(id, options).getContext('2d');
|
||||
return pat.tag(id).pianoroll({ fold: 1, ...options, ctx, id });
|
||||
@@ -140,3 +166,9 @@ registerWidget('_spectrum', (id, options = {}, pat) => {
|
||||
const ctx = getCanvasWidget(id, options).getContext('2d');
|
||||
return pat.spectrum({ ...options, ctx, id });
|
||||
});
|
||||
|
||||
registerWidget('_print', (id, options = {}, pat) => {
|
||||
options = { width: 600, height: 100, maxLines: 500, ...options };
|
||||
const el = getListWidget(id, options);
|
||||
return pat.print({ ...options, el, id });
|
||||
});
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// eslint-disable-next-line no-undef
|
||||
// TODO: swap below line with above one when firefox supports esm imports in service workers
|
||||
// see https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker?retiredLocale=de#browser_compatibility
|
||||
// import createClock from './zyklus.mjs';
|
||||
|
||||
+483
-38
@@ -4,8 +4,19 @@ Copyright (C) 2022 Strudel contributors - see <https://codeberg.org/uzu/strudel/
|
||||
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { logger } from './logger.mjs';
|
||||
import { Pattern, pure, register, reify } from './pattern.mjs';
|
||||
import {
|
||||
Pattern,
|
||||
pure,
|
||||
register,
|
||||
reify,
|
||||
logger,
|
||||
stack,
|
||||
slowcat,
|
||||
Fraction,
|
||||
sequence,
|
||||
lcm,
|
||||
__steps,
|
||||
} from '@strudel/pattern';
|
||||
|
||||
export function createParam(names) {
|
||||
let isMulti = Array.isArray(names);
|
||||
@@ -73,6 +84,15 @@ export function registerControl(names, ...aliases) {
|
||||
return bag;
|
||||
}
|
||||
|
||||
// Constructs a superdirt effect bus control
|
||||
const sdbus = register('sdbus', function (busid, control_name, busval, pat) {
|
||||
return pat[control_name]('c' + busid).withValue((val) => {
|
||||
const newval = { ...val };
|
||||
newval['^' + control_name] = [busid, busval];
|
||||
return newval;
|
||||
});
|
||||
});
|
||||
|
||||
export function registerMultiControl(names, maxControls, ...aliases) {
|
||||
names = Array.isArray(names) ? names : [names];
|
||||
let bag = {};
|
||||
@@ -375,7 +395,7 @@ export const { warpsync } = registerControl('warpsync');
|
||||
* @name source
|
||||
* @tags external_io, superdough
|
||||
* @synonyms src
|
||||
* @param {function} getSource
|
||||
* @param {Function} getSource
|
||||
* @synonyms src
|
||||
*
|
||||
*/
|
||||
@@ -869,7 +889,7 @@ export const { begin } = registerControl('begin');
|
||||
/**
|
||||
* The same as .begin, but cuts off the end off each sample.
|
||||
*
|
||||
* @memberof Pattern
|
||||
* @memberof Pattern.prototype
|
||||
* @name end
|
||||
* @tags samples
|
||||
* @param {number | Pattern} length 1 = whole sample, .5 = half sample, .25 = quarter sample etc..
|
||||
@@ -2702,32 +2722,7 @@ export const { seconds } = registerControl('seconds');
|
||||
export const { songPtr } = registerControl('songPtr');
|
||||
export const { uid } = registerControl('uid');
|
||||
export const { val } = registerControl('val');
|
||||
|
||||
/**
|
||||
* Plays the pattern at the given cycles per second. The cps can be patterned. This changes the global tempo, so it generally
|
||||
* makes sense to have either `cps` (or `cpm` - cycles per minute) set by only one of your patterns.
|
||||
* Note that this currently does not work when the 'Sync across Browser Tabs / Windows' setting is switched on.
|
||||
* @tags temporal
|
||||
* @example
|
||||
* s("bd hh sd hh").cps(0.5) // = 1 cycle every 2 seconds
|
||||
* @example
|
||||
* // a smooth change over 4 cycles
|
||||
* s("bd hh sd hh").cps(sine.slow(4).range(0.5,1.5))
|
||||
*/
|
||||
export const { cps } = registerControl('cps');
|
||||
|
||||
/**
|
||||
* Plays the pattern at the given cycles per minute. The cpm can be patterned. This changes the global tempo, so it generally
|
||||
* makes sense to have either `cpm` (or `cps` - cycles per second) set by only one of your patterns.
|
||||
* Note that this currently does not work when the 'Sync across Browser Tabs / Windows' setting is switched on.
|
||||
* @tags temporal
|
||||
* @example
|
||||
* s("bd hh sd hh").cpm(90) // = feels like 180 bpm
|
||||
* // a smooth change over 4 cycles
|
||||
* s("bd hh sd hh").cpm(sine.slow(4).range(30,70))
|
||||
*/
|
||||
export const { cpm } = registerControl('cpm');
|
||||
|
||||
/**
|
||||
* Multiplies the duration with the given number. Also cuts samples off at the end if they exceed the duration.
|
||||
*
|
||||
@@ -3008,7 +3003,7 @@ export const getControlName = (alias) => {
|
||||
*
|
||||
* @name as
|
||||
* @tags combiners
|
||||
* @param {String | Array} mapping the control names that are set
|
||||
* @param {string | Array} mapping the control names that are set
|
||||
* @example
|
||||
* "c:.5 a:1 f:.25 e:.8".as("note:clip")
|
||||
* @example
|
||||
@@ -3033,8 +3028,8 @@ export const as = register('as', (mapping, pat) => {
|
||||
* in the optional array syntax ex: "0.5:2", the second value controls the speed of playback
|
||||
* @name scrub
|
||||
* @tags samples
|
||||
* @memberof Pattern
|
||||
* @returns Pattern
|
||||
* @memberof Pattern.prototype
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* samples('github:switchangel/pad')
|
||||
* s("swpad:0").scrub("{0.1!2 .25@3 0.7!2 <0.8:1.5>}%8")
|
||||
@@ -3174,7 +3169,7 @@ Pattern.prototype.modulate = function (type, config, idPat) {
|
||||
*
|
||||
* @name lfo
|
||||
* @tags lfo, superdough
|
||||
* @param {Object} config LFO configuration.
|
||||
* @param {object} config LFO configuration.
|
||||
* @param {string | Pattern} [config.control] Node to modulate. Aliases: c
|
||||
* @param {string | Pattern} [config.subControl] Sub-control name to append to the control key. Aliases: sc
|
||||
* @param {number | Pattern} [config.rate] Modulation rate. Aliases: r
|
||||
@@ -3188,7 +3183,7 @@ Pattern.prototype.modulate = function (type, config, idPat) {
|
||||
* @param {number | Pattern} [config.retrig] If > 0.5, the LFO will retrigger on each event. Aliases: rt
|
||||
* @param {number | Pattern} [config.fxi] FX index to target
|
||||
* @param {string | Pattern} id ID to use for this modulator
|
||||
* @returns Pattern
|
||||
* @returns {Pattern}
|
||||
*
|
||||
* @example
|
||||
* s("saw").note("F1").lpf(500).lfo()
|
||||
@@ -3229,7 +3224,7 @@ export const lfo = (config) => pure({}).lfo(config);
|
||||
*
|
||||
* @name env
|
||||
* @tags envelope, superdough
|
||||
* @param {Object} config Envelope configuration.
|
||||
* @param {object} config Envelope configuration.
|
||||
* @param {string | Pattern} [config.control] Node to modulate. Aliases: c
|
||||
* @param {string | Pattern} [config.subControl] Sub-control name to append to the control key. Aliases: sc
|
||||
* @param {number | Pattern} [config.depth] Relative modulation depth. Aliases: dep, dr
|
||||
@@ -3243,7 +3238,7 @@ export const lfo = (config) => pure({}).lfo(config);
|
||||
* @param {number | Pattern} [config.rcurve] Snappiness of release curve (-1 = relaxed, 1 = snappy). Aliases: rc
|
||||
* @param {number | Pattern} [config.fxi] FX index to target
|
||||
* @param {string | Pattern} id ID to use for this modulator
|
||||
* @returns Pattern
|
||||
* @returns {Pattern}
|
||||
*
|
||||
* @example
|
||||
* s("saw").note("F1").lpf(500).env({ a: 1 })
|
||||
@@ -3290,7 +3285,7 @@ export const env = (config) => pure({}).env(config);
|
||||
*
|
||||
* @name bmod
|
||||
* @tags superdough
|
||||
* @param {Object} config Bus modulation configuration.
|
||||
* @param {object} config Bus modulation configuration.
|
||||
* @param {string | Pattern} [config.bus] Bus to get modulation signal from
|
||||
* @param {string | Pattern} [config.control] Node to modulate. Aliases: c
|
||||
* @param {string | Pattern} [config.subControl] Sub-control name to append to the control key. Aliases: sc
|
||||
@@ -3299,7 +3294,7 @@ export const env = (config) => pure({}).env(config);
|
||||
* @param {number | Pattern} [config.dc] DC offset prior to application
|
||||
* @param {number | Pattern} [config.fxi] FX index to target
|
||||
* @param {string | Pattern} id ID to use for this modulator
|
||||
* @returns Pattern
|
||||
* @returns {Pattern}
|
||||
*
|
||||
* @example
|
||||
* modulator: s("one").seg(64).gain(slider(0, 0, 1)).bus(1).dry(0)
|
||||
@@ -3327,3 +3322,453 @@ export const bmod = (config) => pure({}).bmod(config);
|
||||
export const { transient } = registerControl(['transient', 'transsustain']);
|
||||
|
||||
export const { FXrelease, FXrel, FXr, fxr } = registerControl('FXrelease', 'FXrel', 'FXr', 'fxr');
|
||||
|
||||
// moved from pattern.mjs, because they use controls:
|
||||
|
||||
/**
|
||||
* Both speeds up the pattern (like 'fast') and the sample playback (like 'speed').
|
||||
* @tags temporal
|
||||
* @example
|
||||
* s("bd sd:2").hurry("<1 2 4 3>").slow(1.5)
|
||||
*/
|
||||
export const hurry = register('hurry', function (r, pat) {
|
||||
return pat._fast(r).mul(pure({ speed: r }));
|
||||
});
|
||||
|
||||
/**
|
||||
* Jux with adjustable stereo width. 0 = mono, 1 = full stereo.
|
||||
* @tags temporal
|
||||
* @name juxBy
|
||||
* @synonyms juxby
|
||||
* @example
|
||||
* s("bd lt [~ ht] mt cp ~ bd hh").juxBy("<0 .5 1>/2", rev)
|
||||
*/
|
||||
export const { juxBy, juxby } = register(['juxBy', 'juxby'], function (by, func, pat) {
|
||||
by /= 2;
|
||||
const elem_or = function (dict, key, dflt) {
|
||||
if (key in dict) {
|
||||
return dict[key];
|
||||
}
|
||||
return dflt;
|
||||
};
|
||||
const left = pat.withValue((val) => Object.assign({}, val, { pan: elem_or(val, 'pan', 0.5) - by }));
|
||||
const right = func(pat.withValue((val) => Object.assign({}, val, { pan: elem_or(val, 'pan', 0.5) + by })));
|
||||
|
||||
return stack(left, right).setSteps(__steps ? lcm(left._steps, right._steps) : undefined);
|
||||
});
|
||||
|
||||
/**
|
||||
* Like juxBy, except it flips the ears each cycle.
|
||||
* @name juxFlipBy
|
||||
* @synonyms juxflipby, fluxBy, fluxby
|
||||
* @example
|
||||
* s("bd lt [~ ht] mt cp ~ bd hh").juxFlipBy(".8", rev)
|
||||
*/
|
||||
export const { juxFlipBy, juxflipby, fluxBy, fluxby } = register(
|
||||
['juxFlipBy', 'juxflipby', 'fluxBy', 'fluxby'],
|
||||
function (by, func, pat) {
|
||||
return pat.juxBy(slowcat(by, -by), func);
|
||||
},
|
||||
);
|
||||
|
||||
/**
|
||||
* The jux function creates strange stereo effects, by applying a function to a pattern, but only in the right-hand channel.
|
||||
* @tags temporal, superdough
|
||||
* @example
|
||||
* s("bd lt [~ ht] mt cp ~ bd hh").jux(rev)
|
||||
* @example
|
||||
* s("bd lt [~ ht] mt cp ~ bd hh").jux(press)
|
||||
* @example
|
||||
* s("bd lt [~ ht] mt cp ~ bd hh").jux(iter(4))
|
||||
*/
|
||||
export const jux = register('jux', function (func, pat) {
|
||||
return pat._juxBy(1, func, pat);
|
||||
});
|
||||
|
||||
/**
|
||||
* Like jux, but flips the ears each cycle.
|
||||
* @name juxFlip
|
||||
* @synonyms juxflip, flux
|
||||
* @example
|
||||
* s("bd lt [~ ht] mt cp ~ bd hh").juxFlip(rev)
|
||||
* @example
|
||||
* s("bd lt [~ ht] mt cp ~ bd hh").juxFlip(press)
|
||||
* @example
|
||||
* s("bd lt [~ ht] mt cp ~ bd hh").juxFlip(iter(4))
|
||||
*/
|
||||
export const { juxFlip, flux } = register(['juxFlip', 'juxflip', 'flux'], function (func, pat) {
|
||||
return pat._juxFlipBy(1, func, pat);
|
||||
});
|
||||
|
||||
/**
|
||||
* Superimpose and offset multiple times, gradually decreasing the velocity
|
||||
* @tags temporal
|
||||
* @name echo
|
||||
* @memberof Pattern.prototype
|
||||
* @returns {Pattern}
|
||||
* @param {number} times how many times to repeat
|
||||
* @param {number} time cycle offset between iterations
|
||||
* @param {number} feedback velocity multiplicator for each iteration
|
||||
* @example
|
||||
* s("bd sd").echo(3, 1/6, .8)
|
||||
*/
|
||||
export const echo = register('echo', function (times, time, feedback, pat) {
|
||||
return pat._echoWith(times, time, (pat, i) => pat.gain(Math.pow(feedback, i)));
|
||||
});
|
||||
|
||||
/**
|
||||
* Deprecated. Like echo, but the last 2 parameters are flipped.
|
||||
* @tags temporal
|
||||
* @name stut
|
||||
* @param {number} times how many times to repeat
|
||||
* @param {number} feedback velocity multiplicator for each iteration
|
||||
* @param {number} time cycle offset between iterations
|
||||
* @example
|
||||
* s("bd sd").stut(3, .8, 1/6)
|
||||
*/
|
||||
export const stut = register('stut', function (times, feedback, time, pat) {
|
||||
return pat._echoWith(times, time, (pat, i) => pat.gain(Math.pow(feedback, i)));
|
||||
});
|
||||
|
||||
/**
|
||||
* Sets the pattern's color to the given [hsla](https://www.w3schools.com/htmL/html_colors_hsl.asp)
|
||||
*
|
||||
* @name hsla
|
||||
* @param {number} hue (0 - 360)
|
||||
* @param {number} saturation percentage (0 - 100)
|
||||
* @param {number} lightness percentage (0 - 100)
|
||||
* @param {number} alpha (transparency) (0.0 - 1.0)
|
||||
* @tags visualization
|
||||
*/
|
||||
export const hsla = register('hsla', (h, s, l, a, pat) => {
|
||||
return pat.color(`hsla(${h}turn,${s * 100}%,${l * 100}%,${a})`);
|
||||
});
|
||||
|
||||
/**
|
||||
* Sets the pattern's color to the given [hsl](https://www.w3schools.com/htmL/html_colors_hsl.asp)
|
||||
*
|
||||
* @name hsl
|
||||
* @param {number} hue (0 - 360)
|
||||
* @param {number} saturation percentage (0 - 100)
|
||||
* @param {number} lightness percentage (0 - 100)
|
||||
* @tags visualization
|
||||
*/
|
||||
export const hsl = register('hsl', (h, s, l, pat) => {
|
||||
return pat.color(`hsl(${h}turn,${s * 100}%,${l * 100}%)`);
|
||||
});
|
||||
|
||||
/**
|
||||
* Cuts each sample into the given number of parts, allowing you to explore a technique known as 'granular synthesis'.
|
||||
* It turns a pattern of samples into a pattern of parts of samples.
|
||||
* @name chop
|
||||
* @tags samples
|
||||
* @memberof Pattern.prototype
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* samples({ rhodes: 'https://cdn.freesound.org/previews/132/132051_316502-lq.mp3' })
|
||||
* s("rhodes")
|
||||
* .chop(4)
|
||||
* .rev() // reverse order of chops
|
||||
* .loopAt(2) // fit sample into 2 cycles
|
||||
*
|
||||
*/
|
||||
export const chop = register('chop', function (n, pat) {
|
||||
const slices = Array.from({ length: n }, (x, i) => i);
|
||||
const slice_objects = slices.map((i) => ({ begin: i / n, end: (i + 1) / n }));
|
||||
const merge = function (a, b) {
|
||||
if ('begin' in a && 'end' in a && a.begin !== undefined && a.end !== undefined) {
|
||||
const d = a.end - a.begin;
|
||||
b = { begin: a.begin + b.begin * d, end: a.begin + b.end * d };
|
||||
}
|
||||
// return a;
|
||||
return Object.assign({}, a, b);
|
||||
};
|
||||
const func = function (o) {
|
||||
return sequence(slice_objects.map((slice_o) => merge(o, slice_o)));
|
||||
};
|
||||
return pat.squeezeBind(func).setSteps(__steps ? Fraction(n).mulmaybe(pat._steps) : undefined);
|
||||
});
|
||||
|
||||
/**
|
||||
* Cuts each sample into the given number of parts, triggering progressive portions of each sample at each loop.
|
||||
* @name striate
|
||||
* @tags samples
|
||||
* @memberof Pattern.prototype
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* s("numbers:0 numbers:1 numbers:2").striate(6).slow(3)
|
||||
*/
|
||||
export const striate = register('striate', function (n, pat) {
|
||||
const slices = Array.from({ length: n }, (x, i) => i);
|
||||
const slice_objects = slices.map((i) => ({ begin: i / n, end: (i + 1) / n }));
|
||||
const slicePat = slowcat(...slice_objects);
|
||||
return pat
|
||||
.set(slicePat)
|
||||
._fast(n)
|
||||
.setSteps(__steps ? Fraction(n).mulmaybe(pat._steps) : undefined);
|
||||
});
|
||||
|
||||
/**
|
||||
* Makes the sample fit the given number of cycles by changing the speed.
|
||||
* @param {number} factor
|
||||
* @param {Pattern} pat
|
||||
* @param {number} [cps=0.5]
|
||||
* @name loopAt
|
||||
* @tags samples, pitch
|
||||
* @memberof Pattern.prototype
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* samples({ rhodes: 'https://cdn.freesound.org/previews/132/132051_316502-lq.mp3' })
|
||||
* s("rhodes").loopAt(2)
|
||||
*/
|
||||
const _loopAt = function (factor, pat, cps = 0.5) {
|
||||
return pat
|
||||
.speed((1 / factor) * cps)
|
||||
.unit('c')
|
||||
.slow(factor);
|
||||
};
|
||||
|
||||
export const { loopAt, loopat } = register(['loopAt', 'loopat'], function (factor, pat) {
|
||||
const steps = pat._steps ? pat._steps.div(factor) : undefined;
|
||||
return new Pattern((state) => _loopAt(factor, pat, state.controls._cps).query(state), steps);
|
||||
});
|
||||
|
||||
/**
|
||||
* Chops samples into the given number of slices, triggering those slices with a given pattern of slice numbers.
|
||||
* Instead of a number, it also accepts a list of numbers from 0 to 1 to slice at specific points.
|
||||
* @name slice
|
||||
* @tags samples
|
||||
* @memberof Pattern.prototype
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* samples('github:tidalcycles/dirt-samples')
|
||||
* s("breaks165").slice(8, "0 1 <2 2*2> 3 [4 0] 5 6 7".every(3, rev)).slow(0.75)
|
||||
* @example
|
||||
* samples('github:tidalcycles/dirt-samples')
|
||||
* s("breaks125").fit().slice([0,.25,.5,.75], "0 1 1 <2 3>")
|
||||
*/
|
||||
|
||||
export const slice = register(
|
||||
'slice',
|
||||
function (npat, ipat, opat) {
|
||||
return npat
|
||||
.innerBind((n) =>
|
||||
ipat.outerBind((i) =>
|
||||
opat.outerBind((o) => {
|
||||
// If it's not an object, assume it's a string and make it a 's' control parameter
|
||||
o = o instanceof Object ? o : { s: o };
|
||||
const begin = Array.isArray(n) ? n[i] : i / n;
|
||||
const end = Array.isArray(n) ? n[i + 1] : (i + 1) / n;
|
||||
return pure({ begin, end, _slices: n, ...o });
|
||||
}),
|
||||
),
|
||||
)
|
||||
.setSteps(ipat._steps);
|
||||
},
|
||||
false, // turns off auto-patternification
|
||||
);
|
||||
|
||||
/**
|
||||
* Works the same as slice, but changes the playback speed of each slice to match the duration of its step.
|
||||
* @name splice
|
||||
* @tags samples, pitch
|
||||
* @example
|
||||
* samples('github:tidalcycles/dirt-samples')
|
||||
* s("breaks165")
|
||||
* .splice(8, "0 1 [2 3 0]@2 3 0@2 7")
|
||||
*/
|
||||
|
||||
export const splice = register(
|
||||
'splice',
|
||||
function (npat, ipat, opat) {
|
||||
const sliced = slice(npat, ipat, opat);
|
||||
return new Pattern((state) => {
|
||||
// TODO - default cps to 0.5
|
||||
const cps = state.controls._cps || 1;
|
||||
const haps = sliced.query(state);
|
||||
return haps.map((hap) =>
|
||||
hap.withValue((v) => ({
|
||||
...{
|
||||
speed: (cps / v._slices / hap.whole.duration) * (v.speed || 1),
|
||||
unit: 'c',
|
||||
},
|
||||
...v,
|
||||
})),
|
||||
);
|
||||
}).setSteps(ipat._steps);
|
||||
},
|
||||
false, // turns off auto-patternification
|
||||
);
|
||||
|
||||
/**
|
||||
* Makes the sample fit its event duration. Good for rhythmical loops like drum breaks.
|
||||
* Similar to `loopAt`.
|
||||
* @name fit
|
||||
* @tags samples, pitch
|
||||
* @example
|
||||
* samples({ rhodes: 'https://cdn.freesound.org/previews/132/132051_316502-lq.mp3' })
|
||||
* s("rhodes/2").fit()
|
||||
*/
|
||||
export const fit = register('fit', (pat) =>
|
||||
pat.withHaps((haps, state) =>
|
||||
haps.map((hap) =>
|
||||
hap.withValue((v) => {
|
||||
const slicedur = ('end' in v ? v.end : 1) - ('begin' in v ? v.begin : 0);
|
||||
return {
|
||||
...v,
|
||||
speed: ((state.controls._cps || 1) / hap.whole.duration) * slicedur,
|
||||
unit: 'c',
|
||||
};
|
||||
}),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* Makes the sample fit the given number of cycles and cps value, by
|
||||
* changing the speed. deprecated: use loopAt or fit instead, together with setCps / setCpm.
|
||||
* @name loopAtCps
|
||||
* @tags samples, pitch
|
||||
* @memberof Pattern.prototype
|
||||
* @deprecated
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* samples({ rhodes: 'https://cdn.freesound.org/previews/132/132051_316502-lq.mp3' })
|
||||
* s("rhodes").loopAtCps(4,1.5).cps(1.5)
|
||||
*/
|
||||
export const { loopAtCps, loopatcps } = register(['loopAtCps', 'loopatcps'], function (factor, cps, pat) {
|
||||
return _loopAt(factor, pat, cps);
|
||||
});
|
||||
|
||||
let fadeGain = (p) => (p < 0.5 ? 1 : 1 - (p - 0.5) / 0.5);
|
||||
|
||||
/**
|
||||
* Cross-fades between left and right from 0 to 1:
|
||||
* - 0 = (full left, no right)
|
||||
* - .5 = (both equal)
|
||||
* - 1 = (no left, full right)
|
||||
*
|
||||
* @param {Pattern} a
|
||||
* @param {Pattern} pos
|
||||
* @param {Pattern} b
|
||||
* @name xfade
|
||||
* @tags amplitude
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* xfade(s("bd*2"), "<0 .25 .5 .75 1>", s("hh*8"))
|
||||
*/
|
||||
export let xfade = (a, pos, b) => {
|
||||
pos = reify(pos);
|
||||
a = reify(a);
|
||||
b = reify(b);
|
||||
let gaina = pos.fmap((v) => ({ gain: fadeGain(v) }));
|
||||
let gainb = pos.fmap((v) => ({ gain: fadeGain(1 - v) }));
|
||||
return stack(a.mul(gaina), b.mul(gainb));
|
||||
};
|
||||
|
||||
// the prototype version is actually flipped so left/right makes sense
|
||||
Pattern.prototype.xfade = function (pos, b) {
|
||||
return xfade(this, pos, b);
|
||||
};
|
||||
|
||||
const _distortWithAlg = function (name) {
|
||||
const func = function (args, pat) {
|
||||
const argsPat = reify(args).fmap((v) => (Array.isArray(v) ? [...v, name] : [v, 1, name]));
|
||||
if (!pat) {
|
||||
return pure({}).distort(argsPat);
|
||||
}
|
||||
return pat.distort(argsPat);
|
||||
};
|
||||
Pattern.prototype[name] = function (args) {
|
||||
return func(args, this);
|
||||
};
|
||||
return func;
|
||||
};
|
||||
|
||||
/**
|
||||
* Soft-clipping distortion
|
||||
*
|
||||
* @name soft
|
||||
* @tags distortion, superdough
|
||||
* @param {number | Pattern} distortion amount of distortion to apply
|
||||
* @param {number | Pattern} volume linear postgain of the distortion
|
||||
*
|
||||
*/
|
||||
export const soft = _distortWithAlg('soft');
|
||||
|
||||
/**
|
||||
* Hard-clipping distortion
|
||||
*
|
||||
* @name hard
|
||||
* @tags distortion, superdough
|
||||
* @param {number | Pattern} distortion amount of distortion to apply
|
||||
* @param {number | Pattern} volume linear postgain of the distortion
|
||||
*
|
||||
*/
|
||||
export const hard = _distortWithAlg('hard');
|
||||
|
||||
/**
|
||||
* Cubic polynomial distortion
|
||||
*
|
||||
* @name cubic
|
||||
* @tags distortion, superdough
|
||||
* @param {number | Pattern} distortion amount of distortion to apply
|
||||
* @param {number | Pattern} volume linear postgain of the distortion
|
||||
*
|
||||
*/
|
||||
export const cubic = _distortWithAlg('cubic');
|
||||
|
||||
/**
|
||||
* Diode-emulating distortion
|
||||
*
|
||||
* @name diode
|
||||
* @tags distortion, superdough
|
||||
* @param {number | Pattern} distortion amount of distortion to apply
|
||||
* @param {number | Pattern} volume linear postgain of the distortion
|
||||
*
|
||||
*/
|
||||
export const diode = _distortWithAlg('diode');
|
||||
|
||||
/**
|
||||
* Asymmetrical diode distortion
|
||||
*
|
||||
* @name asym
|
||||
* @tags distortion, superdough
|
||||
* @param {number | Pattern} distortion amount of distortion to apply
|
||||
* @param {number | Pattern} volume linear postgain of the distortion
|
||||
*
|
||||
*/
|
||||
export const asym = _distortWithAlg('asym');
|
||||
|
||||
/**
|
||||
* Wavefolding distortion
|
||||
*
|
||||
* @name fold
|
||||
* @tags distortion, superdough
|
||||
* @param {number | Pattern} distortion amount of distortion to apply
|
||||
* @param {number | Pattern} volume linear postgain of the distortion
|
||||
*
|
||||
*/
|
||||
export const fold = _distortWithAlg('fold');
|
||||
|
||||
/**
|
||||
* Wavefolding distortion composed with sinusoid
|
||||
*
|
||||
* @name sinefold
|
||||
* @tags distortion, superdough
|
||||
* @param {number | Pattern} distortion amount of distortion to apply
|
||||
* @param {number | Pattern} volume linear postgain of the distortion
|
||||
*
|
||||
*/
|
||||
export const sinefold = _distortWithAlg('sinefold');
|
||||
|
||||
/**
|
||||
* Distortion via Chebyshev polynomials
|
||||
*
|
||||
* @name chebyshev
|
||||
* @tags distortion, superdough
|
||||
* @param {number | Pattern} distortion amount of distortion to apply
|
||||
* @param {number | Pattern} volume linear postgain of the distortion
|
||||
*
|
||||
*/
|
||||
export const chebyshev = _distortWithAlg('chebyshev');
|
||||
|
||||
+12
-14
@@ -5,7 +5,7 @@ This program is free software: you can redistribute it and/or modify it under th
|
||||
*/
|
||||
|
||||
import createClock from './zyklus.mjs';
|
||||
import { errorLogger, logger } from './logger.mjs';
|
||||
import { errorLogger, logger } from '@strudel/pattern';
|
||||
|
||||
export class Cyclist {
|
||||
constructor({
|
||||
@@ -74,20 +74,20 @@ export class Cyclist {
|
||||
// query the pattern for events
|
||||
const haps = this.pattern
|
||||
.queryArc(begin, end, { _cps: this.cps, cyclist: 'cyclist' })
|
||||
.filter((hap) => hap.hasOnset())
|
||||
.filter((hap) => hap.hasOnset() || hap.context.processParts)
|
||||
// Sort the haps based on their onset, so cps changes within the
|
||||
// tick duration happen in the correct order.
|
||||
.sort((a, b) => {
|
||||
const aBegin = a.whole.begin;
|
||||
const bBegin = b.whole.begin;
|
||||
const aBegin = a.part.begin;
|
||||
const bBegin = b.part.begin;
|
||||
// If haps happen at the same time, trigger the haps that cause
|
||||
// cps changes first, so the durations of the simultaneous haps
|
||||
// are adjusted accordingly.
|
||||
if (aBegin.eq(bBegin)) {
|
||||
if (a.value.cps !== undefined || a.value.cpm !== undefined) {
|
||||
return b.value.cps !== undefined || b.value.cpm !== undefined ? 0 : -1;
|
||||
if (a.value.cps !== undefined) {
|
||||
return b.value.cps !== undefined ? 0 : -1;
|
||||
}
|
||||
if (b.value.cps !== undefined || b.value.cpm !== undefined) {
|
||||
if (b.value.cps !== undefined) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
@@ -96,9 +96,7 @@ export class Cyclist {
|
||||
});
|
||||
|
||||
haps.forEach((hap) => {
|
||||
const targetTime = (hap.whole.begin - this.checkpoint.cycles) / this.cps + this.checkpoint.seconds;
|
||||
let hapCps = hap.value.cps;
|
||||
hapCps ??= hap.value.cpm != null ? hap.value.cpm / 60 : undefined;
|
||||
const targetTime = (hap.part.begin - this.checkpoint.cycles) / this.cps + this.checkpoint.seconds;
|
||||
if (tickEndTime < targetTime) {
|
||||
// If the targetTime exceeds the tickEndTime, this means
|
||||
// the cps has slowed down, and the latter haps from the query
|
||||
@@ -106,13 +104,13 @@ export class Cyclist {
|
||||
// They'll be scheduled during the next tick.
|
||||
return;
|
||||
}
|
||||
onSchedule?.(hap, targetTime + this.latency, hapCps ?? this.cps);
|
||||
if (hapCps !== undefined && this.cps != hapCps) {
|
||||
onSchedule?.(hap, targetTime + this.latency, hap.value.cps ?? this.cps);
|
||||
if (hap.value.cps !== undefined && this.cps != hap.value.cps) {
|
||||
cpsChanged = true;
|
||||
this.cps = hapCps;
|
||||
this.cps = hap.value.cps;
|
||||
this.num_ticks_since_checkpoint = 0;
|
||||
this.checkpoint = {
|
||||
cycles: hap.whole.begin,
|
||||
cycles: hap.part.begin,
|
||||
seconds: targetTime,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ Copyright (C) 2022 Strudel contributors - see <https://codeberg.org/uzu/strudel/
|
||||
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
export const strudelScope = {};
|
||||
import { strudelScope } from '@strudel/pattern';
|
||||
|
||||
export const evalScope = async (...args) => {
|
||||
const results = await Promise.allSettled(args);
|
||||
|
||||
+35
-27
@@ -5,37 +5,45 @@ This program is free software: you can redistribute it and/or modify it under th
|
||||
*/
|
||||
|
||||
import * as controls from './controls.mjs'; // legacy
|
||||
export * from './euclid.mjs';
|
||||
import Fraction from './fraction.mjs';
|
||||
import createClock from './zyklus.mjs';
|
||||
import { logger } from './logger.mjs';
|
||||
export { Fraction, controls, createClock };
|
||||
import { Pattern } from '@strudel/pattern';
|
||||
export { controls, createClock };
|
||||
export * from '@strudel/pattern';
|
||||
export * from './controls.mjs';
|
||||
export * from './cyclist.mjs';
|
||||
export * from './evaluate.mjs';
|
||||
export * from './hap.mjs';
|
||||
export * from './impure.mjs';
|
||||
export * from './logger.mjs';
|
||||
export * from './pattern.mjs';
|
||||
export * from './pick.mjs';
|
||||
export * from './repl.mjs';
|
||||
export * from './signal.mjs';
|
||||
export * from './speak.mjs';
|
||||
export * from './state.mjs';
|
||||
export * from './schedulerState.mjs';
|
||||
export * from './timespan.mjs';
|
||||
export * from './ui.mjs';
|
||||
export * from './util.mjs';
|
||||
export { default as drawLine } from './drawLine.mjs';
|
||||
// below won't work with runtime.mjs (json import fails)
|
||||
/* import * as p from './package.json';
|
||||
export const version = p.version; */
|
||||
logger('🌀 @strudel/core loaded 🌀');
|
||||
if (globalThis._strudelLoaded) {
|
||||
console.warn(
|
||||
`@strudel/core was loaded more than once...
|
||||
This might happen when you have multiple versions of strudel installed.
|
||||
Please check with "npm ls @strudel/core".`,
|
||||
);
|
||||
}
|
||||
globalThis._strudelLoaded = true;
|
||||
export * from './evaluate.mjs';
|
||||
import { getClockTime } from './schedulerState.mjs';
|
||||
|
||||
// legacy:
|
||||
Pattern.prototype.onTrigger = function (onTrigger, dominant = true) {
|
||||
console.warn('onTrigger is deprecated.. use onSchedule(hap, time, cps) instead');
|
||||
return this.onSchedule((hap, t, cps) => {
|
||||
const currentTime = getClockTime();
|
||||
return onTrigger(hap, currentTime, cps, t);
|
||||
}, dominant);
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* make something happen on event time
|
||||
* uses browser timeout which is innacurate for audio tasks
|
||||
* @param {Function} func
|
||||
* @name onTriggerTime
|
||||
* @tags external_io
|
||||
* @memberof Pattern.prototype
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* s("bd!8").onTriggerTime((hap) => {console.log(hap)})
|
||||
*/
|
||||
Pattern.prototype.onTriggerTime = function (func) {
|
||||
return this.onSchedule((hap, targetTime) => {
|
||||
const diff = targetTime - getClockTime();
|
||||
setTimeout(() => {
|
||||
func(hap);
|
||||
}, diff * 1000);
|
||||
}, false);
|
||||
};
|
||||
|
||||
@@ -4,8 +4,7 @@ Copyright (C) 2022 Strudel contributors - see <https://codeberg.org/uzu/strudel/
|
||||
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { logger } from './logger.mjs';
|
||||
import { ClockCollator, cycleToSeconds } from './util.mjs';
|
||||
import { logger, ClockCollator, cycleToSeconds } from '@strudel/pattern';
|
||||
|
||||
export class NeoCyclist {
|
||||
constructor({ onSchedule, onToggle, getTime, onTrigger }) {
|
||||
|
||||
@@ -31,7 +31,8 @@
|
||||
},
|
||||
"homepage": "https://strudel.cc",
|
||||
"dependencies": {
|
||||
"fraction.js": "^5.2.1"
|
||||
"fraction.js": "^5.2.1",
|
||||
"@strudel/pattern": "workspace:*"
|
||||
},
|
||||
"gitHead": "0e26d4e741500f5bae35b023608f062a794905c2",
|
||||
"devDependencies": {
|
||||
|
||||
+12
-5
@@ -1,7 +1,9 @@
|
||||
import { NeoCyclist } from './neocyclist.mjs';
|
||||
import { evalScope } from './evaluate.mjs';
|
||||
import { Cyclist } from './cyclist.mjs';
|
||||
import { reset_state } from '@strudel/pattern';
|
||||
import { evaluate as _evaluate } from './evaluate.mjs';
|
||||
import { errorLogger, logger } from './logger.mjs';
|
||||
import { errorLogger, logger, register, Pattern, isPattern, silence, stack } from '@strudel/pattern';
|
||||
import {
|
||||
setCpsFunc,
|
||||
setIsStarted,
|
||||
@@ -10,9 +12,6 @@ import {
|
||||
setScheduleFunc,
|
||||
setClockTime,
|
||||
} from './schedulerState.mjs';
|
||||
import { evalScope } from './evaluate.mjs';
|
||||
import { register, Pattern, isPattern, silence, stack } from './pattern.mjs';
|
||||
import { reset_state } from './impure.mjs';
|
||||
|
||||
export function repl({
|
||||
onSchedule,
|
||||
@@ -127,6 +126,7 @@ export function repl({
|
||||
* @tags temporal
|
||||
* @alias setCpm
|
||||
* @param {number} cpm cycles per minute
|
||||
* @returns {pattern}
|
||||
* @example
|
||||
* setcpm(140/4) // =140 bpm in 4/4
|
||||
* $: s("bd*4,[- sd]*2").bank('tr707')
|
||||
@@ -156,7 +156,8 @@ export function repl({
|
||||
* $: sound("hh*8")
|
||||
* all(x => x.pianoroll())
|
||||
* ```
|
||||
*
|
||||
* @param {function(Pattern):Pattern} transform
|
||||
* @returns {Pattern}
|
||||
* @tags combiners
|
||||
*/
|
||||
const all = function (transform) {
|
||||
@@ -174,6 +175,8 @@ export function repl({
|
||||
* each(fast("<2 3>"))
|
||||
* ```
|
||||
* @tags combiners
|
||||
* @param {function(Pattern):Pattern} transform
|
||||
* @returns {pattern}
|
||||
*/
|
||||
const each = function (transform) {
|
||||
eachTransform = transform;
|
||||
@@ -217,10 +220,14 @@ export function repl({
|
||||
} catch (err) {
|
||||
console.warn('injectPatternMethods: error:', err);
|
||||
}
|
||||
const cpm = register('cpm', function (cpm, pat) {
|
||||
return pat._fast(cpm / 60 / scheduler.cps);
|
||||
});
|
||||
return evalScope({
|
||||
all,
|
||||
each,
|
||||
hush,
|
||||
cpm,
|
||||
setCps,
|
||||
setcps: setCps,
|
||||
setCpm,
|
||||
|
||||
@@ -11,9 +11,10 @@ let scheduleFunc;
|
||||
let isStarted;
|
||||
|
||||
/**
|
||||
* Get the current cycle time as a number
|
||||
* @name getTime
|
||||
* @tags internals
|
||||
* @returns {Number} the current cycle time as a number
|
||||
* @returns {number}
|
||||
*/
|
||||
export function getTime() {
|
||||
if (!time) {
|
||||
@@ -28,9 +29,10 @@ export function setTime(func) {
|
||||
|
||||
let clockTime;
|
||||
/**
|
||||
* Get the current clock time in seconds (onSchedule time)
|
||||
* @name getClockTime
|
||||
* @tags internals
|
||||
* @returns {Number} the current clock time in seconds (onSchedule time)
|
||||
* @returns {number}
|
||||
*/
|
||||
export function getClockTime() {
|
||||
if (!clockTime) {
|
||||
@@ -48,9 +50,10 @@ export function setCpsFunc(func) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current cycles per second
|
||||
* @name getCps
|
||||
* @tags internals
|
||||
* @returns {Number} the current cycles per second
|
||||
* @returns {number}
|
||||
*/
|
||||
export function getCps() {
|
||||
return cpsFunc?.();
|
||||
|
||||
@@ -7,7 +7,8 @@ This program is free software: you can redistribute it and/or modify it under th
|
||||
import { s, pan, getControlName } from '../controls.mjs';
|
||||
import { mini } from '../../mini/mini.mjs';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import Fraction from '../fraction.mjs';
|
||||
import { Fraction, sequence, pure, fast, stack } from '@strudel/pattern';
|
||||
import { sameFirst } from '../../pattern/test/pattern.test.mjs';
|
||||
|
||||
describe('controls', () => {
|
||||
it('should support controls', () => {
|
||||
@@ -44,3 +45,117 @@ describe('controls', () => {
|
||||
expect(getControlName('cutoff')).toEqual('cutoff');
|
||||
});
|
||||
});
|
||||
|
||||
describe('chop', () => {
|
||||
it('Can _chop(2)', () => {
|
||||
expect(sequence({ sound: 'a' }, { sound: 'b' })._chop(2).firstCycle()).toStrictEqual(
|
||||
sequence(
|
||||
{ sound: 'a', begin: 0, end: 0.5 },
|
||||
{ sound: 'a', begin: 0.5, end: 1 },
|
||||
{ sound: 'b', begin: 0, end: 0.5 },
|
||||
{ sound: 'b', begin: 0.5, end: 1 },
|
||||
).firstCycle(),
|
||||
);
|
||||
});
|
||||
it('Can chop(2,3)', () => {
|
||||
expect(pure({ sound: 'a' }).fast(2).chop(2, 3).sortHapsByPart().firstCycle()).toStrictEqual(
|
||||
sequence(
|
||||
[
|
||||
{ sound: 'a', begin: 0, end: 0.5 },
|
||||
{ sound: 'a', begin: 0.5, end: 1 },
|
||||
],
|
||||
[
|
||||
{ sound: 'a', begin: 0, end: 1 / 3 },
|
||||
{ sound: 'a', begin: 1 / 3, end: 2 / 3 },
|
||||
{ sound: 'a', begin: 2 / 3, end: 1 },
|
||||
],
|
||||
)
|
||||
.sortHapsByPart()
|
||||
.firstCycle(),
|
||||
);
|
||||
});
|
||||
it('Can chop chops', () => {
|
||||
expect(pure({ s: 'bev' }).chop(2).chop(2).firstCycle()).toStrictEqual(pure({ s: 'bev' }).chop(4).firstCycle());
|
||||
});
|
||||
});
|
||||
|
||||
describe('loopAt', () => {
|
||||
it('maintains steps', () => {
|
||||
expect(s('bev').chop(8).loopAt(2)._steps).toStrictEqual(Fraction(4));
|
||||
});
|
||||
});
|
||||
|
||||
describe('_steps', () => {
|
||||
it('Is correctly preserved/calculated through transformations', () => {
|
||||
expect(sequence({ n: 0 }, { n: 1 }, { n: 2 }).chop(4)._steps).toStrictEqual(Fraction(12));
|
||||
expect(sequence(0, 1, 2, 3).hurry(4)._steps).toStrictEqual(Fraction(4));
|
||||
expect(sequence({ s: 'bev' }, { s: 'amenbreak' }).chop(4)._steps).toStrictEqual(Fraction(8));
|
||||
expect(sequence({ s: 'bev' }, { s: 'amenbreak' }).striate(4)._steps).toStrictEqual(Fraction(8));
|
||||
expect(sequence({ s: 'bev' }, { s: 'amenbreak' }).slice(4, sequence(0, 1, 2, 3))._steps).toStrictEqual(Fraction(4));
|
||||
expect(sequence({ s: 'bev' }, { s: 'amenbreak' }).splice(4, sequence(0, 1, 2, 3))._steps).toStrictEqual(
|
||||
Fraction(4),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('hurry', () => {
|
||||
it('Can speed up patterns and sounds', () => {
|
||||
sameFirst(s(sequence('a', 'b')).hurry(2), s(sequence('a', 'b')).fast(2).set({ speed: 2 }));
|
||||
});
|
||||
});
|
||||
|
||||
describe('jux', () => {
|
||||
it('Can juxtapose', () => {
|
||||
expect(pure({ a: 1 }).jux(fast(2)).sortHapsByPart().firstCycle()).toStrictEqual(
|
||||
stack(pure({ a: 1, pan: 0 }), pure({ a: 1, pan: 1 }).fast(2))
|
||||
.sortHapsByPart()
|
||||
.firstCycle(),
|
||||
);
|
||||
});
|
||||
});
|
||||
describe('juxBy', () => {
|
||||
it('Can juxtapose by half', () => {
|
||||
expect(pure({ a: 1 }).juxBy(0.5, fast(2)).sortHapsByPart().firstCycle()).toStrictEqual(
|
||||
stack(pure({ a: 1, pan: 0.25 }), pure({ a: 1, pan: 0.75 }).fast(2))
|
||||
.sortHapsByPart()
|
||||
.firstCycle(),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('striate', () => {
|
||||
it('Can striate(2)', () => {
|
||||
sameFirst(
|
||||
sequence({ sound: 'a' }).striate(2),
|
||||
sequence({ sound: 'a', begin: 0, end: 0.5 }, { sound: 'a', begin: 0.5, end: 1 }),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('slice', () => {
|
||||
it('Can slice a sample', () => {
|
||||
sameFirst(
|
||||
s('break').slice(4, sequence(0, 1, 2, 3)),
|
||||
sequence(
|
||||
{ begin: 0, end: 0.25, s: 'break', _slices: 4 },
|
||||
{ begin: 0.25, end: 0.5, s: 'break', _slices: 4 },
|
||||
{ begin: 0.5, end: 0.75, s: 'break', _slices: 4 },
|
||||
{ begin: 0.75, end: 1, s: 'break', _slices: 4 },
|
||||
),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('splice', () => {
|
||||
it('Can splice a sample', () => {
|
||||
sameFirst(
|
||||
s('break').splice(4, sequence(0, 1, 2, 3)),
|
||||
sequence(
|
||||
{ begin: 0, end: 0.25, s: 'break', _slices: 4, unit: 'c', speed: 1 },
|
||||
{ begin: 0.25, end: 0.5, s: 'break', _slices: 4, unit: 'c', speed: 1 },
|
||||
{ begin: 0.5, end: 0.75, s: 'break', _slices: 4, unit: 'c', speed: 1 },
|
||||
{ begin: 0.75, end: 1, s: 'break', _slices: 4, unit: 'c', speed: 1 },
|
||||
),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { listen } from '@tauri-apps/api/event';
|
||||
import { logger } from '../core/logger.mjs';
|
||||
import { logger } from '@strudel/core';
|
||||
|
||||
// listen for log events from the Tauri backend and log in the UI
|
||||
await listen('log-event', (e) => {
|
||||
|
||||
@@ -21,7 +21,8 @@ let D;
|
||||
*
|
||||
* @name initDough
|
||||
* @tags external_io
|
||||
* @memberof Pattern
|
||||
* @memberof Pattern.prototype
|
||||
* @returns {Promise<void>}
|
||||
* @example
|
||||
* await initDough()
|
||||
* $: chord("<Dm9 Dm11 Dm7>").offset("<-1 0 1 0>").voicing()
|
||||
@@ -51,12 +52,12 @@ export async function doughOutput(hap, targetTime, cps = 1) {
|
||||
|
||||
/**
|
||||
*
|
||||
* Uses dough as the audio engine. more info at https://dough.strudel.cc
|
||||
* Uses dough as the audio engine. more info [here](https://dough.strudel.cc)
|
||||
*
|
||||
* @name dough
|
||||
* @tags external_io
|
||||
* @memberof Pattern
|
||||
* @returns Pattern
|
||||
* @memberof Pattern.prototype
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* $: chord("<Dm9 Dm11 Dm7>").offset("<-1 0 1 0>").voicing()
|
||||
* .phaser(3).fm(1.4).fmh(1.01)
|
||||
|
||||
@@ -4,3 +4,4 @@ export * from './draw.mjs';
|
||||
export * from './pianoroll.mjs';
|
||||
export * from './spiral.mjs';
|
||||
export * from './pitchwheel.mjs';
|
||||
export * from './print.mjs';
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
"url": "git+https://codeberg.org/uzu/strudel.git"
|
||||
},
|
||||
"keywords": [
|
||||
"titdalcycles",
|
||||
"tidalcycles",
|
||||
"strudel",
|
||||
"pattern",
|
||||
"livecoding",
|
||||
|
||||
+32
-25
@@ -43,31 +43,31 @@ const getValue = (e) => {
|
||||
* @name pianoroll
|
||||
* @synonyms punchcard
|
||||
* @tags visualization
|
||||
* @param {Object} options Object containing all the optional following parameters as key value pairs:
|
||||
* @param {integer} cycles number of cycles to be displayed at the same time - defaults to 4
|
||||
* @param {number} playhead location of the active notes on the time axis - 0 to 1, defaults to 0.5
|
||||
* @param {boolean} vertical displays the roll vertically - 0 by default
|
||||
* @param {boolean} labels displays labels on individual notes (see the label function) - 0 by default
|
||||
* @param {boolean} flipTime reverse the direction of the roll - 0 by default
|
||||
* @param {boolean} flipValues reverse the relative location of notes on the value axis - 0 by default
|
||||
* @param {number} overscan lookup X cycles outside of the cycles window to display notes in advance - 1 by default
|
||||
* @param {boolean} hideNegative hide notes with negative time (before starting playing the pattern) - 0 by default
|
||||
* @param {boolean} smear notes leave a solid trace - 0 by default
|
||||
* @param {boolean} fold notes takes the full value axis width - 0 by default
|
||||
* @param {string} active hexadecimal or CSS color of the active notes - defaults to #FFCA28
|
||||
* @param {string} inactive hexadecimal or CSS color of the inactive notes - defaults to #7491D2
|
||||
* @param {string} background hexadecimal or CSS color of the background - defaults to transparent
|
||||
* @param {string} playheadColor hexadecimal or CSS color of the line representing the play head - defaults to white
|
||||
* @param {boolean} fill notes are filled with color (otherwise only the label is displayed) - 0 by default
|
||||
* @param {boolean} fillActive active notes are filled with color - 0 by default
|
||||
* @param {boolean} stroke notes are shown with colored borders - 0 by default
|
||||
* @param {boolean} strokeActive active notes are shown with colored borders - 0 by default
|
||||
* @param {boolean} hideInactive only active notes are shown - 0 by default
|
||||
* @param {boolean} colorizeInactive use note color for inactive notes - 1 by default
|
||||
* @param {string} fontFamily define the font used by notes labels - defaults to 'monospace'
|
||||
* @param {integer} minMidi minimum note value to display on the value axis - defaults to 10
|
||||
* @param {integer} maxMidi maximum note value to display on the value axis - defaults to 90
|
||||
* @param {boolean} autorange automatically calculate the minMidi and maxMidi parameters - 0 by default
|
||||
* @param {object} [options] Object containing all the optional following parameters as key value pairs:
|
||||
* @param {number} [options.cycles=4] number of cycles to be displayed at the same time - defaults to 4
|
||||
* @param {number} [options.playhead=0.5] location of the active notes on the time axis - 0 to 1, defaults to 0.5
|
||||
* @param {boolean} [options.vertical=0] displays the roll vertically - 0 by default
|
||||
* @param {boolean} [options.labels=0] displays labels on individual notes (see the label function) - 0 by default
|
||||
* @param {boolean} [options.flipTime=0] reverse the direction of the roll - 0 by default
|
||||
* @param {boolean} [options.flipValues=0] reverse the relative location of notes on the value axis - 0 by default
|
||||
* @param {number} [options.overscan=1] lookup X cycles outside of the cycles window to display notes in advance - 1 by default
|
||||
* @param {boolean} [options.hideNegative=0] hide notes with negative time (before starting playing the pattern) - 0 by default
|
||||
* @param {boolean} [options.smear=0] notes leave a solid trace - 0 by default
|
||||
* @param {boolean} [options.fold=0] notes takes the full value axis width - 0 by default
|
||||
* @param {string} [options.active=#FFCA28] hexadecimal or CSS color of the active notes - defaults to #FFCA28
|
||||
* @param {string} [options.inactive='#7491D2'] hexadecimal or CSS color of the inactive notes - defaults to #7491D2
|
||||
* @param {string} [options.background='transparent'] hexadecimal or CSS color of the background - defaults to transparent
|
||||
* @param {string} [options.playheadColor='white'] hexadecimal or CSS color of the line representing the play head - defaults to white
|
||||
* @param {boolean} [options.fill=0] notes are filled with color (otherwise only the label is displayed) - 0 by default
|
||||
* @param {boolean} [options.fillActive=0] active notes are filled with color - 0 by default
|
||||
* @param {boolean} [options.stroke=0] notes are shown with colored borders - 0 by default
|
||||
* @param {boolean} [options.strokeActive=0] active notes are shown with colored borders - 0 by default
|
||||
* @param {boolean} [options.hideInactive=0] only active notes are shown - 0 by default
|
||||
* @param {boolean} [options.colorizeInactive=1] use note color for inactive notes - 1 by default
|
||||
* @param {string} [options.fontFamily='monospace'] define the font used by notes labels - defaults to 'monospace'
|
||||
* @param {number} [options.minMidi=10] minimum note value to display on the value axis - defaults to 10
|
||||
* @param {number} [options.maxMidi=90] maximum note value to display on the value axis - defaults to 90
|
||||
* @param {boolean} [options.autorange=0] automatically calculate the minMidi and maxMidi parameters - 0 by default
|
||||
* @see _pianoroll
|
||||
* @example
|
||||
* note("c2 a2 eb2")
|
||||
@@ -299,8 +299,15 @@ Pattern.prototype.punchcard = function (options) {
|
||||
* Displays a vertical pianoroll with event labels.
|
||||
* Supports all the same options as pianoroll.
|
||||
*
|
||||
* @param {object} options
|
||||
* @param {number} options.vertical
|
||||
* @param {number} options.labels
|
||||
* @param {number} options.stroke
|
||||
* @param {number} options.fillActive
|
||||
* @param {string} options.active
|
||||
* @name wordfall
|
||||
* @tags visualization
|
||||
* @returns {Pattern}
|
||||
*/
|
||||
Pattern.prototype.wordfall = function (options) {
|
||||
return this.punchcard({ vertical: 1, labels: 1, stroke: 0, fillActive: 1, active: 'white', ...options });
|
||||
|
||||
@@ -148,14 +148,16 @@ export function pitchwheel({
|
||||
* Renders a pitch circle to visualize frequencies within one octave
|
||||
* @name pitchwheel
|
||||
* @tags visualization
|
||||
* @param {number} hapcircles
|
||||
* @param {number} circle
|
||||
* @param {number} edo
|
||||
* @param {string} root
|
||||
* @param {number} thickness
|
||||
* @param {number} hapRadius
|
||||
* @param {string} mode
|
||||
* @param {number} margin
|
||||
* @param {object} options
|
||||
* @param {number} options.hapcircles
|
||||
* @param {number} options.circle
|
||||
* @param {number} options.edo
|
||||
* @param {string} options.root
|
||||
* @param {number} options.thickness
|
||||
* @param {number} options.hapRadius
|
||||
* @param {string} options.mode
|
||||
* @param {number} options.margin
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* n("0 .. 12").scale("C:chromatic")
|
||||
* .s("sawtooth")
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
print.mjs - prints hap values to the console or a scrollable inline widget
|
||||
Copyright (C) 2022 Strudel contributors - see
|
||||
<https://codeberg.org/uzu/strudel/src/branch/main/packages/draw/print.mjs> This
|
||||
program is free software: you can redistribute it and/or modify it under the
|
||||
terms of the GNU Affero General Public License as published by the Free Software
|
||||
Foundation, either version 3 of the License, or (at your option) any later
|
||||
version. This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
|
||||
more details. You should have received a copy of the GNU Affero General Public
|
||||
License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { logger, Pattern, stringifyValues } from '@strudel/core';
|
||||
|
||||
const printed = {};
|
||||
|
||||
// counts .print() calls within one synchronous evaluation, then resets for the
|
||||
// next
|
||||
let printIndex = 0;
|
||||
let printIndexResetQueued = false;
|
||||
function nextPrintIndex() {
|
||||
const index = printIndex++;
|
||||
if (!printIndexResetQueued) {
|
||||
printIndexResetQueued = true;
|
||||
queueMicrotask(() => {
|
||||
printIndex = 0;
|
||||
printIndexResetQueued = false;
|
||||
});
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
function formatTime(hap, round, padding) {
|
||||
const begin = hap.wholeOrPart().begin;
|
||||
if (round === 0) {
|
||||
return String(begin.sam().valueOf()).padEnd(padding);
|
||||
}
|
||||
const factor = 10 ** round;
|
||||
const time = Math.round(begin.valueOf() * factor) / factor;
|
||||
return String(time).padEnd(padding + round + 1);
|
||||
}
|
||||
|
||||
function appendLine(el, text, maxLines) {
|
||||
const line = document.createElement('div');
|
||||
line.textContent = text;
|
||||
el.appendChild(line);
|
||||
while (el.childElementCount > maxLines) {
|
||||
el.removeChild(el.firstChild);
|
||||
}
|
||||
if (el.follow) {
|
||||
el.scrollTop = el.scrollHeight;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints the values of a pattern's events. Without a leading underscore, prints
|
||||
* to the existing console panel, labeled with its position among other
|
||||
* `print()` calls, e.g. `[print(line:1)]`. With the `_` prefix, it shows a
|
||||
* scrollable widget inside the code instead, and its content resets on
|
||||
* every (re-)evaluation.
|
||||
*
|
||||
* @name print
|
||||
* @tags visualization
|
||||
* @param {object} options object that may have the following arguments
|
||||
* @param {number} options.width widget width in px, `_print` only. defaults to 600
|
||||
* @param {number} options.height widget height in px, `_print` only. defaults to 100
|
||||
* @param {number} options.maxLines max lines kept, `_print` only. defaults to 500
|
||||
* @param {number} options.round decimal digits for the event time. defaults to 4. `0`
|
||||
* shows only the cycle
|
||||
* @param {number} options.padding integer digits reserved for the cycle, so it stays
|
||||
* aligned once cycles reach 10 or 100. defaults to 3
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* s("bd sd hh cp").print()
|
||||
* @example
|
||||
* s("bd sd hh*2 cp")._print({ round: 5 })
|
||||
*/
|
||||
Pattern.prototype.print = function (options = {}) {
|
||||
const { el, id = 1, maxLines = 500, round = 4, padding = 3 } = options;
|
||||
if (!el) {
|
||||
const label = `print(line:${nextPrintIndex() + 1})`;
|
||||
return this.onTrigger((hap) => {
|
||||
logger(`[${label}] ${formatTime(hap, round, padding)}: ${stringifyValues(hap.value, true)}`);
|
||||
}, false);
|
||||
}
|
||||
printed[id] = new WeakSet();
|
||||
return this.draw(
|
||||
(haps) => {
|
||||
haps
|
||||
.filter((hap) => !printed[id].has(hap))
|
||||
.forEach((hap) => {
|
||||
printed[id].add(hap);
|
||||
appendLine(el, `${formatTime(hap, round, padding)}: ${stringifyValues(hap.value, true)}`, maxLines);
|
||||
});
|
||||
},
|
||||
{ lookbehind: 0, lookahead: 0, id },
|
||||
);
|
||||
};
|
||||
+17
-16
@@ -130,22 +130,23 @@ function drawSpiral(options) {
|
||||
*
|
||||
* @name spiral
|
||||
* @tags visualization
|
||||
* @param {Object} options Object containing all the optional following parameters as key value pairs:
|
||||
* @param {number} stretch controls the rotations per cycle ratio, where 1 = 1 cycle / 360 degrees
|
||||
* @param {number} size the diameter of the spiral
|
||||
* @param {number} thickness line thickness
|
||||
* @param {string} cap style of line ends: butt (default), round, square
|
||||
* @param {string} inset number of rotations before spiral starts (default 3)
|
||||
* @param {string} playheadColor color of playhead, defaults to white
|
||||
* @param {number} playheadLength length of playhead in rotations, defaults to 0.02
|
||||
* @param {number} playheadThickness thickness of playheadrotations, defaults to thickness
|
||||
* @param {number} padding space around spiral
|
||||
* @param {number} steady steadyness of spiral vs playhead. 1 = spiral doesn't move, playhead does.
|
||||
* @param {number} activeColor color of active segment. defaults to foreground of theme
|
||||
* @param {number} inactiveColor color of inactive segments. defaults to gutterForeground of theme
|
||||
* @param {boolean} colorizeInactive wether or not to colorize inactive segments, defaults to 0
|
||||
* @param {boolean} fade wether or not past and future should fade out. defaults to 1
|
||||
* @param {boolean} logSpiral wether or not the spiral should be logarithmic. defaults to 0
|
||||
* @param {object} options Object containing all the optional following parameters as key value pairs:
|
||||
* @param {number} options.stretch controls the rotations per cycle ratio, where 1 = 1 cycle / 360 degrees
|
||||
* @param {number} options.size the diameter of the spiral
|
||||
* @param {number} options.thickness line thickness
|
||||
* @param {string} options.cap style of line ends: butt (default), round, square
|
||||
* @param {string} options.inset number of rotations before spiral starts (default 3)
|
||||
* @param {string} options.playheadColor color of playhead, defaults to white
|
||||
* @param {number} options.playheadLength length of playhead in rotations, defaults to 0.02
|
||||
* @param {number} options.playheadThickness thickness of playheadrotations, defaults to thickness
|
||||
* @param {number} options.padding space around spiral
|
||||
* @param {number} options.steady steadyness of spiral vs playhead. 1 = spiral doesn't move, playhead does.
|
||||
* @param {number} options.activeColor color of active segment. defaults to foreground of theme
|
||||
* @param {number} options.inactiveColor color of inactive segments. defaults to gutterForeground of theme
|
||||
* @param {boolean} options.colorizeInactive wether or not to colorize inactive segments, defaults to 0
|
||||
* @param {boolean} options.fade wether or not past and future should fade out. defaults to 1
|
||||
* @param {boolean} options.logSpiral wether or not the spiral should be logarithmic. defaults to 0
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* note("c2 a2 eb2")
|
||||
* .euclid(5,8)
|
||||
|
||||
@@ -38,7 +38,7 @@ const pitchesCache = new Map();
|
||||
*
|
||||
* @name edoScale
|
||||
* @param {string} scale Definition of EDO scale.
|
||||
* @returns Pattern
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* n("0 2 4 6 4 2").edoScale("C:LLsLLLs:2:1")
|
||||
* @example
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
"url": "git+https://codeberg.org/uzu/strudel.git"
|
||||
},
|
||||
"keywords": [
|
||||
"titdalcycles",
|
||||
"tidalcycles",
|
||||
"strudel",
|
||||
"pattern",
|
||||
"livecoding",
|
||||
|
||||
@@ -15,7 +15,7 @@ import { getDevice } from './util.mjs';
|
||||
*/
|
||||
export class MidiInput {
|
||||
/**
|
||||
*
|
||||
* Constructs a new Midi input device
|
||||
* @param {string | number} input MIDI device name or index defaulting to 0
|
||||
*/
|
||||
constructor(input) {
|
||||
@@ -34,6 +34,7 @@ export class MidiInput {
|
||||
* Implementation for the cc() factory function tied to this specific input.
|
||||
* @param {number} cc MIDI CC number
|
||||
* @param {number | undefined} chan MIDI channel (1-16) or undefined for all channels
|
||||
* @returns {Pattern}
|
||||
*/
|
||||
createCC(cc, chan) {
|
||||
const lookupMap = chan === undefined ? this._refs : this._refsByChan[chan];
|
||||
|
||||
@@ -113,6 +113,7 @@ function githubPath(base, subpath = '') {
|
||||
|
||||
/**
|
||||
* configures the default midimap, which is used when no "midimap" port is set
|
||||
* @param {*} mapping
|
||||
* @tags external_io, midi
|
||||
* @example
|
||||
* defaultmidimap({ lpf: 74 })
|
||||
@@ -127,6 +128,7 @@ let loadCache = {};
|
||||
|
||||
/**
|
||||
* Adds midimaps to the registry. Inside each midimap, control names (e.g. lpf) are mapped to cc numbers.
|
||||
* @param {string | object} map
|
||||
* @tags external_io, midi
|
||||
* @example
|
||||
* midimaps({ mymap: { lpf: 74 } })
|
||||
@@ -290,6 +292,12 @@ function sendNote(note, velocity, duration, device, midichan, timeMs) {
|
||||
* @tags external_io
|
||||
* @param {string | number} midiport MIDI device name or index defaulting to 0
|
||||
* @param {object} options Additional MIDI configuration options
|
||||
* @param {boolean} options.isController sending notes for midi controllers. Default is false
|
||||
* @param {number} options.noteOffsetMs note-off offset to prevent glitching in ms. Default is 10 or firefox and 1 otherwise
|
||||
* @param {number} options.midichannel default is 1
|
||||
* @param {number} options.velocity default is 0.9
|
||||
* @param {number} options.gain default is 1
|
||||
* @param {string} options.midimap default is 'default'
|
||||
* @example
|
||||
* note("c4").midichan(1).midi('IAC Driver Bus 1')
|
||||
*/
|
||||
@@ -476,6 +484,8 @@ Pattern.prototype.midi = function (midiport, options = {}) {
|
||||
|
||||
/**
|
||||
* Initialize a midi input device
|
||||
* @param {string} input
|
||||
* @returns {MidiInput}
|
||||
*/
|
||||
async function _initializeInput(input) {
|
||||
if (isPattern(input)) {
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
"url": "git+https://codeberg.org/uzu/strudel.git"
|
||||
},
|
||||
"keywords": [
|
||||
"titdalcycles",
|
||||
"tidalcycles",
|
||||
"strudel",
|
||||
"pattern",
|
||||
"livecoding",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, bench } from 'vitest';
|
||||
|
||||
import { calculateSteps } from '../../core/index.mjs';
|
||||
import { calculateSteps } from '@strudel/pattern';
|
||||
import { mini } from '../index.mjs';
|
||||
|
||||
describe('mini', () => {
|
||||
|
||||
@@ -5,8 +5,8 @@ This program is free software: you can redistribute it and/or modify it under th
|
||||
*/
|
||||
|
||||
import * as krill from './krill-parser.js';
|
||||
import * as strudel from '@strudel/core';
|
||||
import Fraction, { lcm } from '@strudel/core/fraction.mjs';
|
||||
import * as strudel from '@strudel/pattern';
|
||||
import { Fraction, lcm } from '@strudel/pattern';
|
||||
|
||||
const randOffset = 0.0003;
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
},
|
||||
"homepage": "https://codeberg.org/uzu/strudel#readme",
|
||||
"dependencies": {
|
||||
"@strudel/core": "workspace:*"
|
||||
"@strudel/pattern": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"peggy": "^4.2.0",
|
||||
|
||||
@@ -5,8 +5,8 @@ This program is free software: you can redistribute it and/or modify it under th
|
||||
*/
|
||||
|
||||
import { getLeafLocation, getLeafLocations, mini, mini2ast } from '../mini.mjs';
|
||||
import '@strudel/core/euclid.mjs';
|
||||
import { Fraction } from '@strudel/core/index.mjs';
|
||||
import '@strudel/pattern';
|
||||
import { Fraction } from '@strudel/pattern';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
describe('mini', () => {
|
||||
|
||||
+16
-16
@@ -1,11 +1,11 @@
|
||||
// motion.mjs
|
||||
|
||||
import { signal } from '../core/signal.mjs';
|
||||
import { signal } from '@strudel/core';
|
||||
|
||||
/**
|
||||
* The accelerometer's x-axis value ranges from 0 to 1.
|
||||
* @name accelerationX
|
||||
* @return {Pattern}
|
||||
* @returns {Pattern}
|
||||
* @synonyms accX
|
||||
* @tags external_io
|
||||
* @example
|
||||
@@ -16,7 +16,7 @@ import { signal } from '../core/signal.mjs';
|
||||
/**
|
||||
* The accelerometer's y-axis value ranges from 0 to 1.
|
||||
* @name accelerationY
|
||||
* @return {Pattern}
|
||||
* @returns {Pattern}
|
||||
* @synonyms accY
|
||||
* @tags external_io
|
||||
* @example
|
||||
@@ -27,7 +27,7 @@ import { signal } from '../core/signal.mjs';
|
||||
/**
|
||||
* The accelerometer's z-axis value ranges from 0 to 1.
|
||||
* @name accelerationZ
|
||||
* @return {Pattern}
|
||||
* @returns {Pattern}
|
||||
* @synonyms accZ
|
||||
* @tags external_io
|
||||
* @example
|
||||
@@ -38,7 +38,7 @@ import { signal } from '../core/signal.mjs';
|
||||
/**
|
||||
* The device's gravity x-axis value ranges from 0 to 1.
|
||||
* @name gravityX
|
||||
* @return {Pattern}
|
||||
* @returns {Pattern}
|
||||
* @synonyms gravX
|
||||
* @tags external_io
|
||||
* @example
|
||||
@@ -49,7 +49,7 @@ import { signal } from '../core/signal.mjs';
|
||||
/**
|
||||
* The device's gravity y-axis value ranges from 0 to 1.
|
||||
* @name gravityY
|
||||
* @return {Pattern}
|
||||
* @returns {Pattern}
|
||||
* @synonyms gravY
|
||||
* @tags external_io
|
||||
* @example
|
||||
@@ -60,7 +60,7 @@ import { signal } from '../core/signal.mjs';
|
||||
/**
|
||||
* The device's gravity z-axis value ranges from 0 to 1.
|
||||
* @name gravityZ
|
||||
* @return {Pattern}
|
||||
* @returns {Pattern}
|
||||
* @synonyms gravZ
|
||||
* @tags external_io
|
||||
* @example
|
||||
@@ -71,7 +71,7 @@ import { signal } from '../core/signal.mjs';
|
||||
/**
|
||||
* The device's rotation around the alpha-axis value ranges from 0 to 1.
|
||||
* @name rotationAlpha
|
||||
* @return {Pattern}
|
||||
* @returns {Pattern}
|
||||
* @synonyms rotA, rotZ, rotationZ
|
||||
* @tags external_io
|
||||
* @example
|
||||
@@ -82,7 +82,7 @@ import { signal } from '../core/signal.mjs';
|
||||
/**
|
||||
* The device's rotation around the beta-axis value ranges from 0 to 1.
|
||||
* @name rotationBeta
|
||||
* @return {Pattern}
|
||||
* @returns {Pattern}
|
||||
* @synonyms rotB, rotX, rotationX
|
||||
* @tags external_io
|
||||
* @example
|
||||
@@ -93,7 +93,7 @@ import { signal } from '../core/signal.mjs';
|
||||
/**
|
||||
* The device's rotation around the gamma-axis value ranges from 0 to 1.
|
||||
* @name rotationGamma
|
||||
* @return {Pattern}
|
||||
* @returns {Pattern}
|
||||
* @synonyms rotG, rotY, rotationY
|
||||
* @tags external_io
|
||||
* @example
|
||||
@@ -104,7 +104,7 @@ import { signal } from '../core/signal.mjs';
|
||||
/**
|
||||
* The device's orientation alpha value ranges from 0 to 1.
|
||||
* @name orientationAlpha
|
||||
* @return {Pattern}
|
||||
* @returns {Pattern}
|
||||
* @synonyms oriA, oriZ, orientationZ
|
||||
* @tags external_io
|
||||
* @example
|
||||
@@ -115,7 +115,7 @@ import { signal } from '../core/signal.mjs';
|
||||
/**
|
||||
* The device's orientation beta value ranges from 0 to 1.
|
||||
* @name orientationBeta
|
||||
* @return {Pattern}
|
||||
* @returns {Pattern}
|
||||
* @synonyms oriB, oriX, orientationX
|
||||
* @tags external_io
|
||||
* @example
|
||||
@@ -126,7 +126,7 @@ import { signal } from '../core/signal.mjs';
|
||||
/**
|
||||
* The device's orientation gamma value ranges from 0 to 1.
|
||||
* @name orientationGamma
|
||||
* @return {Pattern}
|
||||
* @returns {Pattern}
|
||||
* @synonyms oriG, oriY, orientationY
|
||||
* @tags external_io
|
||||
* @example
|
||||
@@ -137,7 +137,7 @@ import { signal } from '../core/signal.mjs';
|
||||
/**
|
||||
* The device's absolute orientation alpha value ranges from 0 to 1.
|
||||
* @name absoluteOrientationAlpha
|
||||
* @return {Pattern}
|
||||
* @returns {Pattern}
|
||||
* @synonyms absOriA, absOriZ, absoluteOrientationZ
|
||||
* @tags external_io
|
||||
* @example
|
||||
@@ -148,7 +148,7 @@ import { signal } from '../core/signal.mjs';
|
||||
/**
|
||||
* The device's absolute orientation beta value ranges from 0 to 1.
|
||||
* @name absoluteOrientationBeta
|
||||
* @return {Pattern}
|
||||
* @returns {Pattern}
|
||||
* @synonyms absOriB, absOriX, absoluteOrientationX
|
||||
* @tags external_io
|
||||
* @example
|
||||
@@ -159,7 +159,7 @@ import { signal } from '../core/signal.mjs';
|
||||
/**
|
||||
* The device's absolute orientation gamma value ranges from 0 to 1.
|
||||
* @name absoluteOrientationGamma
|
||||
* @return {Pattern}
|
||||
* @returns {Pattern}
|
||||
* @synonyms absOriG, absOriY, absoluteOrientationY
|
||||
* @tags external_io
|
||||
* @example
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
"url": "git+https://codeberg.org/uzu/strudel.git"
|
||||
},
|
||||
"keywords": [
|
||||
"titdalcycles",
|
||||
"tidalcycles",
|
||||
"strudel",
|
||||
"pattern",
|
||||
"livecoding",
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
"url": "git+https://codeberg.org/uzu/strudel.git"
|
||||
},
|
||||
"keywords": [
|
||||
"titdalcycles",
|
||||
"tidalcycles",
|
||||
"strudel",
|
||||
"pattern",
|
||||
"livecoding",
|
||||
|
||||
+66
-7
@@ -52,13 +52,13 @@ export function parseControlsFromHap(hap, cps) {
|
||||
controls.unit === 'c' && controls.speed != null && (controls.speed = controls.speed / cps);
|
||||
const channels = controls.channels;
|
||||
channels != undefined && (controls.channels = JSON.stringify(channels));
|
||||
|
||||
return controls;
|
||||
}
|
||||
|
||||
let timeOrigin = performance.timeOrigin;
|
||||
export async function oscOutput(hap, targetTime, cps = 1) {
|
||||
const ws = await connect();
|
||||
|
||||
function getOscTimestamp(targetTime) {
|
||||
const timeMs = getClockBridge().getPerformanceTime(targetTime);
|
||||
if (!timeMs) {
|
||||
logger('[osc] clockbridge not ready');
|
||||
@@ -72,21 +72,76 @@ export async function oscOutput(hap, targetTime, cps = 1) {
|
||||
// shift time after microsleep
|
||||
timeOrigin -= deprivation;
|
||||
}
|
||||
const ts = timeOrigin + timeMs;
|
||||
return timeOrigin + timeMs;
|
||||
}
|
||||
|
||||
export async function oscOutput(hap, targetTime, cps = 1) {
|
||||
const ws = await connect();
|
||||
const ts = getOscTimestamp(targetTime);
|
||||
if (!ts) {
|
||||
return;
|
||||
}
|
||||
|
||||
const controls = parseControlsFromHap(hap, cps);
|
||||
const keyvals = Object.entries(controls).flat();
|
||||
const msg = { address: '/dirt/play', args: keyvals, timestamp: ts };
|
||||
|
||||
if ('oschost' in hap.value) {
|
||||
msg['host'] = hap.value['oschost'];
|
||||
msg.oschost = hap.value.oschost;
|
||||
}
|
||||
if ('oscport' in hap.value) {
|
||||
msg['port'] = hap.value['oscport'];
|
||||
msg.oscport = hap.value.oscport;
|
||||
}
|
||||
|
||||
ws.send(JSON.stringify(msg));
|
||||
}
|
||||
|
||||
export async function superdirtOutput(hap, targetTime, cps = 1) {
|
||||
const ws = await connect();
|
||||
const ts = getOscTimestamp(targetTime);
|
||||
if (!ts) {
|
||||
return;
|
||||
}
|
||||
|
||||
const controls = parseControlsFromHap(hap, cps);
|
||||
|
||||
const oschost = hap.value.oschost ?? '127.0.0.1';
|
||||
const oscport = hap.value.oscport ?? 57120;
|
||||
const bushost = oschost;
|
||||
const busport = 57110;
|
||||
|
||||
// send SuperDirt bus/control messages first
|
||||
for (const [key, busIdVal] of Object.entries(controls)) {
|
||||
if (key.startsWith('^')) {
|
||||
ws.send(
|
||||
JSON.stringify({
|
||||
oschost: bushost,
|
||||
oscport: busport,
|
||||
address: '/c_set',
|
||||
args: busIdVal,
|
||||
timestamp: ts,
|
||||
}),
|
||||
);
|
||||
// so they aren't sent with trigger messages
|
||||
delete controls[key];
|
||||
}
|
||||
}
|
||||
|
||||
// only trigger samples on haps that actually begin here
|
||||
if (hap.hasOnset()) {
|
||||
const keyvals = Object.entries(controls).flat();
|
||||
ws.send(
|
||||
JSON.stringify({
|
||||
oschost,
|
||||
oscport,
|
||||
address: '/dirt/play',
|
||||
args: keyvals,
|
||||
timestamp: ts,
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Sends each hap as an OSC message, which can be picked up by SuperCollider or any other OSC-enabled software.
|
||||
@@ -94,10 +149,14 @@ export async function oscOutput(hap, targetTime, cps = 1) {
|
||||
*
|
||||
* @name osc
|
||||
* @tags external_io
|
||||
* @memberof Pattern
|
||||
* @returns Pattern
|
||||
* @memberof Pattern.prototype
|
||||
* @returns {Pattern}
|
||||
*/
|
||||
export const osc = register('osc', (pat) => {
|
||||
ensureMinimalOutput();
|
||||
return pat.onSchedule(oscOutput);
|
||||
});
|
||||
export const superdirt = register('superdirt', (pat) => {
|
||||
ensureMinimalOutput();
|
||||
return pat._processParts().onSchedule(superdirtOutput);
|
||||
});
|
||||
|
||||
+9
-13
@@ -12,18 +12,13 @@ import { WebSocketServer } from 'ws';
|
||||
import osc from 'osc';
|
||||
|
||||
const WS_PORT = 8080; // WebSocket server port
|
||||
const OSC_REMOTE_IP = '127.0.0.1';
|
||||
const OSC_REMOTE_PORT = 57120;
|
||||
|
||||
const udpPort = new osc.UDPPort({
|
||||
localAddress: '0.0.0.0',
|
||||
localPort: 0,
|
||||
remoteAddress: OSC_REMOTE_IP,
|
||||
remotePort: OSC_REMOTE_PORT,
|
||||
});
|
||||
|
||||
udpPort.open();
|
||||
console.log(`[Sending OSC] ${OSC_REMOTE_IP}:${OSC_REMOTE_PORT}`);
|
||||
|
||||
udpPort.on('error', (e) => {
|
||||
console.log('Error: ', e);
|
||||
@@ -36,23 +31,24 @@ wss.on('connection', (ws) => {
|
||||
console.log('New WebSocket connection');
|
||||
|
||||
ws.on('message', (message) => {
|
||||
let osc_host = '127.0.0.1';
|
||||
let osc_port = 57120;
|
||||
let oschost = '127.0.0.1';
|
||||
let oscport = 57120;
|
||||
|
||||
try {
|
||||
const data = JSON.parse(message);
|
||||
if ('host' in data) {
|
||||
osc_host = data['host'];
|
||||
if ('oschost' in data) {
|
||||
oschost = data['oschost'];
|
||||
delete data['oschost'];
|
||||
}
|
||||
if ('port' in data) {
|
||||
osc_port = data['port'];
|
||||
if ('oscport' in data) {
|
||||
oscport = data['oscport'];
|
||||
delete data['oscport'];
|
||||
}
|
||||
let msg = { address: data['address'], args: data['args'] };
|
||||
if ('timestamp' in data) {
|
||||
msg = { timeTag: osc.timeTag(0, data['timestamp']), packets: [msg] };
|
||||
}
|
||||
|
||||
udpPort.send(msg, osc_host, osc_port);
|
||||
udpPort.send(msg, oschost, oscport);
|
||||
} catch (err) {
|
||||
console.error('Error parsing message:', err);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/* import { tauriOscOutput } from '../desktopbridge/oscbridge.mjs';
|
||||
import { isTauri } from '../desktopbridge/utils.mjs'; */
|
||||
import { oscOutput } from './osc.mjs';
|
||||
// const output = /* isTauri() ? tauriOscOutput : */ oscOutput;
|
||||
|
||||
const output = /* isTauri() ? tauriOscOutput : */ oscOutput;
|
||||
|
||||
export const superdirtOutput = (hap, targetTime, cps) => output(hap, targetTime, cps);
|
||||
export { superdirtOutput } from './osc.mjs';
|
||||
|
||||
@@ -16,9 +16,9 @@ import Fraction, { gcd } from './fraction.mjs';
|
||||
* - "." silence
|
||||
*
|
||||
* @tags visualization
|
||||
* @param {Pattern} pattern the pattern to use
|
||||
* @param {Pattern} pat the pattern to use
|
||||
* @param {number} chars max number of characters (approximately)
|
||||
* @returns string
|
||||
* @returns {string}
|
||||
* @example
|
||||
* const line = drawLine("0 [1 2 3]", 10); // |0--123|0--123
|
||||
* console.log(line);
|
||||
@@ -64,12 +64,12 @@ export const bjorklund = function (ons, steps) {
|
||||
*
|
||||
* A negative number of steps changes it into `euclidLegato`.
|
||||
*
|
||||
* @memberof Pattern
|
||||
* @memberof Pattern.prototype
|
||||
* @name euclid
|
||||
* @tags temporal
|
||||
* @param {number} pulses the number of onsets/beats
|
||||
* @param {number} steps the number of steps to fill
|
||||
* @returns Pattern
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* // The Cuban tresillo pattern.
|
||||
* note("c3").euclid(3,8)
|
||||
@@ -77,13 +77,13 @@ export const bjorklund = function (ons, steps) {
|
||||
|
||||
/**
|
||||
* Like `euclid`, but has an additional parameter for 'rotating' the resulting sequence.
|
||||
* @memberof Pattern
|
||||
* @memberof Pattern.prototype
|
||||
* @name euclidRot
|
||||
* @tags temporal
|
||||
* @param {number} pulses the number of onsets/beats
|
||||
* @param {number} steps the number of steps to fill
|
||||
* @param {number} rotation offset in steps
|
||||
* @returns Pattern
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* // A Samba rhythm necklace from Brazil
|
||||
* note("c3").euclidRot(3,16,14)
|
||||
@@ -194,7 +194,7 @@ export const { euclidrot, euclidRot } = register(['euclidrot', 'euclidRot'], fun
|
||||
*
|
||||
* A negative number of steps changes it into `euclid`.
|
||||
* @name euclidLegato
|
||||
* @memberof Pattern
|
||||
* @memberof Pattern.prototype
|
||||
* @tags temporal
|
||||
* @param {number} pulses the number of onsets/beats
|
||||
* @param {number} steps the number of steps to fill
|
||||
@@ -215,7 +215,7 @@ export const euclidLegato = register(['euclidLegato'], function (pulses, steps,
|
||||
*
|
||||
* A negative number of steps changes it into `euclidRot`.
|
||||
* @name euclidLegatoRot
|
||||
* @memberof Pattern
|
||||
* @memberof Pattern.prototype
|
||||
* @tags temporal
|
||||
* @param {number} pulses the number of onsets/beats
|
||||
* @param {number} steps the number of steps to fill
|
||||
@@ -237,7 +237,7 @@ export const euclidLegatoRot = register(['euclidLegatoRot'], function (pulses, s
|
||||
* Inspired by the work of Malcom Braff.
|
||||
* @name euclidish
|
||||
* @synonyms eish
|
||||
* @memberof Pattern
|
||||
* @memberof Pattern.prototype
|
||||
* @tags temporal
|
||||
* @param {number} pulses the number of onsets
|
||||
* @param {number} steps the number of steps to fill
|
||||
@@ -16,7 +16,7 @@ export class Hap {
|
||||
then the whole will be returned as None, in which case the given
|
||||
value will have been sampled from the point halfway between the
|
||||
start and end of the 'part' timespan.
|
||||
The context is to store a list of source code locations causing the event.
|
||||
The context is to store metadata, including a list of source code locations causing the event.
|
||||
|
||||
The word 'Event' is more or less a reserved word in javascript, hence this
|
||||
class is named called 'Hap'.
|
||||
@@ -161,6 +161,10 @@ export class Hap {
|
||||
return new Hap(this.whole, this.part, this.value, context);
|
||||
}
|
||||
|
||||
withContext(f) {
|
||||
return new Hap(this.whole, this.part, this.value, f(this.context));
|
||||
}
|
||||
|
||||
ensureObjectValue() {
|
||||
/* if (isNote(hap.value)) {
|
||||
// supports primitive hap values that look like notes
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
index.mjs - <short description TODO>
|
||||
Copyright (C) 2025 Strudel contributors - see <https://codeberg.org/uzu/strudel/src/branch/main/packages/core/index.mjs>
|
||||
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
export * from './euclid.mjs';
|
||||
import Fraction, { lcm } from './fraction.mjs';
|
||||
import { logger } from './logger.mjs';
|
||||
export { Fraction, lcm };
|
||||
export * from './hap.mjs';
|
||||
export * from './impure.mjs';
|
||||
export * from './logger.mjs';
|
||||
export * from './pattern.mjs';
|
||||
export * from './pick.mjs';
|
||||
export * from './signal.mjs';
|
||||
export * from './state.mjs';
|
||||
export * from './timespan.mjs';
|
||||
export * from './util.mjs';
|
||||
export { default as drawLine } from './drawLine.mjs';
|
||||
// below won't work with runtime.mjs (json import fails)
|
||||
/* import * as p from './package.json';
|
||||
export const version = p.version; */
|
||||
logger('🌀 @strudel/pattern loaded 🌀');
|
||||
if (globalThis._strudelLoaded) {
|
||||
console.warn(
|
||||
`@strudel/pattern was loaded more than once...
|
||||
This might happen when you have multiple versions of strudel installed.
|
||||
Please check with "npm ls @strudel/pattern".`,
|
||||
);
|
||||
}
|
||||
globalThis._strudelLoaded = true;
|
||||
@@ -5,7 +5,7 @@ let debounce = 1000,
|
||||
lastTime;
|
||||
|
||||
export function errorLogger(e, origin = 'cyclist') {
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
if (typeof process !== 'undefined' && process.env.NODE_ENV === 'development') {
|
||||
console.error(e);
|
||||
}
|
||||
logger(`[${origin}] error: ${e.message}`);
|
||||
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"name": "@strudel/pattern",
|
||||
"version": "1.2.6",
|
||||
"description": "Port of Tidal Cycles to JavaScript. This package contains only the pattern representation.",
|
||||
"main": "index.mjs",
|
||||
"type": "module",
|
||||
"publishConfig": {
|
||||
"main": "dist/index.mjs"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "vitest run",
|
||||
"bench": "vitest bench",
|
||||
"build": "vite build",
|
||||
"prepublishOnly": "pnpm build"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://codeberg.org/uzu/strudel.git"
|
||||
},
|
||||
"keywords": [
|
||||
"tidalcycles",
|
||||
"strudel",
|
||||
"pattern",
|
||||
"livecoding",
|
||||
"algorave"
|
||||
],
|
||||
"author": "Alex McLean <alex@slab.org> (https://slab.org)",
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"bugs": {
|
||||
"url": "https://codeberg.org/uzu/strudel/issues"
|
||||
},
|
||||
"homepage": "https://strudel.cc",
|
||||
"dependencies": {
|
||||
"fraction.js": "^5.2.1"
|
||||
},
|
||||
"gitHead": "0e26d4e741500f5bae35b023608f062a794905c2",
|
||||
"devDependencies": {
|
||||
"vite": "^6.0.11",
|
||||
"vitest": "^3.0.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -28,6 +28,7 @@ const _pick = function (lookup, pat, modulo = true) {
|
||||
|
||||
/** * 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
|
||||
@@ -40,6 +41,10 @@ const _pick = function (lookup, pat, modulo = true) {
|
||||
* sound("<0!2 [0,1] 1>".pick(["bd(3,8)", "sd sd"]))
|
||||
* @example
|
||||
* s("<a!2 [a,b] b>".pick({a: "bd(3,8)", b: "sd sd"}))
|
||||
* @example
|
||||
* // pick a field out of a pattern of objects
|
||||
* const pat = sound("bd cp").speed("<2 3>")
|
||||
* pat.fast("speed".pick(pat))
|
||||
*/
|
||||
|
||||
export const pick = function (lookup, pat) {
|
||||
@@ -72,7 +77,7 @@ export const pickmod = register('pickmod', function (lookup, pat) {
|
||||
* @tags combiners, functional
|
||||
* @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
|
||||
* @param {Function[] | object} lookup the array or lookup object of functions from which to pull
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* s("bd [rim hh]").pickF("<0 1 2>", [rev,jux(rev),fast(2)])
|
||||
@@ -92,7 +97,7 @@ export const pickF = register('pickF', function (pickPattern, lookup, pat) {
|
||||
* @tags combiners
|
||||
* @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
|
||||
* @param {Function[] | object} lookup the array or lookup object of functions from which to pull
|
||||
* @returns {Pattern}
|
||||
*/
|
||||
export const pickmodF = register('pickmodF', function (pickPattern, lookup, pat) {
|
||||
@@ -42,7 +42,7 @@ export const signal = (func) => {
|
||||
/**
|
||||
* A sawtooth signal between 0 and 1.
|
||||
*
|
||||
* @return {Pattern}
|
||||
* @returns {Pattern}
|
||||
* @tags generators
|
||||
* @example
|
||||
* note("<c3 [eb3,g3] g2 [g3,bb3]>*8")
|
||||
@@ -57,7 +57,7 @@ export const saw = signal((t) => _mod(t, 1));
|
||||
/**
|
||||
* A sawtooth signal between -1 and 1 (like `saw`, but bipolar).
|
||||
*
|
||||
* @return {Pattern}
|
||||
* @returns {Pattern}
|
||||
* @tags generators
|
||||
*/
|
||||
export const saw2 = saw.toBipolar();
|
||||
@@ -65,7 +65,7 @@ export const saw2 = saw.toBipolar();
|
||||
/**
|
||||
* A sawtooth signal between 1 and 0 (like `saw`, but flipped).
|
||||
*
|
||||
* @return {Pattern}
|
||||
* @returns {Pattern}
|
||||
* @tags generators
|
||||
* @example
|
||||
* note("<c3 [eb3,g3] g2 [g3,bb3]>*8")
|
||||
@@ -80,7 +80,7 @@ export const isaw = signal((t) => 1 - _mod(t, 1));
|
||||
/**
|
||||
* A sawtooth signal between 1 and -1 (like `saw2`, but flipped).
|
||||
*
|
||||
* @return {Pattern}
|
||||
* @returns {Pattern}
|
||||
* @tags generators
|
||||
*/
|
||||
export const isaw2 = isaw.toBipolar();
|
||||
@@ -88,14 +88,14 @@ export const isaw2 = isaw.toBipolar();
|
||||
/**
|
||||
* A sine signal between -1 and 1 (like `sine`, but bipolar).
|
||||
*
|
||||
* @return {Pattern}
|
||||
* @returns {Pattern}
|
||||
* @tags generators
|
||||
*/
|
||||
export const sine2 = signal((t) => Math.sin(Math.PI * 2 * t));
|
||||
|
||||
/**
|
||||
* A sine signal between 0 and 1.
|
||||
* @return {Pattern}
|
||||
* @returns {Pattern}
|
||||
* @tags generators
|
||||
* @example
|
||||
* n(sine.segment(16).range(0,15))
|
||||
@@ -107,7 +107,7 @@ export const sine = sine2.fromBipolar();
|
||||
/**
|
||||
* A cosine signal between 0 and 1.
|
||||
*
|
||||
* @return {Pattern}
|
||||
* @returns {Pattern}
|
||||
* @tags generators
|
||||
* @example
|
||||
* n(stack(sine,cosine).segment(16).range(0,15))
|
||||
@@ -119,14 +119,14 @@ export const cosine = sine._early(Fraction(1).div(4));
|
||||
/**
|
||||
* A cosine signal between -1 and 1 (like `cosine`, but bipolar).
|
||||
*
|
||||
* @return {Pattern}
|
||||
* @returns {Pattern}
|
||||
* @tags generators
|
||||
*/
|
||||
export const cosine2 = sine2._early(Fraction(1).div(4));
|
||||
|
||||
/**
|
||||
* A square signal between 0 and 1.
|
||||
* @return {Pattern}
|
||||
* @returns {Pattern}
|
||||
* @tags generators
|
||||
* @example
|
||||
* n(square.segment(4).range(0,7)).scale("C:minor")
|
||||
@@ -137,7 +137,7 @@ export const square = signal((t) => Math.floor(_mod(t * 2, 2)));
|
||||
/**
|
||||
* A square signal between -1 and 1 (like `square`, but bipolar).
|
||||
*
|
||||
* @return {Pattern}
|
||||
* @returns {Pattern}
|
||||
* @tags generators
|
||||
*/
|
||||
export const square2 = square.toBipolar();
|
||||
@@ -145,7 +145,7 @@ export const square2 = square.toBipolar();
|
||||
/**
|
||||
* A square signal between 1 and 0 (like `square` but flipped).
|
||||
*
|
||||
* @return {Pattern}
|
||||
* @returns {Pattern}
|
||||
* @tags generators
|
||||
*/
|
||||
export const isquare = signal((t) => 1 - Math.floor(_mod(t * 2, 2)));
|
||||
@@ -153,7 +153,7 @@ export const isquare = signal((t) => 1 - Math.floor(_mod(t * 2, 2)));
|
||||
/**
|
||||
* A square signal between 1 and -1 (like `isquare`, but bipolar).
|
||||
*
|
||||
* @return {Pattern}
|
||||
* @returns {Pattern}
|
||||
* @tags generators
|
||||
*/
|
||||
export const isquare2 = isquare.toBipolar();
|
||||
@@ -161,7 +161,7 @@ export const isquare2 = isquare.toBipolar();
|
||||
/**
|
||||
* A triangle signal between 0 and 1.
|
||||
*
|
||||
* @return {Pattern}
|
||||
* @returns {Pattern}
|
||||
* @tags generators
|
||||
* @example
|
||||
* n(tri.segment(8).range(0,7)).scale("C:minor")
|
||||
@@ -172,7 +172,7 @@ export const tri = fastcat(saw, isaw);
|
||||
/**
|
||||
* A triangle signal between -1 and 1 (like `tri`, but bipolar).
|
||||
*
|
||||
* @return {Pattern}
|
||||
* @returns {Pattern}
|
||||
* @tags generators
|
||||
*/
|
||||
export const tri2 = fastcat(saw2, isaw2);
|
||||
@@ -180,7 +180,7 @@ export const tri2 = fastcat(saw2, isaw2);
|
||||
/**
|
||||
* An inverted triangle signal between 1 and 0 (like `tri`, but flipped).
|
||||
*
|
||||
* @return {Pattern}
|
||||
* @returns {Pattern}
|
||||
* @tags generators
|
||||
* @example
|
||||
* n(itri.segment(8).range(0,7)).scale("C:minor")
|
||||
@@ -191,7 +191,7 @@ export const itri = fastcat(isaw, saw);
|
||||
/**
|
||||
* An inverted triangle signal between -1 and 1 (like `itri`, but bipolar).
|
||||
*
|
||||
* @return {Pattern}
|
||||
* @returns {Pattern}
|
||||
* @tags generators
|
||||
*/
|
||||
export const itri2 = fastcat(isaw2, saw2);
|
||||
@@ -199,7 +199,7 @@ export const itri2 = fastcat(isaw2, saw2);
|
||||
/**
|
||||
* A signal representing the cycle time.
|
||||
*
|
||||
* @return {Pattern}
|
||||
* @returns {Pattern}
|
||||
* @tags generators
|
||||
*/
|
||||
export const time = signal(id);
|
||||
@@ -208,7 +208,7 @@ export const time = signal(id);
|
||||
* The mouse's x position value ranges from 0 to 1.
|
||||
* @name mousex
|
||||
* @synonyms mouseX
|
||||
* @return {Pattern}
|
||||
* @returns {Pattern}
|
||||
* @tags external_io
|
||||
* @example
|
||||
* n(mousex.segment(4).range(0,7)).scale("C:minor")
|
||||
@@ -219,7 +219,7 @@ export const time = signal(id);
|
||||
* The mouse's y position value ranges from 0 to 1.
|
||||
* @name mousey
|
||||
* @synonyms mouseY
|
||||
* @return {Pattern}
|
||||
* @returns {Pattern}
|
||||
* @tags external_io
|
||||
* @example
|
||||
* n(mousey.segment(4).range(0,7)).scale("C:minor")
|
||||
@@ -324,7 +324,8 @@ export const getRandsAtTime = (t, n = 1, seed = 0) => {
|
||||
*
|
||||
* @name useRNG
|
||||
* @tags generators, math
|
||||
* @param {string} mod - Mode. One of 'legacy', 'precise'
|
||||
* @param {string} mode One of 'legacy', 'precise'
|
||||
* @returns {void}
|
||||
* @example
|
||||
* useRNG('legacy')
|
||||
* // Repeats every 300 cycles
|
||||
@@ -335,7 +336,9 @@ export const useRNG = (mode = 'legacy') => (RNG_MODE = mode);
|
||||
|
||||
/**
|
||||
* A discrete pattern of numbers from 0 to n-1
|
||||
* @param {number} n
|
||||
* @tags generators
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* n(run(4)).scale("C4:pentatonic")
|
||||
* // n("0 1 2 3").scale("C4:pentatonic")
|
||||
@@ -348,6 +351,7 @@ export const run = (n) => saw.range(0, n).round().segment(n);
|
||||
* @name binary
|
||||
* @tags generators
|
||||
* @param {number} n - input number to convert to binary
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* "hh".s().struct(binary(5))
|
||||
* // "hh".s().struct("1 0 1")
|
||||
@@ -364,6 +368,7 @@ export const binary = (n) => {
|
||||
* @tags generators
|
||||
* @param {number} n - input number to convert to binary
|
||||
* @param {number} nBits - pattern length, defaults to 16
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* "hh".s().struct(binaryN(55532, 16))
|
||||
* // "hh".s().struct("1 1 0 1 1 0 0 0 1 1 1 0 1 1 0 0")
|
||||
@@ -381,6 +386,8 @@ export const binaryN = (n, nBits = 16) => {
|
||||
* @name binaryL
|
||||
* @tags generators
|
||||
* @param {number} n - input number to convert to binary
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* s("saw").seg(8)
|
||||
* .partials(binaryL(irand(4096).add(1)))
|
||||
*/
|
||||
@@ -396,6 +403,7 @@ export const binaryL = (n) => {
|
||||
* @tags generators
|
||||
* @param {number} n - input number to convert to binary
|
||||
* @param {number} nBits - pattern length, defaults to 16
|
||||
* @returns {Pattern}
|
||||
*/
|
||||
export const binaryNL = (n, nBits = 16) => {
|
||||
return reify(n)
|
||||
@@ -415,6 +423,7 @@ export const binaryNL = (n, nBits = 16) => {
|
||||
* @name randL
|
||||
* @tags generators
|
||||
* @param {number} n Number of random numbers to sample
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* s("saw").seg(16).n(irand(12)).scale("F1:minor")
|
||||
* .partials(randL(8))
|
||||
@@ -477,7 +486,7 @@ export const scramble = register('scramble', (n, pat) => {
|
||||
* @tags math
|
||||
* @param {Function} func Function from seed (or undefined) to seed (or undefined)
|
||||
* @param {Pattern} pat Pattern to update
|
||||
* @returns Pattern
|
||||
* @returns {Pattern}
|
||||
*/
|
||||
export const withSeed = (func, pat) => {
|
||||
return new Pattern((state) => {
|
||||
@@ -528,7 +537,8 @@ export const _brandBy = (p) => rand.fmap((x) => x < p);
|
||||
*
|
||||
* @name brandBy
|
||||
* @tags generators
|
||||
* @param {number} probability - a number between 0 and 1
|
||||
* @param {number} pPat probability - a number between 0 and 1
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* s("hh*10").pan(brandBy(0.2))
|
||||
*/
|
||||
@@ -551,7 +561,8 @@ export const _irand = (i) => rand.fmap((x) => Math.trunc(x * i));
|
||||
*
|
||||
* @name irand
|
||||
* @tags generators
|
||||
* @param {number} n max value (exclusive)
|
||||
* @param {number} ipat max value (exclusive)
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* // randomly select scale notes from 0 - 7 (= C to C)
|
||||
* n(irand(8)).struct("x x*2 x x*3").scale("C:minor")
|
||||
@@ -624,6 +635,7 @@ export const chooseIn = (...xs) => chooseInWith(rand, xs);
|
||||
* the range 0 .. 1.
|
||||
* @tags temporal
|
||||
* @param {...any} xs
|
||||
* @memberof Pattern.prototype
|
||||
* @returns {Pattern}
|
||||
*/
|
||||
Pattern.prototype.choose = function (...xs) {
|
||||
@@ -635,6 +647,7 @@ Pattern.prototype.choose = function (...xs) {
|
||||
* in the range -1 .. 1
|
||||
* @tags temporal
|
||||
* @param {...any} xs
|
||||
* @memberof Pattern.prototype
|
||||
* @returns {Pattern}
|
||||
*/
|
||||
Pattern.prototype.choose2 = function (...xs) {
|
||||
@@ -643,6 +656,7 @@ Pattern.prototype.choose2 = function (...xs) {
|
||||
|
||||
/**
|
||||
* Picks one of the elements at random each cycle.
|
||||
* @param {...any} xs
|
||||
* @tags temporal
|
||||
* @synonyms randcat
|
||||
* @returns {Pattern}
|
||||
@@ -696,6 +710,7 @@ export const wchoose = (...pairs) => wchooseWith(rand, ...pairs);
|
||||
|
||||
/**
|
||||
* Picks one of the elements at random each cycle by giving a probability to each element
|
||||
* @param {...any} pairs
|
||||
* @tags temporal
|
||||
* @synonyms wrandcat
|
||||
* @returns {Pattern}
|
||||
@@ -772,7 +787,7 @@ export const berlin = signal((t, controls) => _berlin(t, controls.randSeed));
|
||||
* @name degradeByWith
|
||||
* @param {Pattern|number} test
|
||||
* @param {Pattern|number} testAgainst
|
||||
* @memberof Pattern
|
||||
* @memberof Pattern.prototype
|
||||
* @tags temporal
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
@@ -794,9 +809,9 @@ export const degradeByWith = register('degradeByWith', (withPat, x, pat) => {
|
||||
*
|
||||
* @tags temporal
|
||||
* @name degradeBy
|
||||
* @memberof Pattern
|
||||
* @memberof Pattern.prototype
|
||||
* @param {number} amount - a number between 0 and 1
|
||||
* @returns Pattern
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* s("hh*8").degradeBy(0.2)
|
||||
* @example
|
||||
@@ -820,8 +835,8 @@ export const degradeBy = register(
|
||||
*
|
||||
* @tags temporal
|
||||
* @name degrade
|
||||
* @memberof Pattern
|
||||
* @returns Pattern
|
||||
* @memberof Pattern.prototype
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* s("hh*8").degrade()
|
||||
* @example
|
||||
@@ -837,9 +852,9 @@ export const degrade = register('degrade', (pat) => pat._degradeBy(0.5), true, t
|
||||
*
|
||||
* @tags temporal
|
||||
* @name undegradeBy
|
||||
* @memberof Pattern
|
||||
* @memberof Pattern.prototype
|
||||
* @param {number} amount - a number between 0 and 1
|
||||
* @returns Pattern
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* s("hh*8").undegradeBy(0.2)
|
||||
* @example
|
||||
@@ -866,8 +881,8 @@ export const undegradeBy = register(
|
||||
*
|
||||
* @tags temporal
|
||||
* @name undegrade
|
||||
* @memberof Pattern
|
||||
* @returns Pattern
|
||||
* @memberof Pattern.prototype
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* s("hh*8").undegrade()
|
||||
* @example
|
||||
@@ -885,10 +900,10 @@ export const undegrade = register('undegrade', (pat) => pat._undegradeBy(0.5), t
|
||||
*
|
||||
* @tags temporal
|
||||
* @name sometimesBy
|
||||
* @memberof Pattern
|
||||
* @memberof Pattern.prototype
|
||||
* @param {number | Pattern} probability - a number between 0 and 1
|
||||
* @param {function} function - the transformation to apply
|
||||
* @returns Pattern
|
||||
* @param {Function} function - the transformation to apply
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* s("hh*8").sometimesBy(.4, x=>x.speed("0.5"))
|
||||
*/
|
||||
@@ -905,9 +920,9 @@ export const sometimesBy = register('sometimesBy', function (patx, func, pat) {
|
||||
*
|
||||
* @tags temporal
|
||||
* @name sometimes
|
||||
* @memberof Pattern
|
||||
* @param {function} function - the transformation to apply
|
||||
* @returns Pattern
|
||||
* @memberof Pattern.prototype
|
||||
* @param {Function} function - the transformation to apply
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* s("hh*8").sometimes(x=>x.speed("0.5"))
|
||||
*/
|
||||
@@ -921,10 +936,10 @@ export const sometimes = register('sometimes', function (func, pat) {
|
||||
* Similar to `sometimesBy`
|
||||
*
|
||||
* @name someCyclesBy
|
||||
* @memberof Pattern
|
||||
* @memberof Pattern.prototype
|
||||
* @param {number | Pattern} probability - a number between 0 and 1
|
||||
* @param {function} function - the transformation to apply
|
||||
* @returns Pattern
|
||||
* @param {Function} function - the transformation to apply
|
||||
* @returns {Pattern}
|
||||
* @tags temporal
|
||||
* @example
|
||||
* s("bd,hh*8").someCyclesBy(.3, x=>x.speed("0.5"))
|
||||
@@ -946,8 +961,8 @@ export const someCyclesBy = register('someCyclesBy', function (patx, func, pat)
|
||||
* Shorthand for `.someCyclesBy(0.5, fn)`
|
||||
*
|
||||
* @name someCycles
|
||||
* @memberof Pattern
|
||||
* @returns Pattern
|
||||
* @memberof Pattern.prototype
|
||||
* @returns {Pattern}
|
||||
* @tags temporal
|
||||
* @example
|
||||
* s("bd,hh*8").someCycles(x=>x.speed("0.5"))
|
||||
@@ -961,8 +976,8 @@ export const someCycles = register('someCycles', function (func, pat) {
|
||||
* Shorthand for `.sometimesBy(0.75, fn)`
|
||||
*
|
||||
* @name often
|
||||
* @memberof Pattern
|
||||
* @returns Pattern
|
||||
* @memberof Pattern.prototype
|
||||
* @returns {Pattern}
|
||||
* @tags temporal
|
||||
* @example
|
||||
* s("hh*8").often(x=>x.speed("0.5"))
|
||||
@@ -976,8 +991,8 @@ export const often = register('often', function (func, pat) {
|
||||
* Shorthand for `.sometimesBy(0.25, fn)`
|
||||
*
|
||||
* @name rarely
|
||||
* @memberof Pattern
|
||||
* @returns Pattern
|
||||
* @memberof Pattern.prototype
|
||||
* @returns {Pattern}
|
||||
* @tags temporal
|
||||
* @example
|
||||
* s("hh*8").rarely(x=>x.speed("0.5"))
|
||||
@@ -992,8 +1007,8 @@ export const rarely = register('rarely', function (func, pat) {
|
||||
*
|
||||
* @tags temporal
|
||||
* @name almostNever
|
||||
* @memberof Pattern
|
||||
* @returns Pattern
|
||||
* @memberof Pattern.prototype
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* s("hh*8").almostNever(x=>x.speed("0.5"))
|
||||
*/
|
||||
@@ -1007,8 +1022,8 @@ export const almostNever = register('almostNever', function (func, pat) {
|
||||
*
|
||||
* @tags temporal
|
||||
* @name almostAlways
|
||||
* @memberof Pattern
|
||||
* @returns Pattern
|
||||
* @memberof Pattern.prototype
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* s("hh*8").almostAlways(x=>x.speed("0.5"))
|
||||
*/
|
||||
@@ -1022,8 +1037,8 @@ export const almostAlways = register('almostAlways', function (func, pat) {
|
||||
*
|
||||
* @tags temporal
|
||||
* @name never
|
||||
* @memberof Pattern
|
||||
* @returns Pattern
|
||||
* @memberof Pattern.prototype
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* s("hh*8").never(x=>x.speed("0.5"))
|
||||
*/
|
||||
@@ -1037,8 +1052,8 @@ export const never = register('never', function (_, pat) {
|
||||
*
|
||||
* @tags temporal
|
||||
* @name always
|
||||
* @memberof Pattern
|
||||
* @returns Pattern
|
||||
* @memberof Pattern.prototype
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* s("hh*8").always(x=>x.speed("0.5"))
|
||||
*/
|
||||
@@ -1066,8 +1081,8 @@ export function _keyDown(keyname) {
|
||||
*
|
||||
* @tags external_io
|
||||
* @name whenKey
|
||||
* @memberof Pattern
|
||||
* @returns Pattern
|
||||
* @memberof Pattern.prototype
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* s("bd(5,8)").whenKey("Control:j", x => x.segment(16).color("red")).whenKey("Control:i", x => x.fast(2).color("blue"))
|
||||
*/
|
||||
@@ -1083,8 +1098,8 @@ export const whenKey = register('whenKey', function (input, func, pat) {
|
||||
*
|
||||
* @tags external_io
|
||||
* @name keyDown
|
||||
* @memberof Pattern
|
||||
* @returns Pattern
|
||||
* @memberof Pattern.prototype
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* keyDown("Control:j").pick([s("bd(5,8)"), s("cp(3,8)")])
|
||||
*/
|
||||
@@ -58,11 +58,12 @@ import {
|
||||
arp,
|
||||
} from '../index.mjs';
|
||||
|
||||
import { log, logValues, stackCenter } from '../pattern.mjs';
|
||||
import { reify, stackCenter } from '../pattern.mjs';
|
||||
|
||||
import { steady } from '../signal.mjs';
|
||||
|
||||
import { n, s } from '../controls.mjs';
|
||||
let n = (value) => reify(value).fmap((v) => ({ n: v }));
|
||||
let s = (value) => reify(value).fmap((v) => ({ s: v }));
|
||||
|
||||
const st = (begin, end) => new State(ts(begin, end));
|
||||
const ts = (begin, end) => new TimeSpan(Fraction(begin), Fraction(end));
|
||||
@@ -71,7 +72,7 @@ const hap = (whole, part, value, context = {}) => new Hap(whole, part, value, co
|
||||
const third = Fraction(1, 3);
|
||||
const twothirds = Fraction(2, 3);
|
||||
|
||||
const sameFirst = (a, b) => {
|
||||
export const sameFirst = (a, b) => {
|
||||
return expect(a.sortHapsByPart().firstCycle()).toStrictEqual(b.sortHapsByPart().firstCycle());
|
||||
};
|
||||
|
||||
@@ -876,24 +877,6 @@ describe('Pattern', () => {
|
||||
);
|
||||
});
|
||||
});
|
||||
describe('jux', () => {
|
||||
it('Can juxtapose', () => {
|
||||
expect(pure({ a: 1 }).jux(fast(2)).sortHapsByPart().firstCycle()).toStrictEqual(
|
||||
stack(pure({ a: 1, pan: 0 }), pure({ a: 1, pan: 1 }).fast(2))
|
||||
.sortHapsByPart()
|
||||
.firstCycle(),
|
||||
);
|
||||
});
|
||||
});
|
||||
describe('juxBy', () => {
|
||||
it('Can juxtapose by half', () => {
|
||||
expect(pure({ a: 1 }).juxBy(0.5, fast(2)).sortHapsByPart().firstCycle()).toStrictEqual(
|
||||
stack(pure({ a: 1, pan: 0.25 }), pure({ a: 1, pan: 0.75 }).fast(2))
|
||||
.sortHapsByPart()
|
||||
.firstCycle(),
|
||||
);
|
||||
});
|
||||
});
|
||||
describe('_squeezeJoin', () => {
|
||||
it('Can squeeze', () => {
|
||||
expect(
|
||||
@@ -931,46 +914,6 @@ describe('Pattern', () => {
|
||||
expect(sequence(1, 2, 3).ply(2).early(8).firstCycle().length).toBe(6);
|
||||
});
|
||||
});
|
||||
describe('striate', () => {
|
||||
it('Can striate(2)', () => {
|
||||
sameFirst(
|
||||
sequence({ sound: 'a' }).striate(2),
|
||||
sequence({ sound: 'a', begin: 0, end: 0.5 }, { sound: 'a', begin: 0.5, end: 1 }),
|
||||
);
|
||||
});
|
||||
});
|
||||
describe('chop', () => {
|
||||
it('Can _chop(2)', () => {
|
||||
expect(sequence({ sound: 'a' }, { sound: 'b' })._chop(2).firstCycle()).toStrictEqual(
|
||||
sequence(
|
||||
{ sound: 'a', begin: 0, end: 0.5 },
|
||||
{ sound: 'a', begin: 0.5, end: 1 },
|
||||
{ sound: 'b', begin: 0, end: 0.5 },
|
||||
{ sound: 'b', begin: 0.5, end: 1 },
|
||||
).firstCycle(),
|
||||
);
|
||||
});
|
||||
it('Can chop(2,3)', () => {
|
||||
expect(pure({ sound: 'a' }).fast(2).chop(2, 3).sortHapsByPart().firstCycle()).toStrictEqual(
|
||||
sequence(
|
||||
[
|
||||
{ sound: 'a', begin: 0, end: 0.5 },
|
||||
{ sound: 'a', begin: 0.5, end: 1 },
|
||||
],
|
||||
[
|
||||
{ sound: 'a', begin: 0, end: 1 / 3 },
|
||||
{ sound: 'a', begin: 1 / 3, end: 2 / 3 },
|
||||
{ sound: 'a', begin: 2 / 3, end: 1 },
|
||||
],
|
||||
)
|
||||
.sortHapsByPart()
|
||||
.firstCycle(),
|
||||
);
|
||||
});
|
||||
it('Can chop chops', () => {
|
||||
expect(pure({ s: 'bev' }).chop(2).chop(2).firstCycle()).toStrictEqual(pure({ s: 'bev' }).chop(4).firstCycle());
|
||||
});
|
||||
});
|
||||
describe('range', () => {
|
||||
it('Can be patterned', () => {
|
||||
expect(sequence(0, 0).range(sequence(0, 0.5), 1).firstCycle()).toStrictEqual(sequence(0, 0.5).firstCycle());
|
||||
@@ -1053,11 +996,6 @@ describe('Pattern', () => {
|
||||
sameFirst(sequence('a', 'b', 'c', 'd').press(), sequence(silence, 'a', silence, 'b', silence, 'c', silence, 'd'));
|
||||
});
|
||||
});
|
||||
describe('hurry', () => {
|
||||
it('Can speed up patterns and sounds', () => {
|
||||
sameFirst(s(sequence('a', 'b')).hurry(2), s(sequence('a', 'b')).fast(2).speed(2));
|
||||
});
|
||||
});
|
||||
/*describe('composable functions', () => {
|
||||
it('Can compose functions', () => {
|
||||
sameFirst(sequence(3, 4).fast(2).rev().fast(2), fast(2).rev().fast(2)(sequence(3, 4)));
|
||||
@@ -1076,32 +1014,6 @@ describe('Pattern', () => {
|
||||
});
|
||||
});
|
||||
*/
|
||||
describe('slice', () => {
|
||||
it('Can slice a sample', () => {
|
||||
sameFirst(
|
||||
s('break').slice(4, sequence(0, 1, 2, 3)),
|
||||
sequence(
|
||||
{ begin: 0, end: 0.25, s: 'break', _slices: 4 },
|
||||
{ begin: 0.25, end: 0.5, s: 'break', _slices: 4 },
|
||||
{ begin: 0.5, end: 0.75, s: 'break', _slices: 4 },
|
||||
{ begin: 0.75, end: 1, s: 'break', _slices: 4 },
|
||||
),
|
||||
);
|
||||
});
|
||||
});
|
||||
describe('splice', () => {
|
||||
it('Can splice a sample', () => {
|
||||
sameFirst(
|
||||
s('break').splice(4, sequence(0, 1, 2, 3)),
|
||||
sequence(
|
||||
{ begin: 0, end: 0.25, s: 'break', _slices: 4, unit: 'c', speed: 1 },
|
||||
{ begin: 0.25, end: 0.5, s: 'break', _slices: 4, unit: 'c', speed: 1 },
|
||||
{ begin: 0.5, end: 0.75, s: 'break', _slices: 4, unit: 'c', speed: 1 },
|
||||
{ begin: 0.75, end: 1, s: 'break', _slices: 4, unit: 'c', speed: 1 },
|
||||
),
|
||||
);
|
||||
});
|
||||
});
|
||||
describe('chunk', () => {
|
||||
it('Processes each cycle of the source pattern multiple times, once for each chunk', () => {
|
||||
expect(sequence(0, 1, 2, 3).slow(2).chunk(2, add(10)).fast(4).firstCycleValues).toStrictEqual([
|
||||
@@ -1169,6 +1081,15 @@ describe('Pattern', () => {
|
||||
),
|
||||
);
|
||||
});
|
||||
it('Can pick values from a pattern of objects', () => {
|
||||
const pat = slowcat({ s: 'bd', speed: 2 }, { s: 'cp', speed: 3 });
|
||||
expect(
|
||||
pure('speed')
|
||||
.pick(pat)
|
||||
.queryArc(0, 2)
|
||||
.map((hap) => hap.value),
|
||||
).toStrictEqual([2, 3]);
|
||||
});
|
||||
});
|
||||
describe('pickmod', () => {
|
||||
it('Wraps indexes', () => {
|
||||
@@ -1180,24 +1101,15 @@ describe('Pattern', () => {
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('_steps', () => {
|
||||
it('Is correctly preserved/calculated through transformations', () => {
|
||||
expect(sequence(0, 1, 2, 3).linger(4)._steps).toStrictEqual(Fraction(4));
|
||||
expect(sequence(0, 1, 2, 3).iter(4)._steps).toStrictEqual(Fraction(4));
|
||||
expect(sequence(0, 1, 2, 3).fast(4)._steps).toStrictEqual(Fraction(4));
|
||||
expect(sequence(0, 1, 2, 3).hurry(4)._steps).toStrictEqual(Fraction(4));
|
||||
expect(sequence(0, 1, 2, 3).rev()._steps).toStrictEqual(Fraction(4));
|
||||
expect(sequence(1).segment(10)._steps).toStrictEqual(Fraction(10));
|
||||
expect(sequence(1, 0, 1).invert()._steps).toStrictEqual(Fraction(3));
|
||||
expect(sequence({ s: 'bev' }, { s: 'amenbreak' }).chop(4)._steps).toStrictEqual(Fraction(8));
|
||||
expect(sequence({ s: 'bev' }, { s: 'amenbreak' }).striate(4)._steps).toStrictEqual(Fraction(8));
|
||||
expect(sequence({ s: 'bev' }, { s: 'amenbreak' }).slice(4, sequence(0, 1, 2, 3))._steps).toStrictEqual(
|
||||
Fraction(4),
|
||||
);
|
||||
expect(sequence({ s: 'bev' }, { s: 'amenbreak' }).splice(4, sequence(0, 1, 2, 3))._steps).toStrictEqual(
|
||||
Fraction(4),
|
||||
);
|
||||
expect(sequence({ n: 0 }, { n: 1 }, { n: 2 }).chop(4)._steps).toStrictEqual(Fraction(12));
|
||||
expect(
|
||||
pure((x) => x + 1)
|
||||
.setSteps(3)
|
||||
@@ -1310,11 +1222,6 @@ describe('Pattern', () => {
|
||||
);
|
||||
});
|
||||
});
|
||||
describe('loopAt', () => {
|
||||
it('maintains steps', () => {
|
||||
expect(s('bev').chop(8).loopAt(2)._steps).toStrictEqual(Fraction(4));
|
||||
});
|
||||
});
|
||||
describe('bite', () => {
|
||||
it('works with uneven patterns', () => {
|
||||
sameFirst(
|
||||
@@ -1396,7 +1303,7 @@ describe('Pattern', () => {
|
||||
describe('logValues', () => {
|
||||
it('logs values to console', () => {
|
||||
const mockConsoleLog = vi.spyOn(console, 'log').mockImplementation(() => {});
|
||||
const pattern = pure('a').note('c#').logValues();
|
||||
const pattern = pure({ s: 'bd', speed: 2 }).logValues();
|
||||
const haps = pattern.queryArc(0, 1);
|
||||
|
||||
// Force a trigger
|
||||
@@ -1405,7 +1312,7 @@ describe('Pattern', () => {
|
||||
});
|
||||
|
||||
expect(mockConsoleLog).toHaveBeenCalledWith(
|
||||
'%c[hap] value:a note:c#',
|
||||
'%c[hap] s:bd speed:2',
|
||||
'background-color: black;color:white;border-radius:15px',
|
||||
);
|
||||
mockConsoleLog.mockRestore();
|
||||
@@ -6,7 +6,7 @@ This program is free software: you can redistribute it and/or modify it under th
|
||||
|
||||
import Fraction from 'fraction.js';
|
||||
|
||||
import { describe, it, expect, vi } from 'vitest';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
|
||||
import {
|
||||
saw,
|
||||
@@ -25,7 +25,7 @@ import {
|
||||
perx,
|
||||
cyclesPer,
|
||||
} from '../signal.mjs';
|
||||
import { fastcat, sequence, State, TimeSpan, Hap, note } from '../index.mjs';
|
||||
import { fastcat, sequence, State, TimeSpan, Hap, seq } from '../index.mjs';
|
||||
|
||||
const st = (begin, end) => new State(ts(begin, end));
|
||||
const ts = (begin, end) => new TimeSpan(Fraction(begin), Fraction(end));
|
||||
@@ -122,6 +122,6 @@ describe('perx', () => {
|
||||
|
||||
describe('shuffle', () => {
|
||||
it('returns original pattern if input is 1', () => {
|
||||
expect(note('c d e f').sound('piano').shuffle(1).firstCycle()).toEqual(note('c d e f').sound('piano').firstCycle());
|
||||
expect(seq(1, 2, 3, 4).shuffle(1).firstCycle()).toEqual(seq(1, 2, 3, 4).firstCycle());
|
||||
});
|
||||
});
|
||||
@@ -6,7 +6,6 @@ This program is free software: you can redistribute it and/or modify it under th
|
||||
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { map, valued, mul } from '../value.mjs';
|
||||
import { n } from '../controls.mjs';
|
||||
|
||||
describe('Value', () => {
|
||||
it('unionWith', () => {
|
||||
@@ -72,8 +72,11 @@ export const getEventOffsetMs = (targetTimeSeconds, currentTimeSeconds) => {
|
||||
|
||||
const pcs = ['C', 'Db', 'D', 'Eb', 'E', 'F', 'Gb', 'G', 'Ab', 'A', 'Bb', 'B'];
|
||||
/**
|
||||
* converts midi values into notes
|
||||
* @param {number} n
|
||||
* @deprecated only used in workshop (first-notes)
|
||||
* @noAutocomplete
|
||||
* @returns {string}
|
||||
*/
|
||||
export const midi2note = (n) => {
|
||||
const oct = Math.floor(n / 12) - 1;
|
||||
@@ -131,8 +134,8 @@ export const getPlayableNoteValue = (hap) => {
|
||||
* @name getFrequency
|
||||
* @tags pitch
|
||||
* @synonyms getFreq
|
||||
* @param {Hap | note | number} input
|
||||
* @returns {Number}
|
||||
* @param {Hap | note | number} hap input
|
||||
* @returns {number}
|
||||
* @example
|
||||
* i("4 8 9 10 - - 5 7 9 11 - -").tune("tranh3")
|
||||
* .mul(getFreq('c3'))
|
||||
@@ -0,0 +1,20 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import { dependencies } from './package.json';
|
||||
import { resolve } from 'path';
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
base: './',
|
||||
plugins: [],
|
||||
build: {
|
||||
lib: {
|
||||
entry: resolve(__dirname, 'index.mjs'),
|
||||
formats: ['es'],
|
||||
fileName: (ext) => ({ es: 'index.mjs' })[ext],
|
||||
},
|
||||
rollupOptions: {
|
||||
external: [...Object.keys(dependencies)],
|
||||
},
|
||||
target: 'esnext',
|
||||
},
|
||||
});
|
||||
@@ -43,7 +43,8 @@
|
||||
"@strudel/soundfonts": "workspace:*",
|
||||
"@strudel/tonal": "workspace:*",
|
||||
"@strudel/transpiler": "workspace:*",
|
||||
"@strudel/webaudio": "workspace:*"
|
||||
"@strudel/webaudio": "workspace:*",
|
||||
"@strudel/websocket": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-replace": "^6.0.2",
|
||||
|
||||
@@ -15,6 +15,7 @@ export async function prebake() {
|
||||
import('@strudel/hydra'),
|
||||
import('@strudel/soundfonts'),
|
||||
import('@strudel/midi'),
|
||||
import('@strudel/websocket'),
|
||||
// import('@strudel/xen'),
|
||||
// import('@strudel/serial'),
|
||||
// import('@strudel/csound'),
|
||||
|
||||
@@ -21,12 +21,29 @@ LOG=1 npx @strudel/sampler # adds logging
|
||||
PORT=5555 npx @strudel/sampler # changes port
|
||||
```
|
||||
|
||||
## static json
|
||||
### --json
|
||||
|
||||
when running with `--json`, you will simply get the json logged back:
|
||||
|
||||
```sh
|
||||
npx --yes @strudel/sampler --json > strudel.json
|
||||
npx @strudel/sampler --json > strudel.json
|
||||
```
|
||||
|
||||
this is useful if you want to create a sample pack from the current folder.
|
||||
|
||||
### `--dir`
|
||||
|
||||
specifies the directory to serve. defaults to cwd
|
||||
|
||||
```sh
|
||||
npx @strudel/sampler --dir ~/Music/samples
|
||||
```
|
||||
|
||||
### `--flat`
|
||||
|
||||
with `--flat`, each file gets its own name, not grouped by directory.
|
||||
|
||||
```sh
|
||||
npx @strudel/sampler --flat
|
||||
```
|
||||
|
||||
this is useful if you want to create a sample pack from the current folder.
|
||||
@@ -1,21 +1,40 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
import cowsay from 'cowsay';
|
||||
import { createReadStream, existsSync, writeFileSync } from 'fs';
|
||||
import { createReadStream, existsSync } from 'fs';
|
||||
import { readdir } from 'fs/promises';
|
||||
import http from 'http';
|
||||
import { join, resolve, sep } from 'path';
|
||||
import readline from 'readline';
|
||||
import os from 'os';
|
||||
|
||||
const LOG = !!process.env.LOG || false;
|
||||
const PORT = process.env.PORT || 5432;
|
||||
const VALID_AUDIO_EXTENSIONS = ['wav', 'mp3', 'ogg'];
|
||||
|
||||
const isAudioFile = (f) => {
|
||||
const args = {};
|
||||
|
||||
// parse args
|
||||
for (const arg of process.argv.slice(2)) {
|
||||
if (arg === '--json') args.json = true;
|
||||
if (arg === '--flat') args.flat = true;
|
||||
if (arg === '--dir') args.dir = process.argv[process.argv.indexOf(arg) + 1];
|
||||
}
|
||||
|
||||
const directory = resolve(args.dir || process.cwd());
|
||||
const banks = await getBanks(directory, args.flat);
|
||||
|
||||
// if --json, output banks and exit
|
||||
if (args.json) {
|
||||
// stringify in expanded format
|
||||
const json = JSON.stringify(banks, null, 2);
|
||||
process.stdout.write(json + '\n');
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
function isAudioFile(f) {
|
||||
const ext = f.split('.').slice(-1)[0].toLowerCase();
|
||||
return VALID_AUDIO_EXTENSIONS.includes(ext);
|
||||
};
|
||||
}
|
||||
|
||||
async function getFilesInDirectory(directory) {
|
||||
let files = [];
|
||||
@@ -41,11 +60,11 @@ async function getFilesInDirectory(directory) {
|
||||
return files;
|
||||
}
|
||||
|
||||
async function getBanks(directory, flat = false) {
|
||||
let files = await getFilesInDirectory(directory);
|
||||
let banks = {};
|
||||
async function getBanks(directory, flat) {
|
||||
const banks = {};
|
||||
const files = await getFilesInDirectory(directory);
|
||||
directory = directory.split(sep).join('/');
|
||||
files = files.map((path) => {
|
||||
files.forEach((path) => {
|
||||
path = path.split(sep).join('/');
|
||||
const subDir = path.replace(directory, '');
|
||||
const subDirFlat = subDir.replaceAll('/', '_').slice(1); // remove initial underscore
|
||||
@@ -55,50 +74,7 @@ async function getBanks(directory, flat = false) {
|
||||
banks[bank].push(subDir);
|
||||
return subDir;
|
||||
});
|
||||
return { banks, files };
|
||||
}
|
||||
|
||||
const args = process.argv.slice(2);
|
||||
|
||||
function getArgValue(flag) {
|
||||
const i = args.indexOf(flag);
|
||||
if (i !== -1) {
|
||||
const nextIsFlag = args[i + 1]?.startsWith('--') ?? true;
|
||||
if (nextIsFlag) return true;
|
||||
return args[i + 1];
|
||||
}
|
||||
}
|
||||
|
||||
function getInput(query) {
|
||||
const rl = readline.createInterface({
|
||||
input: process.stdin,
|
||||
output: process.stdout,
|
||||
});
|
||||
|
||||
return new Promise((resolve) =>
|
||||
rl.question(query, (response) => {
|
||||
rl.close();
|
||||
resolve(response);
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
let directory = getArgValue('--dir') || process.cwd();
|
||||
directory = resolve(directory);
|
||||
if (args.includes('--json')) {
|
||||
const { banks } = await getBanks(directory, getArgValue('--flat'));
|
||||
const json = JSON.stringify(banks);
|
||||
const outFile = resolve(directory, 'strudel.json');
|
||||
if (existsSync(outFile)) {
|
||||
const answer = await getInput(`Warning: File already exists at ${outFile}. Overwrite? (y/N): `);
|
||||
if (answer.toLowerCase() !== 'y') {
|
||||
console.log('Aborted.');
|
||||
process.exit(0);
|
||||
}
|
||||
}
|
||||
writeFileSync(outFile, json, 'utf8');
|
||||
console.log(`Wrote json to ${outFile}`);
|
||||
process.exit(0);
|
||||
return banks;
|
||||
}
|
||||
|
||||
console.log(
|
||||
@@ -111,7 +87,6 @@ console.log(
|
||||
|
||||
const server = http.createServer(async (req, res) => {
|
||||
res.setHeader('Access-Control-Allow-Origin', '*');
|
||||
const { banks, files } = await getBanks(directory, getArgValue('--flat'));
|
||||
if (req.url === '/') {
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
return res.end(JSON.stringify(banks));
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
"url": "git+https://codeberg.org/uzu/strudel.git"
|
||||
},
|
||||
"keywords": [
|
||||
"titdalcycles",
|
||||
"tidalcycles",
|
||||
"strudel",
|
||||
"pattern",
|
||||
"livecoding",
|
||||
|
||||
@@ -250,7 +250,7 @@ export function createFilter(context, start, end, params, cps, cycle) {
|
||||
} = params;
|
||||
|
||||
let frequencyParam, filter;
|
||||
if (model === 'ladder') {
|
||||
if (model === 'ladder' && type === 'lowpass') {
|
||||
filter = getWorklet(context, 'ladder-processor', { frequency, q, drive });
|
||||
frequencyParam = filter.parameters.get('frequency');
|
||||
} else {
|
||||
|
||||
@@ -36,6 +36,8 @@ class OLAProcessor extends AudioWorkletProcessor {
|
||||
|
||||
/** Handles dynamic reallocation of input/output channels buffer
|
||||
* (channel numbers may vary during lifecycle)
|
||||
* @param {*} inputs
|
||||
* @param {*} outputs
|
||||
* @tags internals
|
||||
**/
|
||||
reallocateChannelsIfNeeded(inputs, outputs) {
|
||||
@@ -92,6 +94,7 @@ class OLAProcessor extends AudioWorkletProcessor {
|
||||
|
||||
/**
|
||||
* Read next web audio block to input buffers
|
||||
* @param {*} inputs
|
||||
* @tags internals
|
||||
**/
|
||||
readInputs(inputs) {
|
||||
@@ -114,6 +117,7 @@ class OLAProcessor extends AudioWorkletProcessor {
|
||||
}
|
||||
|
||||
/** Write next web audio block from output buffers
|
||||
* @param {*} outputs
|
||||
* @tags internals
|
||||
**/
|
||||
writeOutputs(outputs) {
|
||||
|
||||
@@ -37,11 +37,11 @@ function humanFileSize(bytes, si) {
|
||||
* Note: `must` be called with await, otherwise you'll get a pending Promise object.
|
||||
*
|
||||
* @name getDuration
|
||||
* @synonym getDur
|
||||
* @synonyms getDur
|
||||
* @tags samples
|
||||
* @param {string} sampleName
|
||||
* @param {number} (optional) n
|
||||
*
|
||||
* @param {string} s sampleName
|
||||
* @param {number} [n]
|
||||
* @returns {Promise<object>}
|
||||
* @example
|
||||
* // Set a patterns cycle length to exactly the length of the sample
|
||||
* samples('github:tidalcycles/dirt-samples')
|
||||
|
||||
@@ -41,7 +41,7 @@ export let maxPolyphony = DEFAULT_MAX_POLYPHONY;
|
||||
*
|
||||
* @name setMaxPolyphony
|
||||
* @tags superdough
|
||||
* @param {number} Max polyphony. Defaults to 128
|
||||
* @param {number} polyphony Max polyphony. Defaults to 128
|
||||
* @example
|
||||
* setMaxPolyphony(4)
|
||||
* n(irand(24).seg(8)).scale("C#3:minor").room(1).release(4).gain(0.5)
|
||||
@@ -75,7 +75,7 @@ export function applyGainCurve(val) {
|
||||
*
|
||||
* @name setGainCurve
|
||||
* @tags amplitude, superdough
|
||||
* @param {Function} function to apply to all gain values
|
||||
* @param {Function} newGainCurveFunc function to apply to all gain values
|
||||
* @example
|
||||
* setGainCurve((x) => x * x) // quadratic gain
|
||||
* s("bd*4").gain(0.5) // equivalent to 0.25 gain normally
|
||||
@@ -128,9 +128,8 @@ async function aliasBankPath(path) {
|
||||
* Register an alias for a bank of sounds.
|
||||
* 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 {string} bank - The bank to alias
|
||||
* @param {string} alias - The alias to use for the bank
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
export async function aliasBank(...args) {
|
||||
@@ -676,7 +675,7 @@ export const superdough = async (value, t, hapDuration, cps = 0.5, cycle = 0.5)
|
||||
chain.connect(initialGain);
|
||||
|
||||
// filter
|
||||
const ftype = getFilterType(value.ftype);
|
||||
const ftype = getFilterType(fx.ftype ?? value.ftype);
|
||||
|
||||
const filt = (params) => createFilter(ac, t, end, params, cps, cycle);
|
||||
if (fx.cutoff !== undefined) {
|
||||
@@ -701,6 +700,7 @@ export const superdough = async (value, t, hapDuration, cps = 0.5, cycle = 0.5)
|
||||
};
|
||||
const lpParams = pickAndRename(fx, lpMap);
|
||||
lpParams.type = 'lowpass';
|
||||
lpParams.model = ftype;
|
||||
const { filter: lpf1, lfo: lfo1 } = filt(lpParams);
|
||||
fxNodes['lpf'] = [lpf1];
|
||||
fxNodes['lpf_lfo'] = [lfo1];
|
||||
|
||||
@@ -112,6 +112,9 @@ export function getCommonSampleInfo(hapValue, bank) {
|
||||
|
||||
/** Selects entries from `source` and renames them via `map`
|
||||
* @tags internals
|
||||
* @param {object} source
|
||||
* @param {*} map
|
||||
* @returns {*}
|
||||
*/
|
||||
export const pickAndRename = (source, map) => {
|
||||
return Object.fromEntries(Object.entries(map).map(([newKey, oldKey]) => [newKey, source[oldKey]]));
|
||||
|
||||
@@ -185,8 +185,13 @@ export function registerWaveTable(key, tables, params) {
|
||||
/**
|
||||
* Loads a collection of wavetables to use with `s`
|
||||
*
|
||||
* @param {string} url
|
||||
* @param {*} frameLen
|
||||
* @param {string} json
|
||||
* @param {object} options
|
||||
* @name tables
|
||||
* @tags wavetable
|
||||
* @returns {void}
|
||||
*/
|
||||
export const tables = async (url, frameLen, json, options = {}) => {
|
||||
if (json !== undefined) return _processTables(json, url, frameLen);
|
||||
|
||||
@@ -647,6 +647,7 @@ class PhaseVocoderProcessor extends OLAProcessor {
|
||||
}
|
||||
|
||||
/** Apply Hann window in-place
|
||||
* @param {number[]} input
|
||||
* @tags internals
|
||||
*/
|
||||
applyHannWindow(input) {
|
||||
@@ -695,6 +696,7 @@ class PhaseVocoderProcessor extends OLAProcessor {
|
||||
}
|
||||
|
||||
/** Shift peaks and regions of influence by pitchFactor into new specturm
|
||||
* @param {number} pitchFactor
|
||||
* @tags internals
|
||||
*/
|
||||
shiftPeaks(pitchFactor) {
|
||||
|
||||
@@ -102,8 +102,8 @@ function scaleOffset(scale, offset, note) {
|
||||
*
|
||||
* @tags tonal
|
||||
* @param {string | number} amount Either number of semitones or interval string.
|
||||
* @returns Pattern
|
||||
* @memberof Pattern
|
||||
* @returns {Pattern}
|
||||
* @memberof Pattern.prototype
|
||||
* @name transpose
|
||||
* @synonyms trans
|
||||
* @example
|
||||
@@ -160,11 +160,11 @@ export const { transpose, trans } = register(['transpose', 'trans'], function tr
|
||||
* Transposes notes inside the scale by the number of steps.
|
||||
* Expected to be called on a Pattern which already has a {@link Pattern#scale}
|
||||
*
|
||||
* @memberof Pattern
|
||||
* @memberof Pattern.prototype
|
||||
* @name scaleTranspose
|
||||
* @tags tonal
|
||||
* @param {offset} offset number of steps inside the scale
|
||||
* @returns Pattern
|
||||
* @returns {Pattern}
|
||||
* @synonyms scaleTrans, strans
|
||||
* @example
|
||||
* "-8 [2,4,6]"
|
||||
@@ -255,7 +255,8 @@ function _getNearestScaleNote(scaleName, note, preferHigher = true) {
|
||||
* @name scale
|
||||
* @tags tonal
|
||||
* @param {string} scale Name of scale
|
||||
* @returns Pattern
|
||||
* @memberof Pattern.prototype
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* n("0 2 4 6 4 2").scale("C:major")
|
||||
* @example
|
||||
|
||||
@@ -91,11 +91,10 @@ export const setVoicingRange = (name, range) => addVoicings(name, voicingRegistr
|
||||
*
|
||||
* @name addVoicings
|
||||
* @tags tonal
|
||||
* @memberof Pattern
|
||||
* @memberof Pattern.prototype
|
||||
* @param {string} name identifier for the voicing dictionary
|
||||
* @param {Object} dictionary maps chord symbol to possible voicings
|
||||
* @param {object} dictionary maps chord symbol to possible voicings
|
||||
* @param {Array} range min, max note
|
||||
* @returns Pattern
|
||||
* @example
|
||||
* addVoicings('cookie', {
|
||||
* 7: ['3M 7m 9M 12P 15P', '7m 10M 13M 16M 19P'],
|
||||
@@ -135,9 +134,9 @@ const getVoicing = (chord, dictionaryName, lastVoicing) => {
|
||||
*
|
||||
* @name voicings
|
||||
* @tags tonal
|
||||
* @memberof Pattern
|
||||
* @memberof Pattern.prototype
|
||||
* @param {string} dictionary which voicing dictionary to use.
|
||||
* @returns Pattern
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* stack("<C^7 A7 Dm7 G7>".voicings('lefthand'), "<C3 A2 D3 G2>").note()
|
||||
*/
|
||||
@@ -160,9 +159,9 @@ export const voicings = register('voicings', function (dictionary, pat) {
|
||||
*
|
||||
* @name rootNotes
|
||||
* @tags tonal
|
||||
* @memberof Pattern
|
||||
* @memberof Pattern.prototype
|
||||
* @param {octave} octave octave to use
|
||||
* @returns Pattern
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* "<C^7 A7 Dm7 G7>".rootNotes(2).note()
|
||||
*/
|
||||
@@ -196,7 +195,7 @@ export const rootNotes = register('rootNotes', function (octave, pat) {
|
||||
*
|
||||
* @name voicing
|
||||
* @tags tonal
|
||||
* @returns Pattern
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* n("0 1 2 3").chord("<C Am F G>").voicing()
|
||||
*/
|
||||
|
||||
@@ -99,12 +99,14 @@ 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
|
||||
* @param {string} color line color as hex or color name. defaults to white.
|
||||
* @param {number} scale scales the y-axis. Defaults to 0.25
|
||||
* @param {number} pos y-position relative to screen height. 0 = top, 1 = bottom of screen
|
||||
* @param {number} lean y-axis alignment where 0 = top and 1 = bottom
|
||||
* @param {number} min min value
|
||||
* @param {number} max max value
|
||||
* @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
|
||||
* @param {number} config.pos y-position relative to screen height. 0 = top, 1 = bottom of screen
|
||||
* @param {number} config.lean y-axis alignment where 0 = top and 1 = bottom
|
||||
* @param {number} config.min min value
|
||||
* @param {number} config.max max value
|
||||
* @returns {Pattern}
|
||||
* @example
|
||||
* s("sawtooth").fscope()
|
||||
*/
|
||||
|
||||
@@ -7,10 +7,10 @@ import { analysers, getAnalyzerData } from 'superdough';
|
||||
* @name spectrum
|
||||
* @tags visualization
|
||||
* @param {object} config optional config with options:
|
||||
* @param {integer} thickness line thickness in px (default 3)
|
||||
* @param {integer} speed scroll speed (default 1)
|
||||
* @param {integer} min min db (default -80)
|
||||
* @param {integer} max max db (default 0)
|
||||
* @param {number} [thickness=3] line thickness in px (default 3)
|
||||
* @param {number} [speed=1] scroll speed (default 1)
|
||||
* @param {number} [min=-80] min db (default -80)
|
||||
* @param {number} [max=0] max db (default 0)
|
||||
* @example
|
||||
* n("<0 4 <2 3> 1>*3")
|
||||
* .off(1/8, add(n(5)))
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
# @strudel/websocket
|
||||
|
||||
This package adds websocket input to strudel Patterns.
|
||||
|
||||
It connects to a websocket server and exposes the latest received value (parsed as JSON) as a pattern.
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
import './websocket.mjs';
|
||||
|
||||
export * from './websocket.mjs';
|
||||
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"name": "@strudel/websocket",
|
||||
"version": "1.0.0",
|
||||
"description": "Websocket input for strudel",
|
||||
"main": "index.mjs",
|
||||
"type": "module",
|
||||
"publishConfig": {
|
||||
"main": "dist/index.mjs"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "vite build",
|
||||
"prepublishOnly": "npm run build"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://codeberg.org/uzu/strudel.git"
|
||||
},
|
||||
"keywords": [
|
||||
"tidalcycles",
|
||||
"strudel",
|
||||
"pattern",
|
||||
"livecoding",
|
||||
"algorave"
|
||||
],
|
||||
"author": "Alex McLean <alex@slab.org>",
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"bugs": {
|
||||
"url": "https://codeberg.org/uzu/strudel/issues"
|
||||
},
|
||||
"homepage": "https://codeberg.org/uzu/strudel#readme",
|
||||
"dependencies": {
|
||||
"@strudel/core": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"vite": "^6.0.11"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import { dependencies } from './package.json';
|
||||
import { resolve } from 'path';
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [],
|
||||
build: {
|
||||
lib: {
|
||||
entry: resolve(__dirname, 'index.mjs'),
|
||||
formats: ['es'],
|
||||
fileName: (ext) => ({ es: 'index.mjs' })[ext],
|
||||
},
|
||||
rollupOptions: {
|
||||
external: [...Object.keys(dependencies)],
|
||||
},
|
||||
target: 'esnext',
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
websocket.mjs - simple websocket client as a pattern
|
||||
Copyright (C) 2026 Strudel contributors -- see <https://codeberg.org/uzu/strudel/src/branch/main/packages/websocket/websocket.mjs>
|
||||
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { logger, signal } from '@strudel/core';
|
||||
|
||||
const connections = {};
|
||||
const values = {};
|
||||
|
||||
function connect(addr) {
|
||||
if (connections[addr]) {
|
||||
return connections[addr];
|
||||
}
|
||||
const ws = new WebSocket(addr);
|
||||
connections[addr] = ws;
|
||||
ws.addEventListener('open', () => {
|
||||
logger(`[websocket] connected to ${addr}`);
|
||||
});
|
||||
ws.addEventListener('message', (event) => {
|
||||
try {
|
||||
console.log(event.data);
|
||||
values[addr] = JSON.parse(event.data);
|
||||
} catch {
|
||||
logger(`[websocket] received invalid json on ${addr}`);
|
||||
}
|
||||
});
|
||||
ws.addEventListener('close', () => {
|
||||
logger(`[websocket] disconnected from ${addr}`);
|
||||
delete connections[addr];
|
||||
});
|
||||
ws.addEventListener('error', () => {
|
||||
logger(`[websocket] failed to connect to ${addr}`);
|
||||
delete connections[addr];
|
||||
});
|
||||
return ws;
|
||||
}
|
||||
|
||||
export function websocket(addr) {
|
||||
connect(addr);
|
||||
return signal(() => values[addr] ?? {});
|
||||
}
|
||||
@@ -12,8 +12,8 @@ import { register } from '@strudel/core';
|
||||
*
|
||||
* Assumes pattern contains numerical scale degrees on the `i` control (see examples below). Accepts a scale name or list of frequencies (see all available names at the link on the reference). Returns a new pattern with all values mapped to a frequency ratio. Similar to `xen`.
|
||||
* @name tune
|
||||
* @returns Pattern
|
||||
* @memberof Pattern
|
||||
* @returns {Pattern}
|
||||
* @memberof Pattern.prototype
|
||||
* @param {(string | number[] )} scale
|
||||
* @deprecated
|
||||
* @example
|
||||
|
||||
@@ -65,8 +65,8 @@ const trimFreq = (freq) => parseFloat(freq.toPrecision(10));
|
||||
* Assumes a numerical pattern of scale steps, and a scale. Scales accepted are all preset scale names of `tune`, arbitrary edos such as 31edo, or an array of frequency ratios. Assumes scales repeat at octave (2/1). Returns a new pattern with all values mapped to their associated frequency, assuming a base frequency of 220hz. See first 4 examples for the different ways you can input a scale into `xen`
|
||||
*
|
||||
* @name xen
|
||||
* @returns Pattern
|
||||
* @memberof Pattern
|
||||
* @returns {Pattern}
|
||||
* @memberof Pattern.prototype
|
||||
* @param {(string | number[] )} scaleNameOrRatios
|
||||
* @tags tonal
|
||||
* @example
|
||||
@@ -200,16 +200,16 @@ export const xen = register(
|
||||
* but you can specify a different original base with the standard optional array syntax '`:`'
|
||||
* @name withBase
|
||||
* @param {number} base
|
||||
* @param {number} (optional) originalBase
|
||||
* @param {number} [originalBase]
|
||||
* @tags tonal
|
||||
*
|
||||
* @memberof Pattern.prototype
|
||||
* @example
|
||||
* i("[0 1 2 3] [3 4] [4 3 2 1]").xen("hexany23").withBase("<220 [300 200]>")
|
||||
* @example
|
||||
* mini([1 / 1, 16 / 15, 9 / 8, 6 / 5, 5 / 4].join(' ')).withBase("220:1")
|
||||
* // mini([1 / 1, 16 / 15, 9 / 8, 6 / 5, 5 / 4].join(' ')).mul(220).freq()
|
||||
*
|
||||
* @returns Pattern
|
||||
* @returns {Pattern}
|
||||
*/
|
||||
export const withBase = register('withBase', (b, pat) => {
|
||||
let base;
|
||||
@@ -246,6 +246,7 @@ export const withBase = register('withBase', (b, pat) => {
|
||||
* @tags tonal
|
||||
* @param {number} amt
|
||||
* @param {number} edoSize (optional)
|
||||
* @memberof Pattern.prototype
|
||||
* @returns {Pattern}
|
||||
*
|
||||
* @example
|
||||
|
||||
Generated
+432
-40
@@ -84,6 +84,9 @@ importers:
|
||||
eslint-plugin-import:
|
||||
specifier: ^2.31.0
|
||||
version: 2.31.0(eslint@9.19.0(jiti@2.4.2))
|
||||
eslint-plugin-jsdoc:
|
||||
specifier: ^65.5.3
|
||||
version: 65.5.3(eslint@9.19.0(jiti@2.4.2))(typescript@5.7.3)
|
||||
events:
|
||||
specifier: ^3.3.0
|
||||
version: 3.3.0
|
||||
@@ -255,6 +258,9 @@ importers:
|
||||
|
||||
packages/core:
|
||||
dependencies:
|
||||
'@strudel/pattern':
|
||||
specifier: workspace:*
|
||||
version: link:../pattern
|
||||
fraction.js:
|
||||
specifier: ^5.2.1
|
||||
version: 5.2.1
|
||||
@@ -407,9 +413,9 @@ importers:
|
||||
|
||||
packages/mini:
|
||||
dependencies:
|
||||
'@strudel/core':
|
||||
'@strudel/pattern':
|
||||
specifier: workspace:*
|
||||
version: link:../core
|
||||
version: link:../pattern
|
||||
devDependencies:
|
||||
peggy:
|
||||
specifier: ^4.2.0
|
||||
@@ -497,6 +503,19 @@ importers:
|
||||
specifier: ^6.0.11
|
||||
version: 6.0.11(@types/node@22.10.10)(jiti@2.4.2)(lightningcss@1.29.1)(terser@5.37.0)(yaml@2.7.0)
|
||||
|
||||
packages/pattern:
|
||||
dependencies:
|
||||
fraction.js:
|
||||
specifier: ^5.2.1
|
||||
version: 5.2.1
|
||||
devDependencies:
|
||||
vite:
|
||||
specifier: ^6.0.11
|
||||
version: 6.0.11(@types/node@22.10.10)(jiti@2.4.2)(lightningcss@1.29.1)(terser@5.37.0)(yaml@2.7.0)
|
||||
vitest:
|
||||
specifier: ^3.0.4
|
||||
version: 3.0.4(@types/debug@4.1.12)(@types/node@22.10.10)(@vitest/ui@3.0.4)(jiti@2.4.2)(lightningcss@1.29.1)(terser@5.37.0)(yaml@2.7.0)
|
||||
|
||||
packages/reference:
|
||||
devDependencies:
|
||||
vite:
|
||||
@@ -538,6 +557,9 @@ importers:
|
||||
'@strudel/webaudio':
|
||||
specifier: workspace:*
|
||||
version: link:../webaudio
|
||||
'@strudel/websocket':
|
||||
specifier: workspace:*
|
||||
version: link:../websocket
|
||||
devDependencies:
|
||||
'@rollup/plugin-replace':
|
||||
specifier: ^6.0.2
|
||||
@@ -722,6 +744,16 @@ importers:
|
||||
specifier: ^6.0.11
|
||||
version: 6.0.11(@types/node@22.10.10)(jiti@2.4.2)(lightningcss@1.29.1)(terser@5.37.0)(yaml@2.7.0)
|
||||
|
||||
packages/websocket:
|
||||
dependencies:
|
||||
'@strudel/core':
|
||||
specifier: workspace:*
|
||||
version: link:../core
|
||||
devDependencies:
|
||||
vite:
|
||||
specifier: ^6.0.11
|
||||
version: 6.0.11(@types/node@22.10.10)(jiti@2.4.2)(lightningcss@1.29.1)(terser@5.37.0)(yaml@2.7.0)
|
||||
|
||||
packages/xen:
|
||||
dependencies:
|
||||
'@strudel/core':
|
||||
@@ -857,6 +889,9 @@ importers:
|
||||
'@strudel/webaudio':
|
||||
specifier: workspace:*
|
||||
version: link:../packages/webaudio
|
||||
'@strudel/websocket':
|
||||
specifier: workspace:*
|
||||
version: link:../packages/websocket
|
||||
'@strudel/xen':
|
||||
specifier: workspace:*
|
||||
version: link:../packages/xen
|
||||
@@ -1660,6 +1695,27 @@ packages:
|
||||
'@emnapi/wasi-threads@1.0.1':
|
||||
resolution: {integrity: sha512-iIBu7mwkq4UQGeMEM8bLwNK962nXdhodeScX4slfQnRhEMMzvYivHhutCIk8uojvmASXXPC2WNEjwxFWk72Oqw==}
|
||||
|
||||
'@es-joy/escodegen@5.0.1':
|
||||
resolution: {integrity: sha512-0sOnDSVMt7Zg5qmXz4ab1yOXrUi0QmSPqpm5d547puNdJxT0J+Xdip2F/5j07nuE1pW131AX5jFUvOIfZPYNRg==}
|
||||
engines: {node: ^22.16.0 || >=24.0.0}
|
||||
hasBin: true
|
||||
|
||||
'@es-joy/estraverse@7.1.1':
|
||||
resolution: {integrity: sha512-h2d737iS0LFAqypZOmXizu54qAbHofI/RpD30Zom03O6BCXKHuFevWKPcGarZbGq82h7qSBb5G6kLdhTMO+caw==}
|
||||
engines: {node: '>=4.0'}
|
||||
|
||||
'@es-joy/esutils@3.0.0':
|
||||
resolution: {integrity: sha512-K8M2b2ixqOiF5B+qYJIWIznFtvbD8biX2mj31pXmXAaTRUUd2x6anAFZk4GVGXz7sX9tOkx+z6TaQc/paeVCeg==}
|
||||
engines: {node: ^22.16.0 || >=24.0.0}
|
||||
|
||||
'@es-joy/jsdoccomment@1.2.0':
|
||||
resolution: {integrity: sha512-EcF8gDd175MRIYEt7ktoe9AUijBba3SSSvnGJ96HQaK1BxjVK8l1QdksVEAY34Lp0byn51FnTszlVMYmD5TI/w==}
|
||||
engines: {node: ^22.22.2 || >=24.15.0}
|
||||
|
||||
'@es-joy/resolve.exports@1.2.0':
|
||||
resolution: {integrity: sha512-Q9hjxWI5xBM+qW2enxfe8wDKdFWMfd0Z29k5ZJnuBqD/CasY5Zryj09aCA6owbGATWz+39p5uIdaHXpopOcG8g==}
|
||||
engines: {node: '>=10'}
|
||||
|
||||
'@esbuild/aix-ppc64@0.24.2':
|
||||
resolution: {integrity: sha512-thpVCb/rhxE/BnMLQ7GReQLLN8q9qbHmI55F4489/ByVg2aQaQ6kbcLb6FHkocZzQhxc4gx0sCk0tJkKBFzDhA==}
|
||||
engines: {node: '>=18'}
|
||||
@@ -1810,6 +1866,12 @@ packages:
|
||||
cpu: [x64]
|
||||
os: [win32]
|
||||
|
||||
'@eslint-community/eslint-utils@4.10.1':
|
||||
resolution: {integrity: sha512-cuadcxVFE8sDK6iWJbs8Sn0av2Nrh2QSGQhVlBW9AaAHqHwjWsZHT8LJ4hFGPh7ASBV2deFdM7H/DPjulmh8rg==}
|
||||
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
|
||||
peerDependencies:
|
||||
eslint: ^6.0.0 || ^7.0.0 || >=8.0.0
|
||||
|
||||
'@eslint-community/eslint-utils@4.4.1':
|
||||
resolution: {integrity: sha512-s3O3waFUrMV8P/XaF/+ZTp1X9XBZW1a4B97ZnjQF2KYWaFD2A8KyFBsrsfSjEmjn3RGWAIuvlneuZm3CUK3jbA==}
|
||||
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
|
||||
@@ -2019,6 +2081,9 @@ packages:
|
||||
resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==}
|
||||
engines: {node: '>=12'}
|
||||
|
||||
'@isaacs/nonrecursive-glob-match@1.1.0':
|
||||
resolution: {integrity: sha512-GPm/Dbvk5RLmhRnxXIa7nTpK0xtl4E0wj0MslsuNiJ1FIROU+2+9lgUC/dgF7Ey4QCWhfEsgxilMRMCdHPfDfw==}
|
||||
|
||||
'@isaacs/string-locale-compare@1.1.0':
|
||||
resolution: {integrity: sha512-SQ7Kzhh9+D+ZW9MA0zkYv3VXhIDNx+LzM6EJ+/65I3QY+enU6Itte7E5XX7EWrqLW2FN4n06GWzBnPoC3th2aQ==}
|
||||
|
||||
@@ -2640,6 +2705,10 @@ packages:
|
||||
'@sinclair/typebox@0.27.8':
|
||||
resolution: {integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==}
|
||||
|
||||
'@sindresorhus/base62@1.0.0':
|
||||
resolution: {integrity: sha512-TeheYy0ILzBEI/CO55CP6zJCSdSWeRtGnHy8U8dWSUH4I68iqTsy7HkMktR4xakThc9jotkPQUXT4ITdbV7cHA==}
|
||||
engines: {node: '>=18'}
|
||||
|
||||
'@supabase/auth-js@2.67.3':
|
||||
resolution: {integrity: sha512-NJDaW8yXs49xMvWVOkSIr8j46jf+tYHV0wHhrwOaLLMZSFO4g6kKAf+MfzQ2RaD06OCUkUHIzctLAxjTgEVpzw==}
|
||||
|
||||
@@ -2968,6 +3037,9 @@ packages:
|
||||
'@types/estree@0.0.39':
|
||||
resolution: {integrity: sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==}
|
||||
|
||||
'@types/estree@1.0.10':
|
||||
resolution: {integrity: sha512-lTyOMnOcmRBzdCv6/4zUZCrEhV0xrqQiUZBZtVcbmLHBXKLnN8q89v/wKRF/Q0HbwVsqbIG3o5HDoFl9sduM+g==}
|
||||
|
||||
'@types/estree@1.0.6':
|
||||
resolution: {integrity: sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==}
|
||||
|
||||
@@ -3048,10 +3120,30 @@ packages:
|
||||
'@types/ws@8.5.14':
|
||||
resolution: {integrity: sha512-bd/YFLW+URhBzMXurx7lWByOu+xzU9+kb3RboOteXYDfW+tr+JZa99OyNmPINEGB/ahzKrEuc8rcv4gnpJmxTw==}
|
||||
|
||||
'@typescript-eslint/project-service@8.73.0':
|
||||
resolution: {integrity: sha512-/pEf8Rc4Mjk+qJnY0uO1+Gadeal8uv50xpuic+srG2vIVatA0XxvWMUeMtFvs6OCHqftiQ7/+qH4aehG5stzIA==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
peerDependencies:
|
||||
typescript: '>=4.8.4 <6.1.0'
|
||||
|
||||
'@typescript-eslint/scope-manager@8.73.0':
|
||||
resolution: {integrity: sha512-/TjD738Iq2rzj5z0ixVOi+TsvgjAzZPLPaH1yWdDBytR/HTR5gMpyYWZeCe5WTQZLwk3ho8AV7U3muoQCRtXBQ==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
|
||||
'@typescript-eslint/tsconfig-utils@8.73.0':
|
||||
resolution: {integrity: sha512-lmtCFOfYaJfpqZywGuXi4FpNtE+NQ+YLe3T0K9rtEDcW8ZuGWvfI++pj8r05sYMI8vWT2CYK4rWyedmD6Rp4og==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
peerDependencies:
|
||||
typescript: '>=4.8.4 <6.1.0'
|
||||
|
||||
'@typescript-eslint/types@7.18.0':
|
||||
resolution: {integrity: sha512-iZqi+Ds1y4EDYUtlOOC+aUmxnE9xS/yCigkjA7XpTKV6nCBd3Hp/PRGGmdwnfkV2ThMyYldP1wRpm/id99spTQ==}
|
||||
engines: {node: ^18.18.0 || >=20.0.0}
|
||||
|
||||
'@typescript-eslint/types@8.73.0':
|
||||
resolution: {integrity: sha512-O/1ytYzflF16QDKXx4/qOXg1IuZp+n7hr9t+S0nv7N/2Tl8rJiNCshztV1gcSUvHbPtoX3+zmNbtSAyVbzxVfw==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
|
||||
'@typescript-eslint/typescript-estree@7.18.0':
|
||||
resolution: {integrity: sha512-aP1v/BSPnnyhMHts8cf1qQ6Q1IFwwRvAQGRvBFkWlo3/lH29OXA3Pts+c10nxRxIBrDnoMqzhgdwVe5f2D6OzA==}
|
||||
engines: {node: ^18.18.0 || >=20.0.0}
|
||||
@@ -3061,10 +3153,31 @@ packages:
|
||||
typescript:
|
||||
optional: true
|
||||
|
||||
'@typescript-eslint/typescript-estree@8.73.0':
|
||||
resolution: {integrity: sha512-InjlBkSdWceIwIBWSwS3ENUp+i0O02PGX3Zv2wnihWJC1WDVGvG7mTHuf8b57uAaITj94d6tRPDH+sUEtXdRQQ==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
peerDependencies:
|
||||
'@typescript/native': npm:typescript@>=7.1.0-dev.20261009.1 || >=7.1.0-beta <7.1.0-dev
|
||||
typescript: '>=4.8.4 <6.1.0'
|
||||
peerDependenciesMeta:
|
||||
'@typescript/native':
|
||||
optional: true
|
||||
|
||||
'@typescript-eslint/utils@8.73.0':
|
||||
resolution: {integrity: sha512-j2SVJJvVkXdUL0WcEzo4vEH1mO1vIi8KlVukcYA2MgMZvYN2LlZR4PmsW+GTSxSW24j6Q/EP7+MOifLtg5hmsA==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
peerDependencies:
|
||||
eslint: ^8.57.0 || ^9.0.0 || ^10.0.0
|
||||
typescript: '>=4.8.4 <6.1.0'
|
||||
|
||||
'@typescript-eslint/visitor-keys@7.18.0':
|
||||
resolution: {integrity: sha512-cDF0/Gf81QpY3xYyJKDV14Zwdmid5+uuENhjH2EqFaF0ni+yAyq/LzMaIJdhNJXZI7uLzwIlA+V7oWoyn6Curg==}
|
||||
engines: {node: ^18.18.0 || >=20.0.0}
|
||||
|
||||
'@typescript-eslint/visitor-keys@8.73.0':
|
||||
resolution: {integrity: sha512-k4lsFVpRZICbltkIEEH4hZRkwXkqDF1GHBpClKQOHQY+RkoZAAuyc1ci3I6p+CB6v3U4jaHIUshc4RzzQXZWLg==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
|
||||
'@ungap/structured-clone@1.3.0':
|
||||
resolution: {integrity: sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==}
|
||||
deprecated: Potential CWE-502 - Update to 1.3.1 or higher
|
||||
@@ -3172,6 +3285,11 @@ packages:
|
||||
engines: {node: '>=0.4.0'}
|
||||
hasBin: true
|
||||
|
||||
acorn@8.19.0:
|
||||
resolution: {integrity: sha512-oJlA3XiRm7Cyk6qFD2Jn8ak9B7jSy0qy00ADO3+8dpT0LSjFihQYv4C02LFCSYJV3Q37xYwwRy5m+IpIiUzqWw==}
|
||||
engines: {node: '>=0.4.0'}
|
||||
hasBin: true
|
||||
|
||||
add-stream@1.0.0:
|
||||
resolution: {integrity: sha512-qQLMr+8o0WC4FZGQTcJiKBVC59JylcPSrTtk6usvmIDFUOCKegapy1VHQwRbFMOFyb/inzUVqHs+eMYKDM1YeQ==}
|
||||
|
||||
@@ -3249,6 +3367,10 @@ packages:
|
||||
aproba@2.0.0:
|
||||
resolution: {integrity: sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==}
|
||||
|
||||
are-docs-informative@0.1.1:
|
||||
resolution: {integrity: sha512-sqRsNQBwbKLRX0jV5Cu5uzmtflf892n4Vukz7T659ebL4pz3mpOqCMU7lxMoBTFwnp10E3YB5ZcyHM41W5bcDA==}
|
||||
engines: {node: '>=18'}
|
||||
|
||||
arg@5.0.2:
|
||||
resolution: {integrity: sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==}
|
||||
|
||||
@@ -3388,6 +3510,10 @@ packages:
|
||||
balanced-match@1.0.2:
|
||||
resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==}
|
||||
|
||||
balanced-match@4.0.4:
|
||||
resolution: {integrity: sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==}
|
||||
engines: {node: 18 || 20 || >=22}
|
||||
|
||||
base-64@1.0.0:
|
||||
resolution: {integrity: sha512-kwDPIFCGx0NZHog36dj+tHiwP4QMzsZ3AgMViUBKI0+V5n4U0ufTCUMhnQ04diaRI8EX/QcPfql7zlhZ7j4zgg==}
|
||||
|
||||
@@ -3421,6 +3547,10 @@ packages:
|
||||
brace-expansion@2.0.1:
|
||||
resolution: {integrity: sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==}
|
||||
|
||||
brace-expansion@5.0.13:
|
||||
resolution: {integrity: sha512-Vh3dmFbc4wZeox7M9I/0L9GfFd83Su4+yCck/OF9Gi/P/dAHn0RT7X4K9R7gMNMhDck3DvhR6QXsnQdjjgwNvQ==}
|
||||
engines: {node: 20 || >=22}
|
||||
|
||||
braces@3.0.3:
|
||||
resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==}
|
||||
engines: {node: '>=8'}
|
||||
@@ -3606,6 +3736,7 @@ packages:
|
||||
clone-buffer@1.0.0:
|
||||
resolution: {integrity: sha512-KLLTJWrvwIP+OPfMn0x2PheDEP20RPUcGXj/ERegTgdmPEZylALQldygiqrPPu8P45uNuPs7ckmReLY6v/iA5g==}
|
||||
engines: {node: '>= 0.10'}
|
||||
deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
|
||||
|
||||
clone-deep@4.0.1:
|
||||
resolution: {integrity: sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==}
|
||||
@@ -3679,6 +3810,10 @@ packages:
|
||||
resolution: {integrity: sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==}
|
||||
engines: {node: '>= 6'}
|
||||
|
||||
comment-parser@1.4.9:
|
||||
resolution: {integrity: sha512-+2AvZKjJaNq9GQljm3tr0utwrig5BL+jgJGvz5rDpGKNIp+ojcRXWUwBbh/sGIi1QCprR6PsKFakub+w1v+4hQ==}
|
||||
engines: {node: '>= 12.0.0'}
|
||||
|
||||
common-ancestor-path@1.0.1:
|
||||
resolution: {integrity: sha512-L3sHRo1pXXEqX8VU28kfgUY+YGsk09hPqZiZmLacNib6XNTCM8ubYeT7ryXQw8asB1sKgcU5lkB7ONug08aB8w==}
|
||||
|
||||
@@ -3864,6 +3999,15 @@ packages:
|
||||
supports-color:
|
||||
optional: true
|
||||
|
||||
debug@4.4.3:
|
||||
resolution: {integrity: sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==}
|
||||
engines: {node: '>=6.0'}
|
||||
peerDependencies:
|
||||
supports-color: '*'
|
||||
peerDependenciesMeta:
|
||||
supports-color:
|
||||
optional: true
|
||||
|
||||
decamelize-keys@1.1.1:
|
||||
resolution: {integrity: sha512-WiPxgEirIV0/eIOMcnFBA3/IJZAZqKnwAwWyvvdi4lsr1WCN22nhdf/3db3DoZcUjTV2SqfzIwNyp6y2xs3nmg==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
@@ -4219,6 +4363,16 @@ packages:
|
||||
'@typescript-eslint/parser':
|
||||
optional: true
|
||||
|
||||
eslint-plugin-jsdoc@65.5.3:
|
||||
resolution: {integrity: sha512-w1BF4iconGSedJPeRymmGc2dyG3nyAT004I+Vf1vPF/W2c/eJhbOdp0kTWoLCTdtIKq5xw6dezR8+jqSU9/Cvw==}
|
||||
engines: {node: ^22.22.2 || >=24.15.0}
|
||||
peerDependencies:
|
||||
eslint: ^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0
|
||||
typescript: '*'
|
||||
peerDependenciesMeta:
|
||||
typescript:
|
||||
optional: true
|
||||
|
||||
eslint-plugin-n@15.7.0:
|
||||
resolution: {integrity: sha512-jDex9s7D/Qial8AGVIHq4W7NswpUD5DPDL2RH8Lzd9EloWUuvUkHfv4FRLMipH5q2UtyurorBkPeNi1wVWNh3Q==}
|
||||
engines: {node: '>=12.22.0'}
|
||||
@@ -4255,9 +4409,14 @@ packages:
|
||||
resolution: {integrity: sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
|
||||
eslint-visitor-keys@5.0.1:
|
||||
resolution: {integrity: sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==}
|
||||
engines: {node: ^20.19.0 || ^22.13.0 || >=24}
|
||||
|
||||
eslint@9.19.0:
|
||||
resolution: {integrity: sha512-ug92j0LepKlbbEv6hD911THhoRHmbdXt2gX+VDABAW/Ir7D3nqKdv5Pf5vtlyY6HQMTEP2skXY43ueqTCWssEA==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
deprecated: This version is no longer supported. Please see https://eslint.org/version-support for other options.
|
||||
hasBin: true
|
||||
peerDependencies:
|
||||
jiti: '*'
|
||||
@@ -4269,6 +4428,10 @@ packages:
|
||||
resolution: {integrity: sha512-0QYC8b24HWY8zjRnDTL6RiHfDbAWn63qb4LMj1Z4b076A4une81+z03Kg7l7mn/48PUTqoLptSXez8oknU8Clg==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
|
||||
espree@11.2.0:
|
||||
resolution: {integrity: sha512-7p3DrVEIopW1B1avAGLuCSh1jubc01H2JHc8B4qqGblmg5gI9yumBgACjWo4JlIc04ufug4xJ3SQI8HkS/Rgzw==}
|
||||
engines: {node: ^20.19.0 || ^22.13.0 || >=24}
|
||||
|
||||
esprima@4.0.1:
|
||||
resolution: {integrity: sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==}
|
||||
engines: {node: '>=4'}
|
||||
@@ -4278,6 +4441,10 @@ packages:
|
||||
resolution: {integrity: sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==}
|
||||
engines: {node: '>=0.10'}
|
||||
|
||||
esquery@1.7.0:
|
||||
resolution: {integrity: sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g==}
|
||||
engines: {node: '>=0.10'}
|
||||
|
||||
esrecurse@4.3.0:
|
||||
resolution: {integrity: sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==}
|
||||
engines: {node: '>=4.0'}
|
||||
@@ -4388,6 +4555,15 @@ packages:
|
||||
picomatch:
|
||||
optional: true
|
||||
|
||||
fdir@6.5.0:
|
||||
resolution: {integrity: sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==}
|
||||
engines: {node: '>=12.0.0'}
|
||||
peerDependencies:
|
||||
picomatch: ^3 || ^4
|
||||
peerDependenciesMeta:
|
||||
picomatch:
|
||||
optional: true
|
||||
|
||||
fetch-blob@3.2.0:
|
||||
resolution: {integrity: sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==}
|
||||
engines: {node: ^12.20 || >= 14.13}
|
||||
@@ -4799,6 +4975,9 @@ packages:
|
||||
hs2js@0.1.0:
|
||||
resolution: {integrity: sha512-THlUIMX8tZf6gtbz5RUZ8xQUyKJEItsx7bxEBcouFIEWjeo90376WMocj3JEz6qTv5nM+tjo3vNvLf89XruMvg==}
|
||||
|
||||
html-entities@2.6.0:
|
||||
resolution: {integrity: sha512-kig+rMn/QOVRvr7c86gQ8lWXq+Hkv6CbAH1hLu+RG338StTpE8Z0b44SDVaqVu7HGKf27frdmUYEs9hTUX/cLQ==}
|
||||
|
||||
html-escaper@2.0.2:
|
||||
resolution: {integrity: sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==}
|
||||
|
||||
@@ -5220,6 +5399,10 @@ packages:
|
||||
jsdoc-json@2.0.2:
|
||||
resolution: {integrity: sha512-n0vVkWvBMHFNUsW6HUhMrVCk+nJZwW3kpd9/JiCgdYvjjZV3NcP5fV3+lTgOkOA/bTKJxbCKT8Au92FHII3pnA==}
|
||||
|
||||
jsdoc-type-pratt-parser@9.5.0:
|
||||
resolution: {integrity: sha512-Qu/AuBJocEUhxq187P4Ud7xGBHB+NhtrclSrS7Utkr6uNeeh8BrZ5+Ax/AGe8VXQLGY+4oYgbUp04hY8iGsIWA==}
|
||||
engines: {node: ^22.22.2 || >=24.15.0}
|
||||
|
||||
jsdoc@4.0.4:
|
||||
resolution: {integrity: sha512-zeFezwyXeG4syyYHbvh1A967IAqq/67yXtXvuL5wnqCkFZe8I0vKfm+EO+YEvLguo6w9CDUbrAXVtJSHh2E8rw==}
|
||||
engines: {node: '>=12.0.0'}
|
||||
@@ -5462,9 +5645,6 @@ packages:
|
||||
lodash.merge@4.6.2:
|
||||
resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==}
|
||||
|
||||
lodash.sortby@4.7.0:
|
||||
resolution: {integrity: sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA==}
|
||||
|
||||
lodash@4.17.21:
|
||||
resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==}
|
||||
|
||||
@@ -5756,6 +5936,10 @@ packages:
|
||||
resolution: {integrity: sha512-r9deDe9p5FJUPZAk3A59wGH7Ii9YrjjWw0jmw/liSbHl2CHiyXj6FcDXDu2K3TjVAXqiJdaw3xxwlZZr9E6nHg==}
|
||||
hasBin: true
|
||||
|
||||
minimatch@11.0.9:
|
||||
resolution: {integrity: sha512-KCFkfyjqerNlSstjlhIGNXIKZGA/6O4V4RlhZ+Dsr621SPPw0mzlypE9D9ZOoPiVefHID+j7/XuMMlqfD/F60Q==}
|
||||
engines: {node: 20 || >=22}
|
||||
|
||||
minimatch@3.0.5:
|
||||
resolution: {integrity: sha512-tUpxzX0VAzJHjLu0xUfFv1gwVp9ba3IOuRAVH2EGuRW8a5emA2FlACLqiT/lDVtS1W+TGNwqz3sWaNyLgDJWuw==}
|
||||
|
||||
@@ -6055,6 +6239,9 @@ packages:
|
||||
resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
||||
object-deep-merge@2.0.1:
|
||||
resolution: {integrity: sha512-aKttDKcU3pyZqKcCkDhsMn70WmZFG2JGDQLP9EcLyTSIFQRCPWLAmBZRLJnrVUrhPG1jETEEbfdgbNtJf1LyMg==}
|
||||
|
||||
object-hash@3.0.0:
|
||||
resolution: {integrity: sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw==}
|
||||
engines: {node: '>= 6'}
|
||||
@@ -6231,6 +6418,9 @@ packages:
|
||||
parse-entities@4.0.2:
|
||||
resolution: {integrity: sha512-GG2AQYWoLgL877gQIKeRPGO1xF9+eG1ujIb5soS5gPvLQ1y2o8FL90w2QWNdf9I361Mpp7726c+lj3U0qK1uGw==}
|
||||
|
||||
parse-imports-exports@0.2.4:
|
||||
resolution: {integrity: sha512-4s6vd6dx1AotCx/RCI2m7t7GCh5bDRUtGNvRfHSP2wbBQdMi67pPe7mtzmgwcaQ8VKK/6IB7Glfyu3qdZJPybQ==}
|
||||
|
||||
parse-json@4.0.0:
|
||||
resolution: {integrity: sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw==}
|
||||
engines: {node: '>=4'}
|
||||
@@ -6245,6 +6435,9 @@ packages:
|
||||
parse-path@7.0.0:
|
||||
resolution: {integrity: sha512-Euf9GG8WT9CdqwuWJGdf3RkUcTBArppHABkO7Lm8IzRQp0e2r/kkFnmhu4TSK30Wcu5rVAZLmfPKSBBi9tWFog==}
|
||||
|
||||
parse-statements@1.0.11:
|
||||
resolution: {integrity: sha512-HlsyYdMBnbPQ9Jr/VgJ1YF4scnldvJpJxCVx6KgqPL4dxppsWrJHCIIxQXMJrqGnsRkNPATbeMJ8Yxu7JMsYcA==}
|
||||
|
||||
parse-url@8.1.0:
|
||||
resolution: {integrity: sha512-xDvOoLU5XRrcOZvnI6b8zA6n9O9ejNk/GExuz1yBuWUGn9KA97GI6HTs6u02wKara1CeVmZhH+0TZFdWScR89w==}
|
||||
|
||||
@@ -6314,6 +6507,10 @@ packages:
|
||||
resolution: {integrity: sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==}
|
||||
engines: {node: '>=12'}
|
||||
|
||||
picomatch@4.0.7:
|
||||
resolution: {integrity: sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==}
|
||||
engines: {node: '>=12'}
|
||||
|
||||
pify@2.3.0:
|
||||
resolution: {integrity: sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
@@ -6749,6 +6946,10 @@ packages:
|
||||
requizzle@0.2.4:
|
||||
resolution: {integrity: sha512-JRrFk1D4OQ4SqovXOgdav+K8EAhSB/LJZqCz8tbX0KObcdeM15Ss59ozWMBWmmINMagCwmqn4ZNryUGpBsl6Jw==}
|
||||
|
||||
reserved-identifiers@1.2.0:
|
||||
resolution: {integrity: sha512-yE7KUfFvaBFzGPs5H3Ops1RevfUEsDc5Iz65rOwWg4lE8HJSYtle77uul3+573457oHvBKuHYDl/xqUkKpEEdw==}
|
||||
engines: {node: '>=18'}
|
||||
|
||||
resolve-cwd@3.0.0:
|
||||
resolution: {integrity: sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==}
|
||||
engines: {node: '>=8'}
|
||||
@@ -6882,6 +7083,11 @@ packages:
|
||||
engines: {node: '>=10'}
|
||||
hasBin: true
|
||||
|
||||
semver@7.8.6:
|
||||
resolution: {integrity: sha512-9lpSSU4Mly3mrtruwLs1eLK6+gzbzqeBFwRNjIjE+9LuDpWdYctrQlQ3ej1Ilgi7gknpsTRnPoLP8DpCHqHIJw==}
|
||||
engines: {node: '>=10'}
|
||||
hasBin: true
|
||||
|
||||
serialize-javascript@4.0.0:
|
||||
resolution: {integrity: sha512-GaNA54380uFefWghODBWEGisLZFj00nS5ACs6yHa9nLqlLpVLO8ChDGeKRjZnV4Nh4n0Qi7nhYZD/9fCPzEqkw==}
|
||||
|
||||
@@ -7028,10 +7234,9 @@ packages:
|
||||
resolution: {integrity: sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==}
|
||||
engines: {node: '>= 8'}
|
||||
|
||||
source-map@0.8.0-beta.0:
|
||||
resolution: {integrity: sha512-2ymg6oRBpebeZi9UUNsgQ89bhx01TcTkmNTGnNO88imTmbSgy4nfujrgVEFKWpMTEGA11EDkTt7mqObTPdigIA==}
|
||||
engines: {node: '>= 8'}
|
||||
deprecated: The work that was done in this beta branch won't be included in future versions
|
||||
source-map@0.8.0:
|
||||
resolution: {integrity: sha512-d8EqvL+k/SOXCreS/SUzg2ciyHqBBLcN/yuRjFsbvVhHTE2pgei7oAhmPM7kWFbkX6OSMQfUq4KbkF3au9lhYQ==}
|
||||
engines: {node: '>= 12'}
|
||||
|
||||
sourcemap-codec@1.4.8:
|
||||
resolution: {integrity: sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==}
|
||||
@@ -7049,6 +7254,9 @@ packages:
|
||||
spdx-expression-parse@3.0.1:
|
||||
resolution: {integrity: sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==}
|
||||
|
||||
spdx-expression-parse@5.0.0:
|
||||
resolution: {integrity: sha512-vngmw3Rgn+o2arXNbnZaj5UtOEBuWBfvaI+Wc8GFfykIhA5/vdK9/Sp/XkLv63dykz2rxKDvKEHupF5P0FORcQ==}
|
||||
|
||||
spdx-license-ids@3.0.21:
|
||||
resolution: {integrity: sha512-Bvg/8F5XephndSK3JffaRqdT+gyhfqIPwDHpX80tJrF8QQRYMo8sNMeaZ2Dp5+jhwKnUmIOyFFQfHRkjJm5nXg==}
|
||||
|
||||
@@ -7287,6 +7495,10 @@ packages:
|
||||
resolution: {integrity: sha512-Zc+8eJlFMvgatPZTl6A9L/yht8QqdmUNtURHaKZLmKBE12hNPSrqNkUp2cs3M/UKmNVVAMFQYSjYIVHDjW5zew==}
|
||||
engines: {node: '>=12.0.0'}
|
||||
|
||||
tinyglobby@0.2.17:
|
||||
resolution: {integrity: sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==}
|
||||
engines: {node: '>=12.0.0'}
|
||||
|
||||
tinypool@1.0.2:
|
||||
resolution: {integrity: sha512-al6n+QEANGFOMf/dmUMsuS5/r9B06uwlyNjZZql/zv8J7ybHCgoihBNORZCY2mzUuAnomQa2JdhyHKzZxPCrFA==}
|
||||
engines: {node: ^18.0.0 || >=20.0.0}
|
||||
@@ -7315,6 +7527,10 @@ packages:
|
||||
resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==}
|
||||
engines: {node: '>=8.0'}
|
||||
|
||||
to-valid-identifier@1.0.0:
|
||||
resolution: {integrity: sha512-41wJyvKep3yT2tyPqX/4blcfybknGB4D+oETKLs7Q76UiPqRpUJK3hr1nxelyYO0PHKVzJwlu0aCeEAsGI6rpw==}
|
||||
engines: {node: '>=20'}
|
||||
|
||||
totalist@3.0.1:
|
||||
resolution: {integrity: sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ==}
|
||||
engines: {node: '>=6'}
|
||||
@@ -7322,9 +7538,6 @@ packages:
|
||||
tr46@0.0.3:
|
||||
resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==}
|
||||
|
||||
tr46@1.0.1:
|
||||
resolution: {integrity: sha512-dTpowEjclQ7Kgx5SdBkqRzVhERQXov8/l9Ft9dVM9fmg0W0KQSVaXX9T4i6twCPNtYiZM53lpSSUAwJbFPOHxA==}
|
||||
|
||||
tree-sitter-haskell@0.23.1:
|
||||
resolution: {integrity: sha512-qG4CYhejveu9DLMLEGBz/n9/TTeGSFLC6wniwOgG6m8/v7Dng8qR0ob0EVG7+XH+9WiOxohpGA23EhceWuxY4w==}
|
||||
peerDependencies:
|
||||
@@ -7356,6 +7569,12 @@ packages:
|
||||
peerDependencies:
|
||||
typescript: '>=4.2.0'
|
||||
|
||||
ts-api-utils@2.5.0:
|
||||
resolution: {integrity: sha512-OJ/ibxhPlqrMM0UiNHJ/0CKQkoKF243/AEmplt3qpRgkW8VG7IfOS41h7V8TjITqdByHzrjcS/2si+y4lIh8NA==}
|
||||
engines: {node: '>=18.12'}
|
||||
peerDependencies:
|
||||
typescript: '>=4.8.4'
|
||||
|
||||
ts-interface-checker@0.1.13:
|
||||
resolution: {integrity: sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==}
|
||||
|
||||
@@ -7792,9 +8011,6 @@ packages:
|
||||
webidl-conversions@3.0.1:
|
||||
resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==}
|
||||
|
||||
webidl-conversions@4.0.2:
|
||||
resolution: {integrity: sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==}
|
||||
|
||||
webmidi@3.1.12:
|
||||
resolution: {integrity: sha512-X1lACggXm2BxuAPdx5wleh8S2kygduHbtR2ti5sGhivLkX6Muv/sLAYmPuIaNLOUddyxr71+3tsq8m5dKXoT4A==}
|
||||
engines: {node: '>=8.5'}
|
||||
@@ -7802,9 +8018,6 @@ packages:
|
||||
whatwg-url@5.0.0:
|
||||
resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==}
|
||||
|
||||
whatwg-url@7.1.0:
|
||||
resolution: {integrity: sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==}
|
||||
|
||||
which-boxed-primitive@1.1.1:
|
||||
resolution: {integrity: sha512-TbX3mj8n0odCBFVlY8AxkqcHASw3L60jIuF8jFP78az3C2YhmGvqbHBpAjTRH2/xqYunrJ9g1jSyjCjpoWzIAA==}
|
||||
engines: {node: '>= 0.4'}
|
||||
@@ -8394,7 +8607,7 @@ snapshots:
|
||||
'@babel/core': 7.26.7
|
||||
'@babel/helper-compilation-targets': 7.26.5
|
||||
'@babel/helper-plugin-utils': 7.26.5
|
||||
debug: 4.4.0
|
||||
debug: 4.4.3
|
||||
lodash.debounce: 4.0.8
|
||||
resolve: 1.22.10
|
||||
transitivePeerDependencies:
|
||||
@@ -9088,6 +9301,33 @@ snapshots:
|
||||
dependencies:
|
||||
tslib: 2.8.1
|
||||
|
||||
'@es-joy/escodegen@5.0.1':
|
||||
dependencies:
|
||||
'@es-joy/estraverse': 7.1.1
|
||||
'@es-joy/esutils': 3.0.0
|
||||
'@es-joy/jsdoccomment': 1.2.0
|
||||
'@types/estree': 1.0.10
|
||||
esprima: 4.0.1
|
||||
optionator: 0.9.4
|
||||
optionalDependencies:
|
||||
source-map: 0.8.0
|
||||
|
||||
'@es-joy/estraverse@7.1.1': {}
|
||||
|
||||
'@es-joy/esutils@3.0.0':
|
||||
dependencies:
|
||||
'@types/estree': 1.0.10
|
||||
|
||||
'@es-joy/jsdoccomment@1.2.0':
|
||||
dependencies:
|
||||
'@types/estree': 1.0.10
|
||||
'@typescript-eslint/types': 8.73.0
|
||||
comment-parser: 1.4.9
|
||||
esquery: 1.7.0
|
||||
jsdoc-type-pratt-parser: 9.5.0
|
||||
|
||||
'@es-joy/resolve.exports@1.2.0': {}
|
||||
|
||||
'@esbuild/aix-ppc64@0.24.2':
|
||||
optional: true
|
||||
|
||||
@@ -9163,6 +9403,11 @@ snapshots:
|
||||
'@esbuild/win32-x64@0.24.2':
|
||||
optional: true
|
||||
|
||||
'@eslint-community/eslint-utils@4.10.1(eslint@9.19.0(jiti@2.4.2))':
|
||||
dependencies:
|
||||
eslint: 9.19.0(jiti@2.4.2)
|
||||
eslint-visitor-keys: 3.4.3
|
||||
|
||||
'@eslint-community/eslint-utils@4.4.1(eslint@9.19.0(jiti@2.4.2))':
|
||||
dependencies:
|
||||
eslint: 9.19.0(jiti@2.4.2)
|
||||
@@ -9346,6 +9591,8 @@ snapshots:
|
||||
wrap-ansi: 8.1.0
|
||||
wrap-ansi-cjs: wrap-ansi@7.0.0
|
||||
|
||||
'@isaacs/nonrecursive-glob-match@1.1.0': {}
|
||||
|
||||
'@isaacs/string-locale-compare@1.1.0': {}
|
||||
|
||||
'@istanbuljs/schema@0.1.3': {}
|
||||
@@ -10149,6 +10396,8 @@ snapshots:
|
||||
|
||||
'@sinclair/typebox@0.27.8': {}
|
||||
|
||||
'@sindresorhus/base62@1.0.0': {}
|
||||
|
||||
'@supabase/auth-js@2.67.3':
|
||||
dependencies:
|
||||
'@supabase/node-fetch': 2.6.15
|
||||
@@ -10573,6 +10822,8 @@ snapshots:
|
||||
|
||||
'@types/estree@0.0.39': {}
|
||||
|
||||
'@types/estree@1.0.10': {}
|
||||
|
||||
'@types/estree@1.0.6': {}
|
||||
|
||||
'@types/hast@3.0.4':
|
||||
@@ -10644,8 +10895,28 @@ snapshots:
|
||||
dependencies:
|
||||
'@types/node': 22.10.10
|
||||
|
||||
'@typescript-eslint/project-service@8.73.0(typescript@5.7.3)':
|
||||
dependencies:
|
||||
'@typescript-eslint/tsconfig-utils': 8.73.0(typescript@5.7.3)
|
||||
'@typescript-eslint/types': 8.73.0
|
||||
debug: 4.4.3
|
||||
typescript: 5.7.3
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@typescript-eslint/scope-manager@8.73.0':
|
||||
dependencies:
|
||||
'@typescript-eslint/types': 8.73.0
|
||||
'@typescript-eslint/visitor-keys': 8.73.0
|
||||
|
||||
'@typescript-eslint/tsconfig-utils@8.73.0(typescript@5.7.3)':
|
||||
dependencies:
|
||||
typescript: 5.7.3
|
||||
|
||||
'@typescript-eslint/types@7.18.0': {}
|
||||
|
||||
'@typescript-eslint/types@8.73.0': {}
|
||||
|
||||
'@typescript-eslint/typescript-estree@7.18.0(typescript@5.7.3)':
|
||||
dependencies:
|
||||
'@typescript-eslint/types': 7.18.0
|
||||
@@ -10661,11 +10932,43 @@ snapshots:
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@typescript-eslint/typescript-estree@8.73.0(typescript@5.7.3)':
|
||||
dependencies:
|
||||
'@typescript-eslint/project-service': 8.73.0(typescript@5.7.3)
|
||||
'@typescript-eslint/tsconfig-utils': 8.73.0(typescript@5.7.3)
|
||||
'@typescript-eslint/types': 8.73.0
|
||||
'@typescript-eslint/visitor-keys': 8.73.0
|
||||
debug: 4.4.3
|
||||
minimatch: 11.0.9
|
||||
semver: 7.8.6
|
||||
tinyglobby: 0.2.17
|
||||
ts-api-utils: 2.5.0(typescript@5.7.3)
|
||||
typescript: 5.7.3
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@typescript-eslint/utils@8.73.0(eslint@9.19.0(jiti@2.4.2))(typescript@5.7.3)':
|
||||
dependencies:
|
||||
'@eslint-community/eslint-utils': 4.10.1(eslint@9.19.0(jiti@2.4.2))
|
||||
'@typescript-eslint/scope-manager': 8.73.0
|
||||
'@typescript-eslint/types': 8.73.0
|
||||
'@typescript-eslint/typescript-estree': 8.73.0(typescript@5.7.3)
|
||||
eslint: 9.19.0(jiti@2.4.2)
|
||||
typescript: 5.7.3
|
||||
transitivePeerDependencies:
|
||||
- '@typescript/native'
|
||||
- supports-color
|
||||
|
||||
'@typescript-eslint/visitor-keys@7.18.0':
|
||||
dependencies:
|
||||
'@typescript-eslint/types': 7.18.0
|
||||
eslint-visitor-keys: 3.4.3
|
||||
|
||||
'@typescript-eslint/visitor-keys@8.73.0':
|
||||
dependencies:
|
||||
'@typescript-eslint/types': 8.73.0
|
||||
eslint-visitor-keys: 5.0.1
|
||||
|
||||
'@ungap/structured-clone@1.3.0': {}
|
||||
|
||||
'@vite-pwa/astro@0.5.0(astro@5.1.9(@types/node@22.10.10)(jiti@2.4.2)(lightningcss@1.29.1)(rollup@2.79.2)(terser@5.37.0)(typescript@5.7.3)(yaml@2.7.0))(vite-plugin-pwa@0.21.1(vite@6.0.11(@types/node@22.10.10)(jiti@2.4.2)(lightningcss@1.29.1)(terser@5.37.0)(yaml@2.7.0))(workbox-build@7.0.0(@types/babel__core@7.20.5))(workbox-window@7.3.0))':
|
||||
@@ -10807,8 +11110,14 @@ snapshots:
|
||||
dependencies:
|
||||
acorn: 8.14.0
|
||||
|
||||
acorn-jsx@5.3.2(acorn@8.19.0):
|
||||
dependencies:
|
||||
acorn: 8.19.0
|
||||
|
||||
acorn@8.14.0: {}
|
||||
|
||||
acorn@8.19.0: {}
|
||||
|
||||
add-stream@1.0.0: {}
|
||||
|
||||
agent-base@6.0.2:
|
||||
@@ -10892,6 +11201,8 @@ snapshots:
|
||||
|
||||
aproba@2.0.0: {}
|
||||
|
||||
are-docs-informative@0.1.1: {}
|
||||
|
||||
arg@5.0.2: {}
|
||||
|
||||
argparse@1.0.10:
|
||||
@@ -11134,6 +11445,8 @@ snapshots:
|
||||
|
||||
balanced-match@1.0.2: {}
|
||||
|
||||
balanced-match@4.0.4: {}
|
||||
|
||||
base-64@1.0.0: {}
|
||||
|
||||
base64-js@1.5.1: {}
|
||||
@@ -11177,6 +11490,10 @@ snapshots:
|
||||
dependencies:
|
||||
balanced-match: 1.0.2
|
||||
|
||||
brace-expansion@5.0.13:
|
||||
dependencies:
|
||||
balanced-match: 4.0.4
|
||||
|
||||
braces@3.0.3:
|
||||
dependencies:
|
||||
fill-range: 7.1.1
|
||||
@@ -11423,6 +11740,8 @@ snapshots:
|
||||
|
||||
commander@4.1.1: {}
|
||||
|
||||
comment-parser@1.4.9: {}
|
||||
|
||||
common-ancestor-path@1.0.1: {}
|
||||
|
||||
common-tags@1.8.2: {}
|
||||
@@ -11601,6 +11920,10 @@ snapshots:
|
||||
dependencies:
|
||||
ms: 2.1.3
|
||||
|
||||
debug@4.4.3:
|
||||
dependencies:
|
||||
ms: 2.1.3
|
||||
|
||||
decamelize-keys@1.1.1:
|
||||
dependencies:
|
||||
decamelize: 1.2.0
|
||||
@@ -12019,6 +12342,31 @@ snapshots:
|
||||
- eslint-import-resolver-webpack
|
||||
- supports-color
|
||||
|
||||
eslint-plugin-jsdoc@65.5.3(eslint@9.19.0(jiti@2.4.2))(typescript@5.7.3):
|
||||
dependencies:
|
||||
'@es-joy/escodegen': 5.0.1
|
||||
'@es-joy/jsdoccomment': 1.2.0
|
||||
'@es-joy/resolve.exports': 1.2.0
|
||||
'@typescript-eslint/utils': 8.73.0(eslint@9.19.0(jiti@2.4.2))(typescript@5.7.3)
|
||||
are-docs-informative: 0.1.1
|
||||
comment-parser: 1.4.9
|
||||
debug: 4.4.3
|
||||
escape-string-regexp: 5.0.0
|
||||
eslint: 9.19.0(jiti@2.4.2)
|
||||
espree: 11.2.0
|
||||
esquery: 1.7.0
|
||||
html-entities: 2.6.0
|
||||
object-deep-merge: 2.0.1
|
||||
parse-imports-exports: 0.2.4
|
||||
semver: 7.8.6
|
||||
spdx-expression-parse: 5.0.0
|
||||
to-valid-identifier: 1.0.0
|
||||
optionalDependencies:
|
||||
typescript: 5.7.3
|
||||
transitivePeerDependencies:
|
||||
- '@typescript/native'
|
||||
- supports-color
|
||||
|
||||
eslint-plugin-n@15.7.0(eslint@9.19.0(jiti@2.4.2)):
|
||||
dependencies:
|
||||
builtins: 5.1.0
|
||||
@@ -12053,6 +12401,8 @@ snapshots:
|
||||
|
||||
eslint-visitor-keys@4.2.0: {}
|
||||
|
||||
eslint-visitor-keys@5.0.1: {}
|
||||
|
||||
eslint@9.19.0(jiti@2.4.2):
|
||||
dependencies:
|
||||
'@eslint-community/eslint-utils': 4.4.1(eslint@9.19.0(jiti@2.4.2))
|
||||
@@ -12100,12 +12450,22 @@ snapshots:
|
||||
acorn-jsx: 5.3.2(acorn@8.14.0)
|
||||
eslint-visitor-keys: 4.2.0
|
||||
|
||||
espree@11.2.0:
|
||||
dependencies:
|
||||
acorn: 8.19.0
|
||||
acorn-jsx: 5.3.2(acorn@8.19.0)
|
||||
eslint-visitor-keys: 5.0.1
|
||||
|
||||
esprima@4.0.1: {}
|
||||
|
||||
esquery@1.6.0:
|
||||
dependencies:
|
||||
estraverse: 5.3.0
|
||||
|
||||
esquery@1.7.0:
|
||||
dependencies:
|
||||
estraverse: 5.3.0
|
||||
|
||||
esrecurse@4.3.0:
|
||||
dependencies:
|
||||
estraverse: 5.3.0
|
||||
@@ -12218,6 +12578,10 @@ snapshots:
|
||||
optionalDependencies:
|
||||
picomatch: 4.0.2
|
||||
|
||||
fdir@6.5.0(picomatch@4.0.7):
|
||||
optionalDependencies:
|
||||
picomatch: 4.0.7
|
||||
|
||||
fetch-blob@3.2.0:
|
||||
dependencies:
|
||||
node-domexception: 1.0.0
|
||||
@@ -12745,6 +13109,8 @@ snapshots:
|
||||
dependencies:
|
||||
web-tree-sitter: 0.20.8
|
||||
|
||||
html-entities@2.6.0: {}
|
||||
|
||||
html-escaper@2.0.2: {}
|
||||
|
||||
html-escaper@3.0.3: {}
|
||||
@@ -13159,6 +13525,10 @@ snapshots:
|
||||
|
||||
jsdoc-json@2.0.2: {}
|
||||
|
||||
jsdoc-type-pratt-parser@9.5.0:
|
||||
dependencies:
|
||||
'@types/estree': 1.0.10
|
||||
|
||||
jsdoc@4.0.4:
|
||||
dependencies:
|
||||
'@babel/parser': 7.26.7
|
||||
@@ -13464,8 +13834,6 @@ snapshots:
|
||||
|
||||
lodash.merge@4.6.2: {}
|
||||
|
||||
lodash.sortby@4.7.0: {}
|
||||
|
||||
lodash@4.17.21: {}
|
||||
|
||||
log-symbols@4.1.0:
|
||||
@@ -14052,6 +14420,11 @@ snapshots:
|
||||
|
||||
mini-svg-data-uri@1.4.4: {}
|
||||
|
||||
minimatch@11.0.9:
|
||||
dependencies:
|
||||
'@isaacs/nonrecursive-glob-match': 1.1.0
|
||||
brace-expansion: 5.0.13
|
||||
|
||||
minimatch@3.0.5:
|
||||
dependencies:
|
||||
brace-expansion: 1.1.11
|
||||
@@ -14386,6 +14759,8 @@ snapshots:
|
||||
|
||||
object-assign@4.1.1: {}
|
||||
|
||||
object-deep-merge@2.0.1: {}
|
||||
|
||||
object-hash@3.0.0: {}
|
||||
|
||||
object-inspect@1.13.3: {}
|
||||
@@ -14619,6 +14994,10 @@ snapshots:
|
||||
is-decimal: 2.0.1
|
||||
is-hexadecimal: 2.0.1
|
||||
|
||||
parse-imports-exports@0.2.4:
|
||||
dependencies:
|
||||
parse-statements: 1.0.11
|
||||
|
||||
parse-json@4.0.0:
|
||||
dependencies:
|
||||
error-ex: 1.3.2
|
||||
@@ -14644,6 +15023,8 @@ snapshots:
|
||||
dependencies:
|
||||
protocols: 2.0.1
|
||||
|
||||
parse-statements@1.0.11: {}
|
||||
|
||||
parse-url@8.1.0:
|
||||
dependencies:
|
||||
parse-path: 7.0.0
|
||||
@@ -14695,6 +15076,8 @@ snapshots:
|
||||
|
||||
picomatch@4.0.2: {}
|
||||
|
||||
picomatch@4.0.7: {}
|
||||
|
||||
pify@2.3.0: {}
|
||||
|
||||
pify@3.0.0: {}
|
||||
@@ -15240,6 +15623,8 @@ snapshots:
|
||||
dependencies:
|
||||
lodash: 4.17.21
|
||||
|
||||
reserved-identifiers@1.2.0: {}
|
||||
|
||||
resolve-cwd@3.0.0:
|
||||
dependencies:
|
||||
resolve-from: 5.0.0
|
||||
@@ -15388,6 +15773,8 @@ snapshots:
|
||||
|
||||
semver@7.6.3: {}
|
||||
|
||||
semver@7.8.6: {}
|
||||
|
||||
serialize-javascript@4.0.0:
|
||||
dependencies:
|
||||
randombytes: 2.1.0
|
||||
@@ -15599,9 +15986,7 @@ snapshots:
|
||||
|
||||
source-map@0.7.4: {}
|
||||
|
||||
source-map@0.8.0-beta.0:
|
||||
dependencies:
|
||||
whatwg-url: 7.1.0
|
||||
source-map@0.8.0: {}
|
||||
|
||||
sourcemap-codec@1.4.8: {}
|
||||
|
||||
@@ -15619,6 +16004,11 @@ snapshots:
|
||||
spdx-exceptions: 2.5.0
|
||||
spdx-license-ids: 3.0.21
|
||||
|
||||
spdx-expression-parse@5.0.0:
|
||||
dependencies:
|
||||
spdx-exceptions: 2.5.0
|
||||
spdx-license-ids: 3.0.21
|
||||
|
||||
spdx-license-ids@3.0.21: {}
|
||||
|
||||
split2@3.2.2:
|
||||
@@ -15879,7 +16269,7 @@ snapshots:
|
||||
terser@5.37.0:
|
||||
dependencies:
|
||||
'@jridgewell/source-map': 0.3.6
|
||||
acorn: 8.14.0
|
||||
acorn: 8.19.0
|
||||
commander: 2.20.3
|
||||
source-map-support: 0.5.21
|
||||
|
||||
@@ -15917,6 +16307,11 @@ snapshots:
|
||||
fdir: 6.4.3(picomatch@4.0.2)
|
||||
picomatch: 4.0.2
|
||||
|
||||
tinyglobby@0.2.17:
|
||||
dependencies:
|
||||
fdir: 6.5.0(picomatch@4.0.7)
|
||||
picomatch: 4.0.7
|
||||
|
||||
tinypool@1.0.2: {}
|
||||
|
||||
tinyrainbow@2.0.0: {}
|
||||
@@ -15935,14 +16330,15 @@ snapshots:
|
||||
dependencies:
|
||||
is-number: 7.0.0
|
||||
|
||||
to-valid-identifier@1.0.0:
|
||||
dependencies:
|
||||
'@sindresorhus/base62': 1.0.0
|
||||
reserved-identifiers: 1.2.0
|
||||
|
||||
totalist@3.0.1: {}
|
||||
|
||||
tr46@0.0.3: {}
|
||||
|
||||
tr46@1.0.1:
|
||||
dependencies:
|
||||
punycode: 2.3.1
|
||||
|
||||
tree-sitter-haskell@0.23.1(tree-sitter@0.21.1):
|
||||
dependencies:
|
||||
node-addon-api: 8.3.0
|
||||
@@ -15968,6 +16364,10 @@ snapshots:
|
||||
dependencies:
|
||||
typescript: 5.7.3
|
||||
|
||||
ts-api-utils@2.5.0(typescript@5.7.3):
|
||||
dependencies:
|
||||
typescript: 5.7.3
|
||||
|
||||
ts-interface-checker@0.1.13: {}
|
||||
|
||||
tsconfck@3.1.4(typescript@5.7.3):
|
||||
@@ -16277,9 +16677,9 @@ snapshots:
|
||||
|
||||
vite-plugin-pwa@0.21.1(vite@6.0.11(@types/node@22.10.10)(jiti@2.4.2)(lightningcss@1.29.1)(terser@5.37.0)(yaml@2.7.0))(workbox-build@7.0.0(@types/babel__core@7.20.5))(workbox-window@7.3.0):
|
||||
dependencies:
|
||||
debug: 4.4.0
|
||||
debug: 4.4.3
|
||||
pretty-bytes: 6.1.1
|
||||
tinyglobby: 0.2.10
|
||||
tinyglobby: 0.2.17
|
||||
vite: 6.0.11(@types/node@22.10.10)(jiti@2.4.2)(lightningcss@1.29.1)(terser@5.37.0)(yaml@2.7.0)
|
||||
workbox-build: 7.0.0(@types/babel__core@7.20.5)
|
||||
workbox-window: 7.3.0
|
||||
@@ -16375,8 +16775,6 @@ snapshots:
|
||||
|
||||
webidl-conversions@3.0.1: {}
|
||||
|
||||
webidl-conversions@4.0.2: {}
|
||||
|
||||
webmidi@3.1.12:
|
||||
dependencies:
|
||||
djipevents: 2.0.7
|
||||
@@ -16388,12 +16786,6 @@ snapshots:
|
||||
tr46: 0.0.3
|
||||
webidl-conversions: 3.0.1
|
||||
|
||||
whatwg-url@7.1.0:
|
||||
dependencies:
|
||||
lodash.sortby: 4.7.0
|
||||
tr46: 1.0.1
|
||||
webidl-conversions: 4.0.2
|
||||
|
||||
which-boxed-primitive@1.1.1:
|
||||
dependencies:
|
||||
is-bigint: 1.1.0
|
||||
@@ -16499,7 +16891,7 @@ snapshots:
|
||||
pretty-bytes: 5.6.0
|
||||
rollup: 2.79.2
|
||||
rollup-plugin-terser: 7.0.2(rollup@2.79.2)
|
||||
source-map: 0.8.0-beta.0
|
||||
source-map: 0.8.0
|
||||
stringify-object: 3.3.0
|
||||
strip-comments: 2.0.1
|
||||
tempy: 0.6.0
|
||||
|
||||
@@ -1,68 +1,5 @@
|
||||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
||||
|
||||
exports[`runs examples > example "" example index 0 1`] = `
|
||||
[
|
||||
"[ 0/1 → 1/4 | s:bd cps:0.5 ]",
|
||||
"[ 1/4 → 1/2 | s:hh cps:0.5 ]",
|
||||
"[ 1/2 → 3/4 | s:sd cps:0.5 ]",
|
||||
"[ 3/4 → 1/1 | s:hh cps:0.5 ]",
|
||||
"[ 1/1 → 5/4 | s:bd cps:0.5 ]",
|
||||
"[ 5/4 → 3/2 | s:hh cps:0.5 ]",
|
||||
"[ 3/2 → 7/4 | s:sd cps:0.5 ]",
|
||||
"[ 7/4 → 2/1 | s:hh cps:0.5 ]",
|
||||
"[ 2/1 → 9/4 | s:bd cps:0.5 ]",
|
||||
"[ 9/4 → 5/2 | s:hh cps:0.5 ]",
|
||||
"[ 5/2 → 11/4 | s:sd cps:0.5 ]",
|
||||
"[ 11/4 → 3/1 | s:hh cps:0.5 ]",
|
||||
"[ 3/1 → 13/4 | s:bd cps:0.5 ]",
|
||||
"[ 13/4 → 7/2 | s:hh cps:0.5 ]",
|
||||
"[ 7/2 → 15/4 | s:sd cps:0.5 ]",
|
||||
"[ 15/4 → 4/1 | s:hh cps:0.5 ]",
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`runs examples > example "" example index 0 2`] = `
|
||||
[
|
||||
"[ 0/1 → 1/4 | s:bd cpm:50 ]",
|
||||
"[ 1/4 → 1/2 | s:hh cpm:57.6536686473018 ]",
|
||||
"[ 1/2 → 3/4 | s:sd cpm:64.14213562373095 ]",
|
||||
"[ 3/4 → 1/1 | s:hh cpm:68.47759065022574 ]",
|
||||
"[ 1/1 → 5/4 | s:bd cpm:70 ]",
|
||||
"[ 5/4 → 3/2 | s:hh cpm:68.47759065022574 ]",
|
||||
"[ 3/2 → 7/4 | s:sd cpm:64.14213562373095 ]",
|
||||
"[ 7/4 → 2/1 | s:hh cpm:57.6536686473018 ]",
|
||||
"[ 2/1 → 9/4 | s:bd cpm:50 ]",
|
||||
"[ 9/4 → 5/2 | s:hh cpm:42.34633135269821 ]",
|
||||
"[ 5/2 → 11/4 | s:sd cpm:35.85786437626905 ]",
|
||||
"[ 11/4 → 3/1 | s:hh cpm:31.52240934977427 ]",
|
||||
"[ 3/1 → 13/4 | s:bd cpm:30 ]",
|
||||
"[ 13/4 → 7/2 | s:hh cpm:31.522409349774268 ]",
|
||||
"[ 7/2 → 15/4 | s:sd cpm:35.85786437626905 ]",
|
||||
"[ 15/4 → 4/1 | s:hh cpm:42.34633135269819 ]",
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`runs examples > example "" example index 1 1`] = `
|
||||
[
|
||||
"[ 0/1 → 1/4 | s:bd cps:1 ]",
|
||||
"[ 1/4 → 1/2 | s:hh cps:1.1913417161825448 ]",
|
||||
"[ 1/2 → 3/4 | s:sd cps:1.3535533905932737 ]",
|
||||
"[ 3/4 → 1/1 | s:hh cps:1.4619397662556435 ]",
|
||||
"[ 1/1 → 5/4 | s:bd cps:1.5 ]",
|
||||
"[ 5/4 → 3/2 | s:hh cps:1.4619397662556435 ]",
|
||||
"[ 3/2 → 7/4 | s:sd cps:1.3535533905932737 ]",
|
||||
"[ 7/4 → 2/1 | s:hh cps:1.1913417161825448 ]",
|
||||
"[ 2/1 → 9/4 | s:bd cps:1 ]",
|
||||
"[ 9/4 → 5/2 | s:hh cps:0.8086582838174552 ]",
|
||||
"[ 5/2 → 11/4 | s:sd cps:0.6464466094067263 ]",
|
||||
"[ 11/4 → 3/1 | s:hh cps:0.5380602337443567 ]",
|
||||
"[ 3/1 → 13/4 | s:bd cps:0.5 ]",
|
||||
"[ 13/4 → 7/2 | s:hh cps:0.5380602337443567 ]",
|
||||
"[ 7/2 → 15/4 | s:sd cps:0.6464466094067262 ]",
|
||||
"[ 15/4 → 4/1 | s:hh cps:0.8086582838174547 ]",
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`runs examples > example "_euclidRot" example index 0 1`] = `
|
||||
[
|
||||
"[ 0/1 → 1/5 | note:c3 ]",
|
||||
@@ -1459,6 +1396,43 @@ exports[`runs examples > example "binary" example index 0 1`] = `
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`runs examples > example "binaryL" example index 0 1`] = `
|
||||
[
|
||||
"[ 0/1 → 1/8 | s:saw partials:[1] ]",
|
||||
"[ 1/8 → 1/4 | s:saw partials:[1 0 1 0 1 1 1 1 0 1 1 1] ]",
|
||||
"[ 1/4 → 3/8 | s:saw partials:[1 0 1 1 1 1 0 1 0 1 1] ]",
|
||||
"[ 3/8 → 1/2 | s:saw partials:[1 1 0 0 1 1 0 1 1 0 1] ]",
|
||||
"[ 1/2 → 5/8 | s:saw partials:[1 0 0 0 0 1 0 1 0 1 1] ]",
|
||||
"[ 5/8 → 3/4 | s:saw partials:[1 0 0 0 1 0 1 1 0 0] ]",
|
||||
"[ 3/4 → 7/8 | s:saw partials:[1 1 0 0 1 0 0 0 1 1] ]",
|
||||
"[ 7/8 → 1/1 | s:saw partials:[1 1 0 0 1 0 1 1 1 0 1] ]",
|
||||
"[ 1/1 → 9/8 | s:saw partials:[1 0 0 0 0 1 0 1 0 0 0 1] ]",
|
||||
"[ 9/8 → 5/4 | s:saw partials:[1 0 1 0 1 1 0 0 0 0 1 1] ]",
|
||||
"[ 5/4 → 11/8 | s:saw partials:[1 0 1 1 1 0 1 0 1 0 0 1] ]",
|
||||
"[ 11/8 → 3/2 | s:saw partials:[1 0 1 1 1 0 1 1 0 1] ]",
|
||||
"[ 3/2 → 13/8 | s:saw partials:[1 0 0 1 1 0 1 1 1 1 0 1] ]",
|
||||
"[ 13/8 → 7/4 | s:saw partials:[1 1 1 1 1 1 1 0 0 1 1] ]",
|
||||
"[ 7/4 → 15/8 | s:saw partials:[1 1 0 1 0 0 0 1 1 1] ]",
|
||||
"[ 15/8 → 2/1 | s:saw partials:[1 0 0 1 1 0 0 0 0 1 0 0] ]",
|
||||
"[ 2/1 → 17/8 | s:saw partials:[1 1 1 1 0 1 0 1 1 0 1 1] ]",
|
||||
"[ 17/8 → 9/4 | s:saw partials:[1 1 1 0 0 1 1 1 0 1 0 1] ]",
|
||||
"[ 9/4 → 19/8 | s:saw partials:[1 0 1 1 0 0 0 1 0 0 0] ]",
|
||||
"[ 19/8 → 5/2 | s:saw partials:[1 1 0 1 0 1 1 0 0 0 1 1] ]",
|
||||
"[ 5/2 → 21/8 | s:saw partials:[1 1 1 0 1 0 1 0 1 1 1] ]",
|
||||
"[ 21/8 → 11/4 | s:saw partials:[1 0 1 0 0 1 0 0 0 1] ]",
|
||||
"[ 11/4 → 23/8 | s:saw partials:[1 0 1 0 0 0 1 0 0 0 1 0] ]",
|
||||
"[ 23/8 → 3/1 | s:saw partials:[1 0 0 0 0 1 1] ]",
|
||||
"[ 3/1 → 25/8 | s:saw partials:[1 1 0 1 1 1 1 0 1 1] ]",
|
||||
"[ 25/8 → 13/4 | s:saw partials:[1 0 1 0 1 1 1 1 1 1 0] ]",
|
||||
"[ 13/4 → 27/8 | s:saw partials:[1 1 1 1 1 1 1 0 0 0 0 1] ]",
|
||||
"[ 27/8 → 7/2 | s:saw partials:[1 1 0 1 0 0 0 1 0 1 1] ]",
|
||||
"[ 7/2 → 29/8 | s:saw partials:[1 1 0 1 0 0 1 0 0 0 0] ]",
|
||||
"[ 29/8 → 15/4 | s:saw partials:[1 1 1 1 0 0 0 0 0 1 1 1] ]",
|
||||
"[ 15/4 → 31/8 | s:saw partials:[1 1 0 0 1 1 1 1 1 1 1 1] ]",
|
||||
"[ 31/8 → 4/1 | s:saw partials:[1 0 1 1 1 1 0 0 1 0 0 0] ]",
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`runs examples > example "binaryN" example index 0 1`] = `
|
||||
[
|
||||
"[ 0/1 → 1/16 | s:hh ]",
|
||||
@@ -2852,6 +2826,29 @@ exports[`runs examples > example "cosine" example index 0 1`] = `
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`runs examples > example "cpm" example index 0 1`] = `
|
||||
[
|
||||
"[ 0/1 → 1/3 | s:hh ]",
|
||||
"[ 0/1 → 2/3 | s:bd ]",
|
||||
"[ 1/3 → 2/3 | s:hh ]",
|
||||
"[ 2/3 → 1/1 | s:hh ]",
|
||||
"[ 2/3 → 4/3 | s:sd ]",
|
||||
"[ 1/1 → 4/3 | s:hh ]",
|
||||
"[ 4/3 → 5/3 | s:hh ]",
|
||||
"[ 4/3 → 2/1 | s:bd ]",
|
||||
"[ 5/3 → 2/1 | s:hh ]",
|
||||
"[ 2/1 → 7/3 | s:hh ]",
|
||||
"[ 2/1 → 8/3 | s:sd ]",
|
||||
"[ 7/3 → 8/3 | s:hh ]",
|
||||
"[ 8/3 → 3/1 | s:hh ]",
|
||||
"[ 8/3 → 10/3 | s:bd ]",
|
||||
"[ 3/1 → 10/3 | s:hh ]",
|
||||
"[ 10/3 → 11/3 | s:hh ]",
|
||||
"[ 10/3 → 4/1 | s:sd ]",
|
||||
"[ 11/3 → 4/1 | s:hh ]",
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`runs examples > example "crush" example index 0 1`] = `
|
||||
[
|
||||
"[ 0/1 → 1/6 | s:hh crush:16 ]",
|
||||
@@ -9632,6 +9629,31 @@ exports[`runs examples > example "pick" example index 3 1`] = `
|
||||
]
|
||||
`;
|
||||
|
||||
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 "pickF" example index 0 1`] = `
|
||||
[
|
||||
"[ 0/1 → 1/4 | s:hh ]",
|
||||
@@ -10044,6 +10066,52 @@ exports[`runs examples > example "pressBy" example index 0 1`] = `
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`runs examples > example "print" example index 0 1`] = `
|
||||
[
|
||||
"[ 0/1 → 1/4 | s:bd ]",
|
||||
"[ 1/4 → 1/2 | s:sd ]",
|
||||
"[ 1/2 → 3/4 | s:hh ]",
|
||||
"[ 3/4 → 1/1 | s:cp ]",
|
||||
"[ 1/1 → 5/4 | s:bd ]",
|
||||
"[ 5/4 → 3/2 | s:sd ]",
|
||||
"[ 3/2 → 7/4 | s:hh ]",
|
||||
"[ 7/4 → 2/1 | s:cp ]",
|
||||
"[ 2/1 → 9/4 | s:bd ]",
|
||||
"[ 9/4 → 5/2 | s:sd ]",
|
||||
"[ 5/2 → 11/4 | s:hh ]",
|
||||
"[ 11/4 → 3/1 | s:cp ]",
|
||||
"[ 3/1 → 13/4 | s:bd ]",
|
||||
"[ 13/4 → 7/2 | s:sd ]",
|
||||
"[ 7/2 → 15/4 | s:hh ]",
|
||||
"[ 15/4 → 4/1 | s:cp ]",
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`runs examples > example "print" example index 1 1`] = `
|
||||
[
|
||||
"[ 0/1 → 1/4 | s:bd ]",
|
||||
"[ 1/4 → 1/2 | s:sd ]",
|
||||
"[ 1/2 → 5/8 | s:hh ]",
|
||||
"[ 5/8 → 3/4 | s:hh ]",
|
||||
"[ 3/4 → 1/1 | s:cp ]",
|
||||
"[ 1/1 → 5/4 | s:bd ]",
|
||||
"[ 5/4 → 3/2 | s:sd ]",
|
||||
"[ 3/2 → 13/8 | s:hh ]",
|
||||
"[ 13/8 → 7/4 | s:hh ]",
|
||||
"[ 7/4 → 2/1 | s:cp ]",
|
||||
"[ 2/1 → 9/4 | s:bd ]",
|
||||
"[ 9/4 → 5/2 | s:sd ]",
|
||||
"[ 5/2 → 21/8 | s:hh ]",
|
||||
"[ 21/8 → 11/4 | s:hh ]",
|
||||
"[ 11/4 → 3/1 | s:cp ]",
|
||||
"[ 3/1 → 13/4 | s:bd ]",
|
||||
"[ 13/4 → 7/2 | s:sd ]",
|
||||
"[ 7/2 → 29/8 | s:hh ]",
|
||||
"[ 29/8 → 15/4 | s:hh ]",
|
||||
"[ 15/4 → 4/1 | s:cp ]",
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`runs examples > example "progNum" example index 0 1`] = `
|
||||
[
|
||||
"[ 0/1 → 1/1 | note:c4 progNum:10 midichan:1 ]",
|
||||
|
||||
@@ -97,6 +97,7 @@ const toneHelpersMocked = {
|
||||
'_pitchwheel',
|
||||
'_pianoroll',
|
||||
'_spectrum',
|
||||
'_print',
|
||||
'markcss',
|
||||
'p',
|
||||
'dough',
|
||||
|
||||
+1
-2
@@ -1,6 +1,5 @@
|
||||
import { afterEach } from 'vitest';
|
||||
import { useRNG } from './packages/core/signal.mjs';
|
||||
import { setDefaultJoin } from './packages/core/pattern.mjs';
|
||||
import { useRNG, setDefaultJoin } from './packages/pattern/index.mjs';
|
||||
|
||||
afterEach(() => {
|
||||
// Avoid bleed between tests
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
"@strudel/tonal": "workspace:*",
|
||||
"@strudel/transpiler": "workspace:*",
|
||||
"@strudel/webaudio": "workspace:*",
|
||||
"@strudel/websocket": "workspace:*",
|
||||
"@strudel/mondo": "workspace:*",
|
||||
"@strudel/xen": "workspace:*",
|
||||
"@supabase/supabase-js": "^2.48.1",
|
||||
|
||||
@@ -118,6 +118,7 @@ export const SIDEBAR: Sidebar = {
|
||||
{ text: 'Sounds', link: 'technical-manual/sounds' },
|
||||
{ text: 'Docs', link: 'technical-manual/docs' },
|
||||
{ text: 'Testing', link: 'technical-manual/testing' },
|
||||
{ text: 'Reference', link: 'reference' },
|
||||
// { text: 'Internals', link: 'technical-manual/internals' },
|
||||
],
|
||||
},
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* compute the list of all function with jsDoc documentation
|
||||
*
|
||||
* @param {object} jsdocJson
|
||||
* @returns {object[]} the list of functions in the same structure as the jsdoc json
|
||||
*/
|
||||
export const computeAvailableFunctions = (jsdocJson) => {
|
||||
const seen = new Set(); // avoid repetition
|
||||
const functions = [];
|
||||
for (const doc of jsdocJson.docs) {
|
||||
if (!isValid(doc)) continue;
|
||||
if (seen.has(doc.name)) continue;
|
||||
|
||||
// jsdoc also uses "tags" for when you use @something in the comments and it doesn't know what
|
||||
// @something is. We only want data from comments like `@tags superdough` here.
|
||||
// If nothing is specified, we default to "untagged" for debugging
|
||||
doc.tags = doc.tags?.filter((t) => t && typeof t === 'string') || ['untagged'];
|
||||
|
||||
const synonyms = doc.synonyms || [];
|
||||
let names = [doc.name];
|
||||
seen.add(doc.name);
|
||||
for (const s of synonyms) {
|
||||
if (!s || seen.has(s)) continue;
|
||||
names.push(s);
|
||||
seen.add(s);
|
||||
}
|
||||
doc.allNames = names.join(' ');
|
||||
doc.synonyms = names.slice(1);
|
||||
functions.push(doc);
|
||||
}
|
||||
return functions.sort((a, b) => /* a.meta.filename.localeCompare(b.meta.filename) + */ a.name.localeCompare(b.name));
|
||||
};
|
||||
|
||||
const isValid = ({ name, description, tags = [] }) => {
|
||||
const isSuperdirtOnly = tags.includes('superdirt') && !tags.includes('superdough');
|
||||
return name && !name.startsWith('_') && !!description && !isSuperdirtOnly;
|
||||
};
|
||||
@@ -90,47 +90,47 @@ This group of functions allows to modify the value of events.
|
||||
|
||||
## add
|
||||
|
||||
<JsDoc client:idle name="Pattern.add" h={0} />
|
||||
<JsDoc client:idle name="Pattern#add" h={0} />
|
||||
|
||||
## sub
|
||||
|
||||
<JsDoc client:idle name="Pattern.sub" h={0} />
|
||||
<JsDoc client:idle name="Pattern#sub" h={0} />
|
||||
|
||||
## mul
|
||||
|
||||
<JsDoc client:idle name="Pattern.mul" h={0} />
|
||||
<JsDoc client:idle name="Pattern#mul" h={0} />
|
||||
|
||||
## div
|
||||
|
||||
<JsDoc client:idle name="Pattern.div" h={0} />
|
||||
<JsDoc client:idle name="Pattern#div" h={0} />
|
||||
|
||||
## round
|
||||
|
||||
<JsDoc client:idle name="Pattern.round" h={0} />
|
||||
<JsDoc client:idle name="Pattern#round" h={0} />
|
||||
|
||||
## floor
|
||||
|
||||
<JsDoc client:idle name="Pattern.floor" h={0} />
|
||||
<JsDoc client:idle name="Pattern#floor" h={0} />
|
||||
|
||||
## ceil
|
||||
|
||||
<JsDoc client:idle name="Pattern.ceil" h={0} />
|
||||
<JsDoc client:idle name="Pattern#ceil" h={0} />
|
||||
|
||||
## range
|
||||
|
||||
<JsDoc client:idle name="Pattern.range" h={0} />
|
||||
<JsDoc client:idle name="Pattern#range" h={0} />
|
||||
|
||||
## rangex
|
||||
|
||||
<JsDoc client:idle name="Pattern.rangex" h={0} />
|
||||
<JsDoc client:idle name="Pattern#rangex" h={0} />
|
||||
|
||||
## range2
|
||||
|
||||
<JsDoc client:idle name="Pattern.range2" h={0} />
|
||||
<JsDoc client:idle name="Pattern#range2" h={0} />
|
||||
|
||||
## ratio
|
||||
|
||||
<JsDoc client:idle name="Pattern.ratio" h={0} />
|
||||
<JsDoc client:idle name="Pattern#ratio" h={0} />
|
||||
|
||||
## as
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user