mirror of
https://codeberg.org/uzu/strudel
synced 2026-07-22 05:05:26 -04:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 35b9c82bdd | |||
| 0fcfc308fd | |||
| 931016143c |
+1
-1
@@ -22,4 +22,4 @@ vite.config.js
|
|||||||
reverbGen.mjs
|
reverbGen.mjs
|
||||||
hydra.mjs
|
hydra.mjs
|
||||||
jsdoc-synonyms.js
|
jsdoc-synonyms.js
|
||||||
packages/hs2js/src/hs2js.mjs
|
packages/node/pattern.mjs
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
{
|
{
|
||||||
"env": {
|
"env": {
|
||||||
"node": true,
|
|
||||||
"browser": true,
|
"browser": true,
|
||||||
"es2021": true
|
"es2021": true
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -11,3 +11,4 @@ pnpm-lock.yaml
|
|||||||
pnpm-workspace.yaml
|
pnpm-workspace.yaml
|
||||||
**/dev-dist
|
**/dev-dist
|
||||||
website/.astro
|
website/.astro
|
||||||
|
packages/node/pattern.mjs
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
import { queryCode, testCycles } from '../test/runtime.mjs';
|
|
||||||
import * as tunes from '../website/src/repl/tunes.mjs';
|
|
||||||
import { describe, bench } from 'vitest';
|
|
||||||
import { calculateTactus } from '../packages/core/index.mjs';
|
|
||||||
|
|
||||||
const tuneKeys = Object.keys(tunes);
|
|
||||||
|
|
||||||
describe('renders tunes', () => {
|
|
||||||
tuneKeys.forEach((key) => {
|
|
||||||
describe(key, () => {
|
|
||||||
calculateTactus(true);
|
|
||||||
bench(`+tactus`, async () => {
|
|
||||||
await queryCode(tunes[key], testCycles[key] || 1);
|
|
||||||
});
|
|
||||||
calculateTactus(false);
|
|
||||||
bench(`-tactus`, async () => {
|
|
||||||
await queryCode(tunes[key], testCycles[key] || 1);
|
|
||||||
});
|
|
||||||
calculateTactus(true);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,31 +1,9 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html>
|
<script src="https://unpkg.com/@strudel/web@1.0.3"></script>
|
||||||
<head>
|
<button id="play">play</button>
|
||||||
<meta charset="UTF-8" />
|
<button id="stop">stop</button>
|
||||||
<!-- <script src="../../packages/web/dist/index.js"></script> -->
|
<script>
|
||||||
<script src="https://unpkg.com/@strudel/web@1.0.3"></script>
|
|
||||||
</head>
|
|
||||||
<body style="background: #222">
|
|
||||||
<button id="play">play</button>
|
|
||||||
<button id="stop">stop</button>
|
|
||||||
<script>
|
|
||||||
strudel.initStrudel();
|
strudel.initStrudel();
|
||||||
document.getElementById('play').addEventListener('click', () =>
|
document.getElementById('play').addEventListener('click', () => evaluate('note("c a f e").jux(rev)'));
|
||||||
evaluate(`
|
document.getElementById('play').addEventListener('stop', () => hush());
|
||||||
//@title washover @by Switch Angel
|
</script>
|
||||||
//@social https://www.instagram.com/_switch_angel/
|
|
||||||
|
|
||||||
n("{0 1 3 5 2 }%16")
|
|
||||||
.add(n(tri.range(0, 6).slow(3)))
|
|
||||||
.scale("C4:pentatonic")
|
|
||||||
.sound("sawtooth").att(saw.range(0, 0.05).fast(6))
|
|
||||||
.release(3).pan(rand).decay(rand.range(0.1, 0.3))
|
|
||||||
.lpf(tri.range(200, 8000).slow(5)).lpq(0)
|
|
||||||
.gain(.4).vib(1).vibmod(.1)
|
|
||||||
.scope({pos:.5})
|
|
||||||
`),
|
|
||||||
);
|
|
||||||
document.getElementById('stop').addEventListener('click', () => strudel.hush());
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|||||||
@@ -1,16 +1,10 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html>
|
<script src="https://unpkg.com/@strudel/web@1.0.3"></script>
|
||||||
<head>
|
<button id="a">A</button>
|
||||||
<meta charset="UTF-8" />
|
<button id="b">B</button>
|
||||||
<!-- <script src="../../packages/web/dist/index.js"></script> -->
|
<button id="c">C</button>
|
||||||
<script src="https://unpkg.com/@strudel/web@1.0.3"></script>
|
<button id="stop">stop</button>
|
||||||
</head>
|
<script>
|
||||||
<body style="background: #222">
|
|
||||||
<button id="a">A</button>
|
|
||||||
<button id="b">B</button>
|
|
||||||
<button id="c">C</button>
|
|
||||||
<button id="stop">stop</button>
|
|
||||||
<script>
|
|
||||||
initStrudel({
|
initStrudel({
|
||||||
prebake: () => samples('github:tidalcycles/dirt-samples'),
|
prebake: () => samples('github:tidalcycles/dirt-samples'),
|
||||||
});
|
});
|
||||||
@@ -19,6 +13,4 @@
|
|||||||
click('b', () => s('bd*2,hh(3,4),jvbass(5,8,1)').jux(rev).play());
|
click('b', () => s('bd*2,hh(3,4),jvbass(5,8,1)').jux(rev).play());
|
||||||
click('c', () => s('bd*2,hh(3,4),jvbass:[0 4](5,8,1)').jux(rev).stack(s('~ sd')).play());
|
click('c', () => s('bd*2,hh(3,4),jvbass:[0 4](5,8,1)').jux(rev).stack(s('~ sd')).play());
|
||||||
click('stop', () => hush());
|
click('stop', () => hush());
|
||||||
</script>
|
</script>
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
<script src="https://unpkg.com/hs2js@0.0.4"></script>
|
|
||||||
<button id="hello">hello</button>
|
|
||||||
<script>
|
|
||||||
hs2js.setBase('https://unpkg.com/hs2js@0.0.4/dist/');
|
|
||||||
hs2js.loadParser();
|
|
||||||
document.getElementById('hello').addEventListener('click', () => {
|
|
||||||
hs2js.evaluate('alert "hello from haskell!"');
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
@@ -1,98 +0,0 @@
|
|||||||
<!doctype html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
||||||
<title>tidal.html</title>
|
|
||||||
</head>
|
|
||||||
<body style="margin: 0; padding: 0">
|
|
||||||
<textarea id="code" style="width: 100%; height: 200px"></textarea>
|
|
||||||
<pre id="result"></pre>
|
|
||||||
<script src="https://unpkg.com/hs2js@0.0.8"></script>
|
|
||||||
<script src="https://unpkg.com/@strudel/web@1.0.3"></script>
|
|
||||||
<script>
|
|
||||||
const { initStrudel } = strudel;
|
|
||||||
const { run, parse, setBase, loadParser } = hs2js;
|
|
||||||
setBase('https://unpkg.com/hs2js@0.0.4/dist/');
|
|
||||||
const ready = loadParser();
|
|
||||||
initStrudel({
|
|
||||||
prebake: () => samples('github:tidalcycles/dirt-samples'),
|
|
||||||
});
|
|
||||||
|
|
||||||
const textarea = document.getElementById('code');
|
|
||||||
if (window.location.hash) {
|
|
||||||
textarea.value = atob(window.location.hash.slice(1));
|
|
||||||
} else {
|
|
||||||
textarea.value = 'd1 $ s "jvbass(3,8)"';
|
|
||||||
}
|
|
||||||
textarea.addEventListener('input', (e) => {
|
|
||||||
window.location.hash = btoa(e.target.value);
|
|
||||||
update();
|
|
||||||
});
|
|
||||||
update();
|
|
||||||
|
|
||||||
function getInfixOperators() {
|
|
||||||
let operators = {
|
|
||||||
'>': 'set',
|
|
||||||
'#': 'set',
|
|
||||||
'+': 'add',
|
|
||||||
'-': 'sub',
|
|
||||||
'*': 'mul',
|
|
||||||
'/': 'div',
|
|
||||||
};
|
|
||||||
let alignments = {
|
|
||||||
in: (s) => '|' + s,
|
|
||||||
out: (s) => s + '|',
|
|
||||||
mix: (s) => '|' + s + '|',
|
|
||||||
};
|
|
||||||
let ops = {};
|
|
||||||
Object.entries(operators).forEach(([o, name]) => {
|
|
||||||
// operator without alignment
|
|
||||||
ops[o] = (l, r) => reify(l)[name](reify(r));
|
|
||||||
Object.entries(alignments).forEach(([a, getSymbol]) => {
|
|
||||||
// get symbol with alignment
|
|
||||||
let symbol = getSymbol(o);
|
|
||||||
ops[symbol] = (l, r) => reify(l)[name][a](reify(r));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
ops['~>'] = (l, r) => reify(l).late(reify(r));
|
|
||||||
ops['<~'] = (l, r) => reify(l).early(reify(r));
|
|
||||||
ops['<$>'] = (l, r) => reify(r).fmap(l).outerJoin(); // is this right?
|
|
||||||
return ops;
|
|
||||||
}
|
|
||||||
const ops = getInfixOperators();
|
|
||||||
|
|
||||||
async function update() {
|
|
||||||
let result, tree;
|
|
||||||
await ready;
|
|
||||||
try {
|
|
||||||
tree = parse(textarea.value);
|
|
||||||
} catch (err) {
|
|
||||||
console.warn('parse error');
|
|
||||||
console.error(err);
|
|
||||||
}
|
|
||||||
console.log('parsed tree');
|
|
||||||
console.log(tree.rootNode.toString());
|
|
||||||
try {
|
|
||||||
let patterns = {};
|
|
||||||
window.p = (name, pattern) => {
|
|
||||||
patterns[name] = pattern;
|
|
||||||
};
|
|
||||||
window.d1 = (pat) => window.p(1, pat);
|
|
||||||
window.d2 = (pat) => window.p(2, pat);
|
|
||||||
window.d3 = (pat) => window.p(3, pat);
|
|
||||||
window.rot = late;
|
|
||||||
result = run(tree.rootNode, window, ops);
|
|
||||||
if (Object.values(patterns).length) {
|
|
||||||
stack(...Object.values(patterns)).play();
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
console.warn('eval error');
|
|
||||||
console.error(err);
|
|
||||||
result = 'ERROR: ' + err.message;
|
|
||||||
}
|
|
||||||
document.getElementById('result').innerHTML = 'Result: ' + result;
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
import { StrudelMirror } from '@strudel/codemirror';
|
import { StrudelMirror } from '@strudel/codemirror';
|
||||||
import { funk42 } from './tunes';
|
import { funk42 } from './tunes';
|
||||||
import { evalScope } from '@strudel/core';
|
import { drawPianoroll, evalScope } from '@strudel/core';
|
||||||
import { drawPianoroll } from '@strudel/draw';
|
|
||||||
import './style.css';
|
import './style.css';
|
||||||
import { initAudioOnFirstClick } from '@strudel/webaudio';
|
import { initAudioOnFirstClick } from '@strudel/webaudio';
|
||||||
import { transpiler } from '@strudel/transpiler';
|
import { transpiler } from '@strudel/transpiler';
|
||||||
@@ -27,7 +26,6 @@ const editor = new StrudelMirror({
|
|||||||
initAudioOnFirstClick(); // needed to make the browser happy (don't await this here..)
|
initAudioOnFirstClick(); // needed to make the browser happy (don't await this here..)
|
||||||
const loadModules = evalScope(
|
const loadModules = evalScope(
|
||||||
import('@strudel/core'),
|
import('@strudel/core'),
|
||||||
import('@strudel/draw'),
|
|
||||||
import('@strudel/mini'),
|
import('@strudel/mini'),
|
||||||
import('@strudel/tonal'),
|
import('@strudel/tonal'),
|
||||||
import('@strudel/webaudio'),
|
import('@strudel/webaudio'),
|
||||||
|
|||||||
@@ -14,7 +14,6 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@strudel/codemirror": "workspace:*",
|
"@strudel/codemirror": "workspace:*",
|
||||||
"@strudel/core": "workspace:*",
|
"@strudel/core": "workspace:*",
|
||||||
"@strudel/draw": "workspace:*",
|
|
||||||
"@strudel/mini": "workspace:*",
|
"@strudel/mini": "workspace:*",
|
||||||
"@strudel/soundfonts": "workspace:*",
|
"@strudel/soundfonts": "workspace:*",
|
||||||
"@strudel/tonal": "workspace:*",
|
"@strudel/tonal": "workspace:*",
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
# Logs
|
|
||||||
logs
|
|
||||||
*.log
|
|
||||||
npm-debug.log*
|
|
||||||
yarn-debug.log*
|
|
||||||
yarn-error.log*
|
|
||||||
pnpm-debug.log*
|
|
||||||
lerna-debug.log*
|
|
||||||
|
|
||||||
node_modules
|
|
||||||
dist
|
|
||||||
dist-ssr
|
|
||||||
*.local
|
|
||||||
|
|
||||||
# Editor directories and files
|
|
||||||
.vscode/*
|
|
||||||
!.vscode/extensions.json
|
|
||||||
.idea
|
|
||||||
.DS_Store
|
|
||||||
*.suo
|
|
||||||
*.ntvs*
|
|
||||||
*.njsproj
|
|
||||||
*.sln
|
|
||||||
*.sw?
|
|
||||||
|
|
||||||
public/tree-sitter.wasm
|
|
||||||
public/tree-sitter-haskell.wasm
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
# @strudel/tidal
|
|
||||||
|
|
||||||
This is an experiment in implementing tree-sitter for parsing haskell.
|
|
||||||
|
|
||||||
```sh
|
|
||||||
pnpm i
|
|
||||||
cd haskell
|
|
||||||
pnpm copy-wasm
|
|
||||||
pnpm dev
|
|
||||||
```
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
<!doctype html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
||||||
<title>Tree sitter test</title>
|
|
||||||
<style>
|
|
||||||
body {
|
|
||||||
background-color: #121213;
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
textarea {
|
|
||||||
padding: 10px;
|
|
||||||
color: white;
|
|
||||||
background-color: transparent;
|
|
||||||
outline: none;
|
|
||||||
}
|
|
||||||
a {
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body style="margin: 0; padding: 0">
|
|
||||||
<textarea id="code" style="width: 100%; height: 200px"></textarea>
|
|
||||||
<pre id="result"></pre>
|
|
||||||
<script
|
|
||||||
type="module"
|
|
||||||
src="/main.js
|
|
||||||
"
|
|
||||||
></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,83 +0,0 @@
|
|||||||
import { run, parse, loadParser } from 'hs2js';
|
|
||||||
import { initStrudel, reify, late, samples, stack } from '@strudel/web';
|
|
||||||
|
|
||||||
initStrudel({
|
|
||||||
prebake: () => samples('github:tidalcycles/dirt-samples'),
|
|
||||||
});
|
|
||||||
|
|
||||||
const ready = loadParser();
|
|
||||||
|
|
||||||
const textarea = document.getElementById('code');
|
|
||||||
if (window.location.hash) {
|
|
||||||
textarea.value = atob(window.location.hash.slice(1));
|
|
||||||
} else {
|
|
||||||
textarea.value = 'd1 $ s "jvbass(3,8)"';
|
|
||||||
}
|
|
||||||
textarea.addEventListener('input', (e) => {
|
|
||||||
window.location.hash = btoa(e.target.value);
|
|
||||||
update();
|
|
||||||
});
|
|
||||||
update();
|
|
||||||
|
|
||||||
function getInfixOperators() {
|
|
||||||
let operators = {
|
|
||||||
'>': 'set',
|
|
||||||
'#': 'set',
|
|
||||||
'+': 'add',
|
|
||||||
'-': 'sub',
|
|
||||||
'*': 'mul',
|
|
||||||
'/': 'div',
|
|
||||||
};
|
|
||||||
let alignments = {
|
|
||||||
in: (s) => '|' + s,
|
|
||||||
out: (s) => s + '|',
|
|
||||||
mix: (s) => '|' + s + '|',
|
|
||||||
};
|
|
||||||
let ops = {};
|
|
||||||
Object.entries(operators).forEach(([o, name]) => {
|
|
||||||
// operator without alignment
|
|
||||||
ops[o] = (l, r) => reify(l)[name](reify(r));
|
|
||||||
Object.entries(alignments).forEach(([a, getSymbol]) => {
|
|
||||||
// get symbol with alignment
|
|
||||||
let symbol = getSymbol(o);
|
|
||||||
ops[symbol] = (l, r) => reify(l)[name][a](reify(r));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
ops['~>'] = (l, r) => reify(l).late(reify(r));
|
|
||||||
ops['<~'] = (l, r) => reify(l).early(reify(r));
|
|
||||||
ops['<$>'] = (l, r) => reify(r).fmap(l).outerJoin(); // is this right?
|
|
||||||
return ops;
|
|
||||||
}
|
|
||||||
const ops = getInfixOperators();
|
|
||||||
|
|
||||||
async function update() {
|
|
||||||
let result, tree;
|
|
||||||
await ready;
|
|
||||||
try {
|
|
||||||
tree = parse(textarea.value);
|
|
||||||
} catch (err) {
|
|
||||||
console.warn('parse error');
|
|
||||||
console.error(err);
|
|
||||||
}
|
|
||||||
console.log('parsed tree');
|
|
||||||
console.log(tree.rootNode.toString());
|
|
||||||
try {
|
|
||||||
let patterns = {};
|
|
||||||
window.p = (name, pattern) => {
|
|
||||||
patterns[name] = pattern;
|
|
||||||
};
|
|
||||||
window.d1 = (pat) => window.p(1, pat);
|
|
||||||
window.d2 = (pat) => window.p(2, pat);
|
|
||||||
window.d3 = (pat) => window.p(3, pat);
|
|
||||||
window.rot = late;
|
|
||||||
result = run(tree.rootNode, window, ops);
|
|
||||||
if (Object.values(patterns).length) {
|
|
||||||
stack(...Object.values(patterns)).play();
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
console.warn('eval error');
|
|
||||||
console.error(err);
|
|
||||||
result = 'ERROR: ' + err.message;
|
|
||||||
}
|
|
||||||
document.getElementById('result').innerHTML = 'Result: ' + result;
|
|
||||||
}
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "tidal-repl",
|
|
||||||
"private": true,
|
|
||||||
"version": "0.0.1",
|
|
||||||
"type": "module",
|
|
||||||
"scripts": {
|
|
||||||
"dev": "vite",
|
|
||||||
"build": "pnpm copy-wasm && vite build",
|
|
||||||
"preview": "vite preview",
|
|
||||||
"copy-wasm": "cp node_modules/hs2js/dist/tree-sitter.wasm public && cp node_modules/hs2js/dist/tree-sitter-haskell.wasm public"
|
|
||||||
},
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/tidalcycles/strudel.git"
|
|
||||||
},
|
|
||||||
"keywords": [
|
|
||||||
"titdalcycles",
|
|
||||||
"strudel",
|
|
||||||
"pattern",
|
|
||||||
"livecoding",
|
|
||||||
"algorave"
|
|
||||||
],
|
|
||||||
"author": "Felix Roos <flix91@gmail.com>",
|
|
||||||
"license": "AGPL-3.0-or-later",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/tidalcycles/strudel/issues"
|
|
||||||
},
|
|
||||||
"homepage": "https://github.com/tidalcycles/strudel#readme",
|
|
||||||
"dependencies": {
|
|
||||||
"@strudel/web": "workspace:*",
|
|
||||||
"hs2js": "workspace:*"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"vite": "^5.0.8"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
# public
|
|
||||||
|
|
||||||
this file is just here to make sure the public folder exists
|
|
||||||
@@ -11,7 +11,6 @@
|
|||||||
"test": "npm run pretest && vitest run --version",
|
"test": "npm run pretest && vitest run --version",
|
||||||
"test-ui": "npm run pretest && vitest --ui",
|
"test-ui": "npm run pretest && vitest --ui",
|
||||||
"test-coverage": "npm run pretest && vitest --coverage",
|
"test-coverage": "npm run pretest && vitest --coverage",
|
||||||
"bench": "npm run pretest && vitest bench",
|
|
||||||
"snapshot": "npm run pretest && vitest run -u --silent",
|
"snapshot": "npm run pretest && vitest run -u --silent",
|
||||||
"repl": "npm run prestart && cd website && npm run dev",
|
"repl": "npm run prestart && cd website && npm run dev",
|
||||||
"start": "npm run prestart && cd website && npm run dev",
|
"start": "npm run prestart && cd website && npm run dev",
|
||||||
|
|||||||
@@ -345,17 +345,6 @@ export class StrudelMirror {
|
|||||||
clear() {
|
clear() {
|
||||||
this.onStartRepl && document.removeEventListener('start-repl', this.onStartRepl);
|
this.onStartRepl && document.removeEventListener('start-repl', this.onStartRepl);
|
||||||
}
|
}
|
||||||
getCursorLocation() {
|
|
||||||
return this.editor.state.selection.main.head;
|
|
||||||
}
|
|
||||||
setCursorLocation(col) {
|
|
||||||
return this.editor.dispatch({ selection: { anchor: col } });
|
|
||||||
}
|
|
||||||
appendCode(code) {
|
|
||||||
const cursor = this.getCursorLocation();
|
|
||||||
this.setCode(this.code + code);
|
|
||||||
this.setCursorLocation(cursor);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseBooleans(value) {
|
function parseBooleans(value) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@strudel/codemirror",
|
"name": "@strudel/codemirror",
|
||||||
"version": "1.1.0",
|
"version": "1.0.1",
|
||||||
"description": "Codemirror Extensions for Strudel",
|
"description": "Codemirror Extensions for Strudel",
|
||||||
"main": "index.mjs",
|
"main": "index.mjs",
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
|
|||||||
@@ -1,46 +0,0 @@
|
|||||||
import { describe, bench } from 'vitest';
|
|
||||||
|
|
||||||
import { calculateTactus, sequence, stack } from '../index.mjs';
|
|
||||||
|
|
||||||
const pat64 = sequence(...Array(64).keys());
|
|
||||||
|
|
||||||
describe('tactus', () => {
|
|
||||||
calculateTactus(true);
|
|
||||||
bench(
|
|
||||||
'+tactus',
|
|
||||||
() => {
|
|
||||||
pat64.iter(64).fast(64).firstCycle();
|
|
||||||
},
|
|
||||||
{ time: 1000 },
|
|
||||||
);
|
|
||||||
|
|
||||||
calculateTactus(false);
|
|
||||||
bench(
|
|
||||||
'-tactus',
|
|
||||||
() => {
|
|
||||||
pat64.iter(64).fast(64).firstCycle();
|
|
||||||
},
|
|
||||||
{ time: 1000 },
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('stack', () => {
|
|
||||||
calculateTactus(true);
|
|
||||||
bench(
|
|
||||||
'+tactus',
|
|
||||||
() => {
|
|
||||||
stack(pat64, pat64, pat64, pat64, pat64, pat64, pat64, pat64).fast(64).firstCycle();
|
|
||||||
},
|
|
||||||
{ time: 1000 },
|
|
||||||
);
|
|
||||||
|
|
||||||
calculateTactus(false);
|
|
||||||
bench(
|
|
||||||
'-tactus',
|
|
||||||
() => {
|
|
||||||
stack(pat64, pat64, pat64, pat64, pat64, pat64, pat64, pat64).fast(64).firstCycle();
|
|
||||||
},
|
|
||||||
{ time: 1000 },
|
|
||||||
);
|
|
||||||
});
|
|
||||||
calculateTactus(true);
|
|
||||||
+13
-34
@@ -47,7 +47,7 @@ export function createParam(names) {
|
|||||||
return func;
|
return func;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function registerControl(names, ...aliases) {
|
function registerControl(names, ...aliases) {
|
||||||
const name = Array.isArray(names) ? names[0] : names;
|
const name = Array.isArray(names) ? names[0] : names;
|
||||||
let bag = {};
|
let bag = {};
|
||||||
bag[name] = createParam(names);
|
bag[name] = createParam(names);
|
||||||
@@ -430,17 +430,6 @@ export const { crush } = registerControl('crush');
|
|||||||
*/
|
*/
|
||||||
export const { coarse } = registerControl('coarse');
|
export const { coarse } = registerControl('coarse');
|
||||||
|
|
||||||
/**
|
|
||||||
* filter overdrive for supported filter types
|
|
||||||
*
|
|
||||||
* @name drive
|
|
||||||
* @param {number | Pattern} amount
|
|
||||||
* @example
|
|
||||||
* note("{f g g c d a a#}%16".sub(17)).s("supersaw").lpenv(8).lpf(150).lpq(.8).ftype('ladder').drive("<.5 4>")
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
export const { drive } = registerControl('drive');
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows you to set the output channels on the interface
|
* Allows you to set the output channels on the interface
|
||||||
*
|
*
|
||||||
@@ -553,7 +542,7 @@ export const { cutoff, ctf, lpf, lp } = registerControl(['cutoff', 'resonance',
|
|||||||
* @example
|
* @example
|
||||||
* note("c2 e2 f2 g2")
|
* note("c2 e2 f2 g2")
|
||||||
* .sound('sawtooth')
|
* .sound('sawtooth')
|
||||||
* .lpf(300)
|
* .lpf(500)
|
||||||
* .lpa(.5)
|
* .lpa(.5)
|
||||||
* .lpenv("<4 2 1 0 -1 -2 -4>/4")
|
* .lpenv("<4 2 1 0 -1 -2 -4>/4")
|
||||||
*/
|
*/
|
||||||
@@ -592,7 +581,7 @@ export const { bpenv, bpe } = registerControl('bpenv', 'bpe');
|
|||||||
* @example
|
* @example
|
||||||
* note("c2 e2 f2 g2")
|
* note("c2 e2 f2 g2")
|
||||||
* .sound('sawtooth')
|
* .sound('sawtooth')
|
||||||
* .lpf(300)
|
* .lpf(500)
|
||||||
* .lpa("<.5 .25 .1 .01>/4")
|
* .lpa("<.5 .25 .1 .01>/4")
|
||||||
* .lpenv(4)
|
* .lpenv(4)
|
||||||
*/
|
*/
|
||||||
@@ -631,8 +620,9 @@ export const { bpattack, bpa } = registerControl('bpattack', 'bpa');
|
|||||||
* @example
|
* @example
|
||||||
* note("c2 e2 f2 g2")
|
* note("c2 e2 f2 g2")
|
||||||
* .sound('sawtooth')
|
* .sound('sawtooth')
|
||||||
* .lpf(300)
|
* .lpf(500)
|
||||||
* .lpd("<.5 .25 .1 0>/4")
|
* .lpd("<.5 .25 .1 0>/4")
|
||||||
|
* .lps(0.2)
|
||||||
* .lpenv(4)
|
* .lpenv(4)
|
||||||
*/
|
*/
|
||||||
export const { lpdecay, lpd } = registerControl('lpdecay', 'lpd');
|
export const { lpdecay, lpd } = registerControl('lpdecay', 'lpd');
|
||||||
@@ -672,7 +662,7 @@ export const { bpdecay, bpd } = registerControl('bpdecay', 'bpd');
|
|||||||
* @example
|
* @example
|
||||||
* note("c2 e2 f2 g2")
|
* note("c2 e2 f2 g2")
|
||||||
* .sound('sawtooth')
|
* .sound('sawtooth')
|
||||||
* .lpf(300)
|
* .lpf(500)
|
||||||
* .lpd(.5)
|
* .lpd(.5)
|
||||||
* .lps("<0 .25 .5 1>/4")
|
* .lps("<0 .25 .5 1>/4")
|
||||||
* .lpenv(4)
|
* .lpenv(4)
|
||||||
@@ -715,7 +705,7 @@ export const { bpsustain, bps } = registerControl('bpsustain', 'bps');
|
|||||||
* note("c2 e2 f2 g2")
|
* note("c2 e2 f2 g2")
|
||||||
* .sound('sawtooth')
|
* .sound('sawtooth')
|
||||||
* .clip(.5)
|
* .clip(.5)
|
||||||
* .lpf(300)
|
* .lpf(500)
|
||||||
* .lpenv(4)
|
* .lpenv(4)
|
||||||
* .lpr("<.5 .25 .1 0>/4")
|
* .lpr("<.5 .25 .1 0>/4")
|
||||||
* .release(.5)
|
* .release(.5)
|
||||||
@@ -752,28 +742,17 @@ export const { hprelease, hpr } = registerControl('hprelease', 'hpr');
|
|||||||
*/
|
*/
|
||||||
export const { bprelease, bpr } = registerControl('bprelease', 'bpr');
|
export const { bprelease, bpr } = registerControl('bprelease', 'bpr');
|
||||||
/**
|
/**
|
||||||
* Sets the filter type. The ladder filter is more aggressive. More types might be added in the future.
|
* Sets the filter type. The 24db filter is more aggressive. More types might be added in the future.
|
||||||
* @name ftype
|
* @name ftype
|
||||||
* @param {number | Pattern} type 12db (0), ladder (1), or 24db (2)
|
* @param {number | Pattern} type 12db (default) or 24db
|
||||||
* @example
|
* @example
|
||||||
* note("{f g g c d a a#}%8").s("sawtooth").lpenv(4).lpf(500).ftype("<0 1 2>").lpq(1)
|
* note("c2 e2 f2 g2")
|
||||||
* @example
|
|
||||||
* note("c f g g a c d4").fast(2)
|
|
||||||
* .sound('sawtooth')
|
* .sound('sawtooth')
|
||||||
* .lpf(200).fanchor(0)
|
* .lpf(500)
|
||||||
* .lpenv(3).lpq(1)
|
* .bpenv(4)
|
||||||
* .ftype("<ladder 12db 24db>")
|
* .ftype("12db 24db")
|
||||||
*/
|
*/
|
||||||
export const { ftype } = registerControl('ftype');
|
export const { ftype } = registerControl('ftype');
|
||||||
|
|
||||||
/**
|
|
||||||
* controls the center of the filter envelope. 0 is unipolar positive, .5 is bipolar, 1 is unipolar negative
|
|
||||||
* @name fanchor
|
|
||||||
* @param {number | Pattern} center 0 to 1
|
|
||||||
* @example
|
|
||||||
* note("{f g g c d a a#}%8").s("sawtooth").lpf("{1000}%2")
|
|
||||||
* .lpenv(8).fanchor("<0 .5 1>")
|
|
||||||
*/
|
|
||||||
export const { fanchor } = registerControl('fanchor');
|
export const { fanchor } = registerControl('fanchor');
|
||||||
/**
|
/**
|
||||||
* Applies the cutoff frequency of the **h**igh-**p**ass **f**ilter.
|
* Applies the cutoff frequency of the **h**igh-**p**ass **f**ilter.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@strudel/core",
|
"name": "@strudel/core",
|
||||||
"version": "1.1.0",
|
"version": "1.0.1",
|
||||||
"description": "Port of Tidal Cycles to JavaScript",
|
"description": "Port of Tidal Cycles to JavaScript",
|
||||||
"main": "index.mjs",
|
"main": "index.mjs",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
@@ -9,7 +9,6 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "vitest run",
|
"test": "vitest run",
|
||||||
"bench": "vitest bench",
|
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
"prepublishOnly": "pnpm build"
|
"prepublishOnly": "pnpm build"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -86,38 +86,6 @@ export const tri2 = fastcat(isaw2, saw2);
|
|||||||
|
|
||||||
export const time = signal(id);
|
export const time = signal(id);
|
||||||
|
|
||||||
/**
|
|
||||||
* The mouse's x position value ranges from 0 to 1.
|
|
||||||
* @name mousex
|
|
||||||
* @return {Pattern}
|
|
||||||
* @example
|
|
||||||
* n(mousex.segment(4).range(0,7)).scale("C:minor")
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The mouse's y position value ranges from 0 to 1.
|
|
||||||
* @name mousey
|
|
||||||
* @return {Pattern}
|
|
||||||
* @example
|
|
||||||
* n(mousey.segment(4).range(0,7)).scale("C:minor")
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
let _mouseY = 0,
|
|
||||||
_mouseX = 0;
|
|
||||||
if (typeof window !== 'undefined') {
|
|
||||||
//document.onmousemove = (e) => {
|
|
||||||
document.addEventListener('mousemove', (e) => {
|
|
||||||
_mouseY = e.clientY / document.body.clientHeight;
|
|
||||||
_mouseX = e.clientX / document.body.clientWidth;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
export const mousey = signal(() => _mouseY);
|
|
||||||
export const mouseY = signal(() => _mouseY);
|
|
||||||
export const mousex = signal(() => _mouseX);
|
|
||||||
export const mouseX = signal(() => _mouseX);
|
|
||||||
|
|
||||||
// random signals
|
// random signals
|
||||||
|
|
||||||
const xorwise = (x) => {
|
const xorwise = (x) => {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@strudel/csound",
|
"name": "@strudel/csound",
|
||||||
"version": "1.1.0",
|
"version": "1.0.1",
|
||||||
"description": "csound bindings for strudel",
|
"description": "csound bindings for strudel",
|
||||||
"main": "index.mjs",
|
"main": "index.mjs",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
+1
-10
@@ -191,16 +191,7 @@ export function getComputedPropertyValue(name) {
|
|||||||
return getComputedStyle(document.documentElement).getPropertyValue(name);
|
return getComputedStyle(document.documentElement).getPropertyValue(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
let theme = {
|
let theme = {};
|
||||||
background: '#222',
|
|
||||||
foreground: '#75baff',
|
|
||||||
caret: '#ffcc00',
|
|
||||||
selection: 'rgba(128, 203, 196, 0.5)',
|
|
||||||
selectionMatch: '#036dd626',
|
|
||||||
lineHighlight: '#00000050',
|
|
||||||
gutterBackground: 'transparent',
|
|
||||||
gutterForeground: '#8a919966',
|
|
||||||
};
|
|
||||||
export function getTheme() {
|
export function getTheme() {
|
||||||
return theme;
|
return theme;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@strudel/draw",
|
"name": "@strudel/draw",
|
||||||
"version": "1.1.0",
|
"version": "1.0.1",
|
||||||
"description": "Helpers for drawing with Strudel",
|
"description": "Helpers for drawing with Strudel",
|
||||||
"main": "index.mjs",
|
"main": "index.mjs",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ export function pianoroll({
|
|||||||
active = getTheme().foreground,
|
active = getTheme().foreground,
|
||||||
background = 'transparent',
|
background = 'transparent',
|
||||||
smear = 0,
|
smear = 0,
|
||||||
playheadColor = getTheme().foreground,
|
playheadColor = 'white',
|
||||||
minMidi = 10,
|
minMidi = 10,
|
||||||
maxMidi = 90,
|
maxMidi = 90,
|
||||||
autorange = 0,
|
autorange = 0,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@strudel/embed",
|
"name": "@strudel/embed",
|
||||||
"version": "1.1.0",
|
"version": "1.0.0",
|
||||||
"description": "Embeddable Web Component to load a Strudel REPL into an iframe",
|
"description": "Embeddable Web Component to load a Strudel REPL into an iframe",
|
||||||
"main": "embed.js",
|
"main": "embed.js",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
pnpm-lock.yaml
|
|
||||||
vite.config.js
|
|
||||||
@@ -1,661 +0,0 @@
|
|||||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
|
||||||
Version 3, 19 November 2007
|
|
||||||
|
|
||||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
|
||||||
of this license document, but changing it is not allowed.
|
|
||||||
|
|
||||||
Preamble
|
|
||||||
|
|
||||||
The GNU Affero General Public License is a free, copyleft license for
|
|
||||||
software and other kinds of works, specifically designed to ensure
|
|
||||||
cooperation with the community in the case of network server software.
|
|
||||||
|
|
||||||
The licenses for most software and other practical works are designed
|
|
||||||
to take away your freedom to share and change the works. By contrast,
|
|
||||||
our General Public Licenses are intended to guarantee your freedom to
|
|
||||||
share and change all versions of a program--to make sure it remains free
|
|
||||||
software for all its users.
|
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom, not
|
|
||||||
price. Our General Public Licenses are designed to make sure that you
|
|
||||||
have the freedom to distribute copies of free software (and charge for
|
|
||||||
them if you wish), that you receive source code or can get it if you
|
|
||||||
want it, that you can change the software or use pieces of it in new
|
|
||||||
free programs, and that you know you can do these things.
|
|
||||||
|
|
||||||
Developers that use our General Public Licenses protect your rights
|
|
||||||
with two steps: (1) assert copyright on the software, and (2) offer
|
|
||||||
you this License which gives you legal permission to copy, distribute
|
|
||||||
and/or modify the software.
|
|
||||||
|
|
||||||
A secondary benefit of defending all users' freedom is that
|
|
||||||
improvements made in alternate versions of the program, if they
|
|
||||||
receive widespread use, become available for other developers to
|
|
||||||
incorporate. Many developers of free software are heartened and
|
|
||||||
encouraged by the resulting cooperation. However, in the case of
|
|
||||||
software used on network servers, this result may fail to come about.
|
|
||||||
The GNU General Public License permits making a modified version and
|
|
||||||
letting the public access it on a server without ever releasing its
|
|
||||||
source code to the public.
|
|
||||||
|
|
||||||
The GNU Affero General Public License is designed specifically to
|
|
||||||
ensure that, in such cases, the modified source code becomes available
|
|
||||||
to the community. It requires the operator of a network server to
|
|
||||||
provide the source code of the modified version running there to the
|
|
||||||
users of that server. Therefore, public use of a modified version, on
|
|
||||||
a publicly accessible server, gives the public access to the source
|
|
||||||
code of the modified version.
|
|
||||||
|
|
||||||
An older license, called the Affero General Public License and
|
|
||||||
published by Affero, was designed to accomplish similar goals. This is
|
|
||||||
a different license, not a version of the Affero GPL, but Affero has
|
|
||||||
released a new version of the Affero GPL which permits relicensing under
|
|
||||||
this license.
|
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and
|
|
||||||
modification follow.
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
0. Definitions.
|
|
||||||
|
|
||||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
|
||||||
|
|
||||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
|
||||||
works, such as semiconductor masks.
|
|
||||||
|
|
||||||
"The Program" refers to any copyrightable work licensed under this
|
|
||||||
License. Each licensee is addressed as "you". "Licensees" and
|
|
||||||
"recipients" may be individuals or organizations.
|
|
||||||
|
|
||||||
To "modify" a work means to copy from or adapt all or part of the work
|
|
||||||
in a fashion requiring copyright permission, other than the making of an
|
|
||||||
exact copy. The resulting work is called a "modified version" of the
|
|
||||||
earlier work or a work "based on" the earlier work.
|
|
||||||
|
|
||||||
A "covered work" means either the unmodified Program or a work based
|
|
||||||
on the Program.
|
|
||||||
|
|
||||||
To "propagate" a work means to do anything with it that, without
|
|
||||||
permission, would make you directly or secondarily liable for
|
|
||||||
infringement under applicable copyright law, except executing it on a
|
|
||||||
computer or modifying a private copy. Propagation includes copying,
|
|
||||||
distribution (with or without modification), making available to the
|
|
||||||
public, and in some countries other activities as well.
|
|
||||||
|
|
||||||
To "convey" a work means any kind of propagation that enables other
|
|
||||||
parties to make or receive copies. Mere interaction with a user through
|
|
||||||
a computer network, with no transfer of a copy, is not conveying.
|
|
||||||
|
|
||||||
An interactive user interface displays "Appropriate Legal Notices"
|
|
||||||
to the extent that it includes a convenient and prominently visible
|
|
||||||
feature that (1) displays an appropriate copyright notice, and (2)
|
|
||||||
tells the user that there is no warranty for the work (except to the
|
|
||||||
extent that warranties are provided), that licensees may convey the
|
|
||||||
work under this License, and how to view a copy of this License. If
|
|
||||||
the interface presents a list of user commands or options, such as a
|
|
||||||
menu, a prominent item in the list meets this criterion.
|
|
||||||
|
|
||||||
1. Source Code.
|
|
||||||
|
|
||||||
The "source code" for a work means the preferred form of the work
|
|
||||||
for making modifications to it. "Object code" means any non-source
|
|
||||||
form of a work.
|
|
||||||
|
|
||||||
A "Standard Interface" means an interface that either is an official
|
|
||||||
standard defined by a recognized standards body, or, in the case of
|
|
||||||
interfaces specified for a particular programming language, one that
|
|
||||||
is widely used among developers working in that language.
|
|
||||||
|
|
||||||
The "System Libraries" of an executable work include anything, other
|
|
||||||
than the work as a whole, that (a) is included in the normal form of
|
|
||||||
packaging a Major Component, but which is not part of that Major
|
|
||||||
Component, and (b) serves only to enable use of the work with that
|
|
||||||
Major Component, or to implement a Standard Interface for which an
|
|
||||||
implementation is available to the public in source code form. A
|
|
||||||
"Major Component", in this context, means a major essential component
|
|
||||||
(kernel, window system, and so on) of the specific operating system
|
|
||||||
(if any) on which the executable work runs, or a compiler used to
|
|
||||||
produce the work, or an object code interpreter used to run it.
|
|
||||||
|
|
||||||
The "Corresponding Source" for a work in object code form means all
|
|
||||||
the source code needed to generate, install, and (for an executable
|
|
||||||
work) run the object code and to modify the work, including scripts to
|
|
||||||
control those activities. However, it does not include the work's
|
|
||||||
System Libraries, or general-purpose tools or generally available free
|
|
||||||
programs which are used unmodified in performing those activities but
|
|
||||||
which are not part of the work. For example, Corresponding Source
|
|
||||||
includes interface definition files associated with source files for
|
|
||||||
the work, and the source code for shared libraries and dynamically
|
|
||||||
linked subprograms that the work is specifically designed to require,
|
|
||||||
such as by intimate data communication or control flow between those
|
|
||||||
subprograms and other parts of the work.
|
|
||||||
|
|
||||||
The Corresponding Source need not include anything that users
|
|
||||||
can regenerate automatically from other parts of the Corresponding
|
|
||||||
Source.
|
|
||||||
|
|
||||||
The Corresponding Source for a work in source code form is that
|
|
||||||
same work.
|
|
||||||
|
|
||||||
2. Basic Permissions.
|
|
||||||
|
|
||||||
All rights granted under this License are granted for the term of
|
|
||||||
copyright on the Program, and are irrevocable provided the stated
|
|
||||||
conditions are met. This License explicitly affirms your unlimited
|
|
||||||
permission to run the unmodified Program. The output from running a
|
|
||||||
covered work is covered by this License only if the output, given its
|
|
||||||
content, constitutes a covered work. This License acknowledges your
|
|
||||||
rights of fair use or other equivalent, as provided by copyright law.
|
|
||||||
|
|
||||||
You may make, run and propagate covered works that you do not
|
|
||||||
convey, without conditions so long as your license otherwise remains
|
|
||||||
in force. You may convey covered works to others for the sole purpose
|
|
||||||
of having them make modifications exclusively for you, or provide you
|
|
||||||
with facilities for running those works, provided that you comply with
|
|
||||||
the terms of this License in conveying all material for which you do
|
|
||||||
not control copyright. Those thus making or running the covered works
|
|
||||||
for you must do so exclusively on your behalf, under your direction
|
|
||||||
and control, on terms that prohibit them from making any copies of
|
|
||||||
your copyrighted material outside their relationship with you.
|
|
||||||
|
|
||||||
Conveying under any other circumstances is permitted solely under
|
|
||||||
the conditions stated below. Sublicensing is not allowed; section 10
|
|
||||||
makes it unnecessary.
|
|
||||||
|
|
||||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
|
||||||
|
|
||||||
No covered work shall be deemed part of an effective technological
|
|
||||||
measure under any applicable law fulfilling obligations under article
|
|
||||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
|
||||||
similar laws prohibiting or restricting circumvention of such
|
|
||||||
measures.
|
|
||||||
|
|
||||||
When you convey a covered work, you waive any legal power to forbid
|
|
||||||
circumvention of technological measures to the extent such circumvention
|
|
||||||
is effected by exercising rights under this License with respect to
|
|
||||||
the covered work, and you disclaim any intention to limit operation or
|
|
||||||
modification of the work as a means of enforcing, against the work's
|
|
||||||
users, your or third parties' legal rights to forbid circumvention of
|
|
||||||
technological measures.
|
|
||||||
|
|
||||||
4. Conveying Verbatim Copies.
|
|
||||||
|
|
||||||
You may convey verbatim copies of the Program's source code as you
|
|
||||||
receive it, in any medium, provided that you conspicuously and
|
|
||||||
appropriately publish on each copy an appropriate copyright notice;
|
|
||||||
keep intact all notices stating that this License and any
|
|
||||||
non-permissive terms added in accord with section 7 apply to the code;
|
|
||||||
keep intact all notices of the absence of any warranty; and give all
|
|
||||||
recipients a copy of this License along with the Program.
|
|
||||||
|
|
||||||
You may charge any price or no price for each copy that you convey,
|
|
||||||
and you may offer support or warranty protection for a fee.
|
|
||||||
|
|
||||||
5. Conveying Modified Source Versions.
|
|
||||||
|
|
||||||
You may convey a work based on the Program, or the modifications to
|
|
||||||
produce it from the Program, in the form of source code under the
|
|
||||||
terms of section 4, provided that you also meet all of these conditions:
|
|
||||||
|
|
||||||
a) The work must carry prominent notices stating that you modified
|
|
||||||
it, and giving a relevant date.
|
|
||||||
|
|
||||||
b) The work must carry prominent notices stating that it is
|
|
||||||
released under this License and any conditions added under section
|
|
||||||
7. This requirement modifies the requirement in section 4 to
|
|
||||||
"keep intact all notices".
|
|
||||||
|
|
||||||
c) You must license the entire work, as a whole, under this
|
|
||||||
License to anyone who comes into possession of a copy. This
|
|
||||||
License will therefore apply, along with any applicable section 7
|
|
||||||
additional terms, to the whole of the work, and all its parts,
|
|
||||||
regardless of how they are packaged. This License gives no
|
|
||||||
permission to license the work in any other way, but it does not
|
|
||||||
invalidate such permission if you have separately received it.
|
|
||||||
|
|
||||||
d) If the work has interactive user interfaces, each must display
|
|
||||||
Appropriate Legal Notices; however, if the Program has interactive
|
|
||||||
interfaces that do not display Appropriate Legal Notices, your
|
|
||||||
work need not make them do so.
|
|
||||||
|
|
||||||
A compilation of a covered work with other separate and independent
|
|
||||||
works, which are not by their nature extensions of the covered work,
|
|
||||||
and which are not combined with it such as to form a larger program,
|
|
||||||
in or on a volume of a storage or distribution medium, is called an
|
|
||||||
"aggregate" if the compilation and its resulting copyright are not
|
|
||||||
used to limit the access or legal rights of the compilation's users
|
|
||||||
beyond what the individual works permit. Inclusion of a covered work
|
|
||||||
in an aggregate does not cause this License to apply to the other
|
|
||||||
parts of the aggregate.
|
|
||||||
|
|
||||||
6. Conveying Non-Source Forms.
|
|
||||||
|
|
||||||
You may convey a covered work in object code form under the terms
|
|
||||||
of sections 4 and 5, provided that you also convey the
|
|
||||||
machine-readable Corresponding Source under the terms of this License,
|
|
||||||
in one of these ways:
|
|
||||||
|
|
||||||
a) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by the
|
|
||||||
Corresponding Source fixed on a durable physical medium
|
|
||||||
customarily used for software interchange.
|
|
||||||
|
|
||||||
b) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by a
|
|
||||||
written offer, valid for at least three years and valid for as
|
|
||||||
long as you offer spare parts or customer support for that product
|
|
||||||
model, to give anyone who possesses the object code either (1) a
|
|
||||||
copy of the Corresponding Source for all the software in the
|
|
||||||
product that is covered by this License, on a durable physical
|
|
||||||
medium customarily used for software interchange, for a price no
|
|
||||||
more than your reasonable cost of physically performing this
|
|
||||||
conveying of source, or (2) access to copy the
|
|
||||||
Corresponding Source from a network server at no charge.
|
|
||||||
|
|
||||||
c) Convey individual copies of the object code with a copy of the
|
|
||||||
written offer to provide the Corresponding Source. This
|
|
||||||
alternative is allowed only occasionally and noncommercially, and
|
|
||||||
only if you received the object code with such an offer, in accord
|
|
||||||
with subsection 6b.
|
|
||||||
|
|
||||||
d) Convey the object code by offering access from a designated
|
|
||||||
place (gratis or for a charge), and offer equivalent access to the
|
|
||||||
Corresponding Source in the same way through the same place at no
|
|
||||||
further charge. You need not require recipients to copy the
|
|
||||||
Corresponding Source along with the object code. If the place to
|
|
||||||
copy the object code is a network server, the Corresponding Source
|
|
||||||
may be on a different server (operated by you or a third party)
|
|
||||||
that supports equivalent copying facilities, provided you maintain
|
|
||||||
clear directions next to the object code saying where to find the
|
|
||||||
Corresponding Source. Regardless of what server hosts the
|
|
||||||
Corresponding Source, you remain obligated to ensure that it is
|
|
||||||
available for as long as needed to satisfy these requirements.
|
|
||||||
|
|
||||||
e) Convey the object code using peer-to-peer transmission, provided
|
|
||||||
you inform other peers where the object code and Corresponding
|
|
||||||
Source of the work are being offered to the general public at no
|
|
||||||
charge under subsection 6d.
|
|
||||||
|
|
||||||
A separable portion of the object code, whose source code is excluded
|
|
||||||
from the Corresponding Source as a System Library, need not be
|
|
||||||
included in conveying the object code work.
|
|
||||||
|
|
||||||
A "User Product" is either (1) a "consumer product", which means any
|
|
||||||
tangible personal property which is normally used for personal, family,
|
|
||||||
or household purposes, or (2) anything designed or sold for incorporation
|
|
||||||
into a dwelling. In determining whether a product is a consumer product,
|
|
||||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
|
||||||
product received by a particular user, "normally used" refers to a
|
|
||||||
typical or common use of that class of product, regardless of the status
|
|
||||||
of the particular user or of the way in which the particular user
|
|
||||||
actually uses, or expects or is expected to use, the product. A product
|
|
||||||
is a consumer product regardless of whether the product has substantial
|
|
||||||
commercial, industrial or non-consumer uses, unless such uses represent
|
|
||||||
the only significant mode of use of the product.
|
|
||||||
|
|
||||||
"Installation Information" for a User Product means any methods,
|
|
||||||
procedures, authorization keys, or other information required to install
|
|
||||||
and execute modified versions of a covered work in that User Product from
|
|
||||||
a modified version of its Corresponding Source. The information must
|
|
||||||
suffice to ensure that the continued functioning of the modified object
|
|
||||||
code is in no case prevented or interfered with solely because
|
|
||||||
modification has been made.
|
|
||||||
|
|
||||||
If you convey an object code work under this section in, or with, or
|
|
||||||
specifically for use in, a User Product, and the conveying occurs as
|
|
||||||
part of a transaction in which the right of possession and use of the
|
|
||||||
User Product is transferred to the recipient in perpetuity or for a
|
|
||||||
fixed term (regardless of how the transaction is characterized), the
|
|
||||||
Corresponding Source conveyed under this section must be accompanied
|
|
||||||
by the Installation Information. But this requirement does not apply
|
|
||||||
if neither you nor any third party retains the ability to install
|
|
||||||
modified object code on the User Product (for example, the work has
|
|
||||||
been installed in ROM).
|
|
||||||
|
|
||||||
The requirement to provide Installation Information does not include a
|
|
||||||
requirement to continue to provide support service, warranty, or updates
|
|
||||||
for a work that has been modified or installed by the recipient, or for
|
|
||||||
the User Product in which it has been modified or installed. Access to a
|
|
||||||
network may be denied when the modification itself materially and
|
|
||||||
adversely affects the operation of the network or violates the rules and
|
|
||||||
protocols for communication across the network.
|
|
||||||
|
|
||||||
Corresponding Source conveyed, and Installation Information provided,
|
|
||||||
in accord with this section must be in a format that is publicly
|
|
||||||
documented (and with an implementation available to the public in
|
|
||||||
source code form), and must require no special password or key for
|
|
||||||
unpacking, reading or copying.
|
|
||||||
|
|
||||||
7. Additional Terms.
|
|
||||||
|
|
||||||
"Additional permissions" are terms that supplement the terms of this
|
|
||||||
License by making exceptions from one or more of its conditions.
|
|
||||||
Additional permissions that are applicable to the entire Program shall
|
|
||||||
be treated as though they were included in this License, to the extent
|
|
||||||
that they are valid under applicable law. If additional permissions
|
|
||||||
apply only to part of the Program, that part may be used separately
|
|
||||||
under those permissions, but the entire Program remains governed by
|
|
||||||
this License without regard to the additional permissions.
|
|
||||||
|
|
||||||
When you convey a copy of a covered work, you may at your option
|
|
||||||
remove any additional permissions from that copy, or from any part of
|
|
||||||
it. (Additional permissions may be written to require their own
|
|
||||||
removal in certain cases when you modify the work.) You may place
|
|
||||||
additional permissions on material, added by you to a covered work,
|
|
||||||
for which you have or can give appropriate copyright permission.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, for material you
|
|
||||||
add to a covered work, you may (if authorized by the copyright holders of
|
|
||||||
that material) supplement the terms of this License with terms:
|
|
||||||
|
|
||||||
a) Disclaiming warranty or limiting liability differently from the
|
|
||||||
terms of sections 15 and 16 of this License; or
|
|
||||||
|
|
||||||
b) Requiring preservation of specified reasonable legal notices or
|
|
||||||
author attributions in that material or in the Appropriate Legal
|
|
||||||
Notices displayed by works containing it; or
|
|
||||||
|
|
||||||
c) Prohibiting misrepresentation of the origin of that material, or
|
|
||||||
requiring that modified versions of such material be marked in
|
|
||||||
reasonable ways as different from the original version; or
|
|
||||||
|
|
||||||
d) Limiting the use for publicity purposes of names of licensors or
|
|
||||||
authors of the material; or
|
|
||||||
|
|
||||||
e) Declining to grant rights under trademark law for use of some
|
|
||||||
trade names, trademarks, or service marks; or
|
|
||||||
|
|
||||||
f) Requiring indemnification of licensors and authors of that
|
|
||||||
material by anyone who conveys the material (or modified versions of
|
|
||||||
it) with contractual assumptions of liability to the recipient, for
|
|
||||||
any liability that these contractual assumptions directly impose on
|
|
||||||
those licensors and authors.
|
|
||||||
|
|
||||||
All other non-permissive additional terms are considered "further
|
|
||||||
restrictions" within the meaning of section 10. If the Program as you
|
|
||||||
received it, or any part of it, contains a notice stating that it is
|
|
||||||
governed by this License along with a term that is a further
|
|
||||||
restriction, you may remove that term. If a license document contains
|
|
||||||
a further restriction but permits relicensing or conveying under this
|
|
||||||
License, you may add to a covered work material governed by the terms
|
|
||||||
of that license document, provided that the further restriction does
|
|
||||||
not survive such relicensing or conveying.
|
|
||||||
|
|
||||||
If you add terms to a covered work in accord with this section, you
|
|
||||||
must place, in the relevant source files, a statement of the
|
|
||||||
additional terms that apply to those files, or a notice indicating
|
|
||||||
where to find the applicable terms.
|
|
||||||
|
|
||||||
Additional terms, permissive or non-permissive, may be stated in the
|
|
||||||
form of a separately written license, or stated as exceptions;
|
|
||||||
the above requirements apply either way.
|
|
||||||
|
|
||||||
8. Termination.
|
|
||||||
|
|
||||||
You may not propagate or modify a covered work except as expressly
|
|
||||||
provided under this License. Any attempt otherwise to propagate or
|
|
||||||
modify it is void, and will automatically terminate your rights under
|
|
||||||
this License (including any patent licenses granted under the third
|
|
||||||
paragraph of section 11).
|
|
||||||
|
|
||||||
However, if you cease all violation of this License, then your
|
|
||||||
license from a particular copyright holder is reinstated (a)
|
|
||||||
provisionally, unless and until the copyright holder explicitly and
|
|
||||||
finally terminates your license, and (b) permanently, if the copyright
|
|
||||||
holder fails to notify you of the violation by some reasonable means
|
|
||||||
prior to 60 days after the cessation.
|
|
||||||
|
|
||||||
Moreover, your license from a particular copyright holder is
|
|
||||||
reinstated permanently if the copyright holder notifies you of the
|
|
||||||
violation by some reasonable means, this is the first time you have
|
|
||||||
received notice of violation of this License (for any work) from that
|
|
||||||
copyright holder, and you cure the violation prior to 30 days after
|
|
||||||
your receipt of the notice.
|
|
||||||
|
|
||||||
Termination of your rights under this section does not terminate the
|
|
||||||
licenses of parties who have received copies or rights from you under
|
|
||||||
this License. If your rights have been terminated and not permanently
|
|
||||||
reinstated, you do not qualify to receive new licenses for the same
|
|
||||||
material under section 10.
|
|
||||||
|
|
||||||
9. Acceptance Not Required for Having Copies.
|
|
||||||
|
|
||||||
You are not required to accept this License in order to receive or
|
|
||||||
run a copy of the Program. Ancillary propagation of a covered work
|
|
||||||
occurring solely as a consequence of using peer-to-peer transmission
|
|
||||||
to receive a copy likewise does not require acceptance. However,
|
|
||||||
nothing other than this License grants you permission to propagate or
|
|
||||||
modify any covered work. These actions infringe copyright if you do
|
|
||||||
not accept this License. Therefore, by modifying or propagating a
|
|
||||||
covered work, you indicate your acceptance of this License to do so.
|
|
||||||
|
|
||||||
10. Automatic Licensing of Downstream Recipients.
|
|
||||||
|
|
||||||
Each time you convey a covered work, the recipient automatically
|
|
||||||
receives a license from the original licensors, to run, modify and
|
|
||||||
propagate that work, subject to this License. You are not responsible
|
|
||||||
for enforcing compliance by third parties with this License.
|
|
||||||
|
|
||||||
An "entity transaction" is a transaction transferring control of an
|
|
||||||
organization, or substantially all assets of one, or subdividing an
|
|
||||||
organization, or merging organizations. If propagation of a covered
|
|
||||||
work results from an entity transaction, each party to that
|
|
||||||
transaction who receives a copy of the work also receives whatever
|
|
||||||
licenses to the work the party's predecessor in interest had or could
|
|
||||||
give under the previous paragraph, plus a right to possession of the
|
|
||||||
Corresponding Source of the work from the predecessor in interest, if
|
|
||||||
the predecessor has it or can get it with reasonable efforts.
|
|
||||||
|
|
||||||
You may not impose any further restrictions on the exercise of the
|
|
||||||
rights granted or affirmed under this License. For example, you may
|
|
||||||
not impose a license fee, royalty, or other charge for exercise of
|
|
||||||
rights granted under this License, and you may not initiate litigation
|
|
||||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
|
||||||
any patent claim is infringed by making, using, selling, offering for
|
|
||||||
sale, or importing the Program or any portion of it.
|
|
||||||
|
|
||||||
11. Patents.
|
|
||||||
|
|
||||||
A "contributor" is a copyright holder who authorizes use under this
|
|
||||||
License of the Program or a work on which the Program is based. The
|
|
||||||
work thus licensed is called the contributor's "contributor version".
|
|
||||||
|
|
||||||
A contributor's "essential patent claims" are all patent claims
|
|
||||||
owned or controlled by the contributor, whether already acquired or
|
|
||||||
hereafter acquired, that would be infringed by some manner, permitted
|
|
||||||
by this License, of making, using, or selling its contributor version,
|
|
||||||
but do not include claims that would be infringed only as a
|
|
||||||
consequence of further modification of the contributor version. For
|
|
||||||
purposes of this definition, "control" includes the right to grant
|
|
||||||
patent sublicenses in a manner consistent with the requirements of
|
|
||||||
this License.
|
|
||||||
|
|
||||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
|
||||||
patent license under the contributor's essential patent claims, to
|
|
||||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
|
||||||
propagate the contents of its contributor version.
|
|
||||||
|
|
||||||
In the following three paragraphs, a "patent license" is any express
|
|
||||||
agreement or commitment, however denominated, not to enforce a patent
|
|
||||||
(such as an express permission to practice a patent or covenant not to
|
|
||||||
sue for patent infringement). To "grant" such a patent license to a
|
|
||||||
party means to make such an agreement or commitment not to enforce a
|
|
||||||
patent against the party.
|
|
||||||
|
|
||||||
If you convey a covered work, knowingly relying on a patent license,
|
|
||||||
and the Corresponding Source of the work is not available for anyone
|
|
||||||
to copy, free of charge and under the terms of this License, through a
|
|
||||||
publicly available network server or other readily accessible means,
|
|
||||||
then you must either (1) cause the Corresponding Source to be so
|
|
||||||
available, or (2) arrange to deprive yourself of the benefit of the
|
|
||||||
patent license for this particular work, or (3) arrange, in a manner
|
|
||||||
consistent with the requirements of this License, to extend the patent
|
|
||||||
license to downstream recipients. "Knowingly relying" means you have
|
|
||||||
actual knowledge that, but for the patent license, your conveying the
|
|
||||||
covered work in a country, or your recipient's use of the covered work
|
|
||||||
in a country, would infringe one or more identifiable patents in that
|
|
||||||
country that you have reason to believe are valid.
|
|
||||||
|
|
||||||
If, pursuant to or in connection with a single transaction or
|
|
||||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
|
||||||
covered work, and grant a patent license to some of the parties
|
|
||||||
receiving the covered work authorizing them to use, propagate, modify
|
|
||||||
or convey a specific copy of the covered work, then the patent license
|
|
||||||
you grant is automatically extended to all recipients of the covered
|
|
||||||
work and works based on it.
|
|
||||||
|
|
||||||
A patent license is "discriminatory" if it does not include within
|
|
||||||
the scope of its coverage, prohibits the exercise of, or is
|
|
||||||
conditioned on the non-exercise of one or more of the rights that are
|
|
||||||
specifically granted under this License. You may not convey a covered
|
|
||||||
work if you are a party to an arrangement with a third party that is
|
|
||||||
in the business of distributing software, under which you make payment
|
|
||||||
to the third party based on the extent of your activity of conveying
|
|
||||||
the work, and under which the third party grants, to any of the
|
|
||||||
parties who would receive the covered work from you, a discriminatory
|
|
||||||
patent license (a) in connection with copies of the covered work
|
|
||||||
conveyed by you (or copies made from those copies), or (b) primarily
|
|
||||||
for and in connection with specific products or compilations that
|
|
||||||
contain the covered work, unless you entered into that arrangement,
|
|
||||||
or that patent license was granted, prior to 28 March 2007.
|
|
||||||
|
|
||||||
Nothing in this License shall be construed as excluding or limiting
|
|
||||||
any implied license or other defenses to infringement that may
|
|
||||||
otherwise be available to you under applicable patent law.
|
|
||||||
|
|
||||||
12. No Surrender of Others' Freedom.
|
|
||||||
|
|
||||||
If conditions are imposed on you (whether by court order, agreement or
|
|
||||||
otherwise) that contradict the conditions of this License, they do not
|
|
||||||
excuse you from the conditions of this License. If you cannot convey a
|
|
||||||
covered work so as to satisfy simultaneously your obligations under this
|
|
||||||
License and any other pertinent obligations, then as a consequence you may
|
|
||||||
not convey it at all. For example, if you agree to terms that obligate you
|
|
||||||
to collect a royalty for further conveying from those to whom you convey
|
|
||||||
the Program, the only way you could satisfy both those terms and this
|
|
||||||
License would be to refrain entirely from conveying the Program.
|
|
||||||
|
|
||||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, if you modify the
|
|
||||||
Program, your modified version must prominently offer all users
|
|
||||||
interacting with it remotely through a computer network (if your version
|
|
||||||
supports such interaction) an opportunity to receive the Corresponding
|
|
||||||
Source of your version by providing access to the Corresponding Source
|
|
||||||
from a network server at no charge, through some standard or customary
|
|
||||||
means of facilitating copying of software. This Corresponding Source
|
|
||||||
shall include the Corresponding Source for any work covered by version 3
|
|
||||||
of the GNU General Public License that is incorporated pursuant to the
|
|
||||||
following paragraph.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, you have
|
|
||||||
permission to link or combine any covered work with a work licensed
|
|
||||||
under version 3 of the GNU General Public License into a single
|
|
||||||
combined work, and to convey the resulting work. The terms of this
|
|
||||||
License will continue to apply to the part which is the covered work,
|
|
||||||
but the work with which it is combined will remain governed by version
|
|
||||||
3 of the GNU General Public License.
|
|
||||||
|
|
||||||
14. Revised Versions of this License.
|
|
||||||
|
|
||||||
The Free Software Foundation may publish revised and/or new versions of
|
|
||||||
the GNU Affero General Public License from time to time. Such new versions
|
|
||||||
will be similar in spirit to the present version, but may differ in detail to
|
|
||||||
address new problems or concerns.
|
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the
|
|
||||||
Program specifies that a certain numbered version of the GNU Affero General
|
|
||||||
Public License "or any later version" applies to it, you have the
|
|
||||||
option of following the terms and conditions either of that numbered
|
|
||||||
version or of any later version published by the Free Software
|
|
||||||
Foundation. If the Program does not specify a version number of the
|
|
||||||
GNU Affero General Public License, you may choose any version ever published
|
|
||||||
by the Free Software Foundation.
|
|
||||||
|
|
||||||
If the Program specifies that a proxy can decide which future
|
|
||||||
versions of the GNU Affero General Public License can be used, that proxy's
|
|
||||||
public statement of acceptance of a version permanently authorizes you
|
|
||||||
to choose that version for the Program.
|
|
||||||
|
|
||||||
Later license versions may give you additional or different
|
|
||||||
permissions. However, no additional obligations are imposed on any
|
|
||||||
author or copyright holder as a result of your choosing to follow a
|
|
||||||
later version.
|
|
||||||
|
|
||||||
15. Disclaimer of Warranty.
|
|
||||||
|
|
||||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
|
||||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
|
||||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
|
||||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
|
||||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
|
||||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
|
||||||
|
|
||||||
16. Limitation of Liability.
|
|
||||||
|
|
||||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
|
||||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
|
||||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
|
||||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
|
||||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
|
||||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
|
||||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
|
||||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
|
||||||
SUCH DAMAGES.
|
|
||||||
|
|
||||||
17. Interpretation of Sections 15 and 16.
|
|
||||||
|
|
||||||
If the disclaimer of warranty and limitation of liability provided
|
|
||||||
above cannot be given local legal effect according to their terms,
|
|
||||||
reviewing courts shall apply local law that most closely approximates
|
|
||||||
an absolute waiver of all civil liability in connection with the
|
|
||||||
Program, unless a warranty or assumption of liability accompanies a
|
|
||||||
copy of the Program in return for a fee.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
How to Apply These Terms to Your New Programs
|
|
||||||
|
|
||||||
If you develop a new program, and you want it to be of the greatest
|
|
||||||
possible use to the public, the best way to achieve this is to make it
|
|
||||||
free software which everyone can redistribute and change under these terms.
|
|
||||||
|
|
||||||
To do so, attach the following notices to the program. It is safest
|
|
||||||
to attach them to the start of each source file to most effectively
|
|
||||||
state the exclusion of warranty; and each file should have at least
|
|
||||||
the "copyright" line and a pointer to where the full notice is found.
|
|
||||||
|
|
||||||
<one line to give the program's name and a brief idea of what it does.>
|
|
||||||
Copyright (C) <year> <name of author>
|
|
||||||
|
|
||||||
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/>.
|
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
|
||||||
|
|
||||||
If your software can interact with users remotely through a computer
|
|
||||||
network, you should also make sure that it provides a way for users to
|
|
||||||
get its source. For example, if your program is a web application, its
|
|
||||||
interface could display a "Source" link that leads users to an archive
|
|
||||||
of the code. There are many ways you could offer source, and different
|
|
||||||
solutions will be better for different programs; see section 13 for the
|
|
||||||
specific requirements.
|
|
||||||
|
|
||||||
You should also get your employer (if you work as a programmer) or school,
|
|
||||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
|
||||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
|
||||||
<https://www.gnu.org/licenses/>.
|
|
||||||
@@ -1,127 +0,0 @@
|
|||||||
# hs2js
|
|
||||||
|
|
||||||
Experimental haskell in javascript interpreter. Many haskell features are not implemented.
|
|
||||||
This projects mainly exists to be able to write and interpret [Tidal Cycles](https://tidalcycles.org/) code in the browser,
|
|
||||||
as part of [Strudel](https://github.com/tidalcycles/strudel). This project could only exist thanks to [tree-sitter-haskell](https://github.com/tree-sitter/tree-sitter-haskell).
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
### Via Script Tag
|
|
||||||
|
|
||||||
You can load the library directly from a script tag via unpkg:
|
|
||||||
|
|
||||||
```html
|
|
||||||
<script src="https://unpkg.com/hs2js@0.0.3"></script>
|
|
||||||
<button id="hello">hello</button>
|
|
||||||
<script>
|
|
||||||
hs2js.setBase('https://unpkg.com/hs2js@0.0.3/dist/');
|
|
||||||
hs2js.loadParser().then(()=>{
|
|
||||||
document.getElementById('hello').addEventListener('click', () => {
|
|
||||||
hs2js.evaluate('alert "hello from haskell!"');
|
|
||||||
});
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
```
|
|
||||||
|
|
||||||
### Via npm
|
|
||||||
|
|
||||||
You need to add `postinstall` to your `package.json` script to copy the parser to your `public` folder:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"scripts": {
|
|
||||||
"postinstall": "cp node_modules/hs2js/dist/tree-sitter.wasm public && cp node_modules/hs2js/dist/tree-sitter-haskell.wasm public"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Depending on your setup, replace `public` with the folder that will serve your assets to `/`. Then install the package:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
npm i hs2js
|
|
||||||
```
|
|
||||||
|
|
||||||
and use it:
|
|
||||||
|
|
||||||
```js
|
|
||||||
import * as hs2js from 'hs2js';
|
|
||||||
hs2js.loadParser();
|
|
||||||
document.getElementById('hello').addEventListener('click', () => {
|
|
||||||
hs2js.evaluate('alert "hello from haskell!"');
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
## API
|
|
||||||
|
|
||||||
These are all functions exported by the package:
|
|
||||||
|
|
||||||
### evaluate
|
|
||||||
|
|
||||||
Evaluates a piece of haskell code
|
|
||||||
|
|
||||||
- `code`: [valid](https://github.com/tree-sitter/tree-sitter-haskell?tab=readme-ov-file#supported-language-extensions) haskell code
|
|
||||||
- `scope`: global scope, defaults to globalThis. Allows you to pass an object of your own functions / variables from JS to Haskell.
|
|
||||||
- `ops`: mapping for custom infix operator
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
```js
|
|
||||||
// simple
|
|
||||||
hs2js.evaluate(`2 + 2`) // = 4
|
|
||||||
// passing variables via scope:
|
|
||||||
hs2js.evaluate(`a + b`, { a: 1, b: 2 }) // = 3
|
|
||||||
// custom operator
|
|
||||||
hs2js.evaluate(`2 |* 3`, {}, { '|*': (l, r) => l * r }) // = 6
|
|
||||||
```
|
|
||||||
|
|
||||||
### parse
|
|
||||||
|
|
||||||
[Parses](https://github.com/tree-sitter/tree-sitter-haskell) a piece of haskell code, returning its AST representation.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
```js
|
|
||||||
const ast = hs2js.parse(`2 + 2`)
|
|
||||||
console.log(ast.toString())
|
|
||||||
// (haskell declarations: (declarations (top_splice (apply function: (variable) argument: (literal (integer))))))
|
|
||||||
```
|
|
||||||
|
|
||||||
### run
|
|
||||||
|
|
||||||
Evaluates `rootNode` of haskell AST (used by evaluate internally).
|
|
||||||
|
|
||||||
- `rootNode`: haskell AST root node, as returned by `parse`
|
|
||||||
- `scope`: see evaluate
|
|
||||||
- `ops`: see evaluate
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
```js
|
|
||||||
const ast = hs2js.parse(`2 + 3`);
|
|
||||||
const res = hs2js.run(ast.rootNode);
|
|
||||||
console.log(res); // = 5
|
|
||||||
```
|
|
||||||
|
|
||||||
### loadParser
|
|
||||||
|
|
||||||
Loads and caches the parser by fetching `tree-sitter.wasm` and `tree-sitter-haskell.wasm`.
|
|
||||||
Make sure to call and await this function before calling `parse` or `evaluate`.
|
|
||||||
|
|
||||||
```js
|
|
||||||
hs2js.loadParser().then(() => hs2js.evaluate('alert "ready"'))
|
|
||||||
```
|
|
||||||
|
|
||||||
### setBase
|
|
||||||
|
|
||||||
Sets the base path where the WASM files are expected by `loadParser`. Defaults to `/`.
|
|
||||||
Expects `tree-sitter.wasm` and `tree-sitter-haskell.wasm` to be present.
|
|
||||||
Can either be a relative path or a URL.
|
|
||||||
|
|
||||||
```js
|
|
||||||
hs2js.setBase('https://unpkg.com/hs2js@0.0.4/dist/');
|
|
||||||
hs2js.loadParser();
|
|
||||||
/* loads
|
|
||||||
- https://unpkg.com/hs2js@0.0.4/dist/tree-sitter.wasm
|
|
||||||
- https://unpkg.com/hs2js@0.0.4/dist/tree-sitter-haskell.wasm
|
|
||||||
*/
|
|
||||||
```
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "hs2js",
|
|
||||||
"version": "0.1.0",
|
|
||||||
"description": "Experimental Haskell in JavaScript interpreter",
|
|
||||||
"main": "src/index.mjs",
|
|
||||||
"type": "module",
|
|
||||||
"publishConfig": {
|
|
||||||
"main": "dist/index.js",
|
|
||||||
"module": "dist/index.mjs"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"build-wasm": "tree-sitter build-wasm node_modules/tree-sitter-haskell && mv tree-sitter-haskell.wasm ./dist/ && cp node_modules/web-tree-sitter/tree-sitter.wasm ./dist/",
|
|
||||||
"build": "vite build && npm run build-wasm",
|
|
||||||
"prepublishOnly": "npm run build"
|
|
||||||
},
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/tidalcycles/strudel.git"
|
|
||||||
},
|
|
||||||
"keywords": [
|
|
||||||
"haskell",
|
|
||||||
"javascript"
|
|
||||||
],
|
|
||||||
"author": "Felix Roos <flix91@gmail.com>",
|
|
||||||
"license": "AGPL-3.0-or-later",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/tidalcycles/strudel/issues"
|
|
||||||
},
|
|
||||||
"homepage": "https://github.com/tidalcycles/strudel",
|
|
||||||
"dependencies": {
|
|
||||||
"web-tree-sitter": "^0.20.8"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"tree-sitter-haskell": "^0.21.0",
|
|
||||||
"vite": "^5.0.10"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Generated
-520
@@ -1,520 +0,0 @@
|
|||||||
lockfileVersion: '6.0'
|
|
||||||
|
|
||||||
settings:
|
|
||||||
autoInstallPeers: true
|
|
||||||
excludeLinksFromLockfile: false
|
|
||||||
|
|
||||||
dependencies:
|
|
||||||
web-tree-sitter:
|
|
||||||
specifier: ^0.20.8
|
|
||||||
version: 0.20.8
|
|
||||||
|
|
||||||
devDependencies:
|
|
||||||
tree-sitter-haskell:
|
|
||||||
specifier: ^0.21.0
|
|
||||||
version: 0.21.0(tree-sitter@0.21.1)
|
|
||||||
vite:
|
|
||||||
specifier: ^5.0.10
|
|
||||||
version: 5.2.11
|
|
||||||
|
|
||||||
packages:
|
|
||||||
|
|
||||||
/@esbuild/aix-ppc64@0.20.2:
|
|
||||||
resolution: {integrity: sha512-D+EBOJHXdNZcLJRBkhENNG8Wji2kgc9AZ9KiPr1JuZjsNtyHzrsfLRrY0tk2H2aoFu6RANO1y1iPPUCDYWkb5g==}
|
|
||||||
engines: {node: '>=12'}
|
|
||||||
cpu: [ppc64]
|
|
||||||
os: [aix]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@esbuild/android-arm64@0.20.2:
|
|
||||||
resolution: {integrity: sha512-mRzjLacRtl/tWU0SvD8lUEwb61yP9cqQo6noDZP/O8VkwafSYwZ4yWy24kan8jE/IMERpYncRt2dw438LP3Xmg==}
|
|
||||||
engines: {node: '>=12'}
|
|
||||||
cpu: [arm64]
|
|
||||||
os: [android]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@esbuild/android-arm@0.20.2:
|
|
||||||
resolution: {integrity: sha512-t98Ra6pw2VaDhqNWO2Oph2LXbz/EJcnLmKLGBJwEwXX/JAN83Fym1rU8l0JUWK6HkIbWONCSSatf4sf2NBRx/w==}
|
|
||||||
engines: {node: '>=12'}
|
|
||||||
cpu: [arm]
|
|
||||||
os: [android]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@esbuild/android-x64@0.20.2:
|
|
||||||
resolution: {integrity: sha512-btzExgV+/lMGDDa194CcUQm53ncxzeBrWJcncOBxuC6ndBkKxnHdFJn86mCIgTELsooUmwUm9FkhSp5HYu00Rg==}
|
|
||||||
engines: {node: '>=12'}
|
|
||||||
cpu: [x64]
|
|
||||||
os: [android]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@esbuild/darwin-arm64@0.20.2:
|
|
||||||
resolution: {integrity: sha512-4J6IRT+10J3aJH3l1yzEg9y3wkTDgDk7TSDFX+wKFiWjqWp/iCfLIYzGyasx9l0SAFPT1HwSCR+0w/h1ES/MjA==}
|
|
||||||
engines: {node: '>=12'}
|
|
||||||
cpu: [arm64]
|
|
||||||
os: [darwin]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@esbuild/darwin-x64@0.20.2:
|
|
||||||
resolution: {integrity: sha512-tBcXp9KNphnNH0dfhv8KYkZhjc+H3XBkF5DKtswJblV7KlT9EI2+jeA8DgBjp908WEuYll6pF+UStUCfEpdysA==}
|
|
||||||
engines: {node: '>=12'}
|
|
||||||
cpu: [x64]
|
|
||||||
os: [darwin]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@esbuild/freebsd-arm64@0.20.2:
|
|
||||||
resolution: {integrity: sha512-d3qI41G4SuLiCGCFGUrKsSeTXyWG6yem1KcGZVS+3FYlYhtNoNgYrWcvkOoaqMhwXSMrZRl69ArHsGJ9mYdbbw==}
|
|
||||||
engines: {node: '>=12'}
|
|
||||||
cpu: [arm64]
|
|
||||||
os: [freebsd]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@esbuild/freebsd-x64@0.20.2:
|
|
||||||
resolution: {integrity: sha512-d+DipyvHRuqEeM5zDivKV1KuXn9WeRX6vqSqIDgwIfPQtwMP4jaDsQsDncjTDDsExT4lR/91OLjRo8bmC1e+Cw==}
|
|
||||||
engines: {node: '>=12'}
|
|
||||||
cpu: [x64]
|
|
||||||
os: [freebsd]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@esbuild/linux-arm64@0.20.2:
|
|
||||||
resolution: {integrity: sha512-9pb6rBjGvTFNira2FLIWqDk/uaf42sSyLE8j1rnUpuzsODBq7FvpwHYZxQ/It/8b+QOS1RYfqgGFNLRI+qlq2A==}
|
|
||||||
engines: {node: '>=12'}
|
|
||||||
cpu: [arm64]
|
|
||||||
os: [linux]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@esbuild/linux-arm@0.20.2:
|
|
||||||
resolution: {integrity: sha512-VhLPeR8HTMPccbuWWcEUD1Az68TqaTYyj6nfE4QByZIQEQVWBB8vup8PpR7y1QHL3CpcF6xd5WVBU/+SBEvGTg==}
|
|
||||||
engines: {node: '>=12'}
|
|
||||||
cpu: [arm]
|
|
||||||
os: [linux]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@esbuild/linux-ia32@0.20.2:
|
|
||||||
resolution: {integrity: sha512-o10utieEkNPFDZFQm9CoP7Tvb33UutoJqg3qKf1PWVeeJhJw0Q347PxMvBgVVFgouYLGIhFYG0UGdBumROyiig==}
|
|
||||||
engines: {node: '>=12'}
|
|
||||||
cpu: [ia32]
|
|
||||||
os: [linux]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@esbuild/linux-loong64@0.20.2:
|
|
||||||
resolution: {integrity: sha512-PR7sp6R/UC4CFVomVINKJ80pMFlfDfMQMYynX7t1tNTeivQ6XdX5r2XovMmha/VjR1YN/HgHWsVcTRIMkymrgQ==}
|
|
||||||
engines: {node: '>=12'}
|
|
||||||
cpu: [loong64]
|
|
||||||
os: [linux]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@esbuild/linux-mips64el@0.20.2:
|
|
||||||
resolution: {integrity: sha512-4BlTqeutE/KnOiTG5Y6Sb/Hw6hsBOZapOVF6njAESHInhlQAghVVZL1ZpIctBOoTFbQyGW+LsVYZ8lSSB3wkjA==}
|
|
||||||
engines: {node: '>=12'}
|
|
||||||
cpu: [mips64el]
|
|
||||||
os: [linux]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@esbuild/linux-ppc64@0.20.2:
|
|
||||||
resolution: {integrity: sha512-rD3KsaDprDcfajSKdn25ooz5J5/fWBylaaXkuotBDGnMnDP1Uv5DLAN/45qfnf3JDYyJv/ytGHQaziHUdyzaAg==}
|
|
||||||
engines: {node: '>=12'}
|
|
||||||
cpu: [ppc64]
|
|
||||||
os: [linux]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@esbuild/linux-riscv64@0.20.2:
|
|
||||||
resolution: {integrity: sha512-snwmBKacKmwTMmhLlz/3aH1Q9T8v45bKYGE3j26TsaOVtjIag4wLfWSiZykXzXuE1kbCE+zJRmwp+ZbIHinnVg==}
|
|
||||||
engines: {node: '>=12'}
|
|
||||||
cpu: [riscv64]
|
|
||||||
os: [linux]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@esbuild/linux-s390x@0.20.2:
|
|
||||||
resolution: {integrity: sha512-wcWISOobRWNm3cezm5HOZcYz1sKoHLd8VL1dl309DiixxVFoFe/o8HnwuIwn6sXre88Nwj+VwZUvJf4AFxkyrQ==}
|
|
||||||
engines: {node: '>=12'}
|
|
||||||
cpu: [s390x]
|
|
||||||
os: [linux]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@esbuild/linux-x64@0.20.2:
|
|
||||||
resolution: {integrity: sha512-1MdwI6OOTsfQfek8sLwgyjOXAu+wKhLEoaOLTjbijk6E2WONYpH9ZU2mNtR+lZ2B4uwr+usqGuVfFT9tMtGvGw==}
|
|
||||||
engines: {node: '>=12'}
|
|
||||||
cpu: [x64]
|
|
||||||
os: [linux]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@esbuild/netbsd-x64@0.20.2:
|
|
||||||
resolution: {integrity: sha512-K8/DhBxcVQkzYc43yJXDSyjlFeHQJBiowJ0uVL6Tor3jGQfSGHNNJcWxNbOI8v5k82prYqzPuwkzHt3J1T1iZQ==}
|
|
||||||
engines: {node: '>=12'}
|
|
||||||
cpu: [x64]
|
|
||||||
os: [netbsd]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@esbuild/openbsd-x64@0.20.2:
|
|
||||||
resolution: {integrity: sha512-eMpKlV0SThJmmJgiVyN9jTPJ2VBPquf6Kt/nAoo6DgHAoN57K15ZghiHaMvqjCye/uU4X5u3YSMgVBI1h3vKrQ==}
|
|
||||||
engines: {node: '>=12'}
|
|
||||||
cpu: [x64]
|
|
||||||
os: [openbsd]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@esbuild/sunos-x64@0.20.2:
|
|
||||||
resolution: {integrity: sha512-2UyFtRC6cXLyejf/YEld4Hajo7UHILetzE1vsRcGL3earZEW77JxrFjH4Ez2qaTiEfMgAXxfAZCm1fvM/G/o8w==}
|
|
||||||
engines: {node: '>=12'}
|
|
||||||
cpu: [x64]
|
|
||||||
os: [sunos]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@esbuild/win32-arm64@0.20.2:
|
|
||||||
resolution: {integrity: sha512-GRibxoawM9ZCnDxnP3usoUDO9vUkpAxIIZ6GQI+IlVmr5kP3zUq+l17xELTHMWTWzjxa2guPNyrpq1GWmPvcGQ==}
|
|
||||||
engines: {node: '>=12'}
|
|
||||||
cpu: [arm64]
|
|
||||||
os: [win32]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@esbuild/win32-ia32@0.20.2:
|
|
||||||
resolution: {integrity: sha512-HfLOfn9YWmkSKRQqovpnITazdtquEW8/SoHW7pWpuEeguaZI4QnCRW6b+oZTztdBnZOS2hqJ6im/D5cPzBTTlQ==}
|
|
||||||
engines: {node: '>=12'}
|
|
||||||
cpu: [ia32]
|
|
||||||
os: [win32]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@esbuild/win32-x64@0.20.2:
|
|
||||||
resolution: {integrity: sha512-N49X4lJX27+l9jbLKSqZ6bKNjzQvHaT8IIFUy+YIqmXQdjYCToGWwOItDrfby14c78aDd5NHQl29xingXfCdLQ==}
|
|
||||||
engines: {node: '>=12'}
|
|
||||||
cpu: [x64]
|
|
||||||
os: [win32]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@rollup/rollup-android-arm-eabi@4.17.2:
|
|
||||||
resolution: {integrity: sha512-NM0jFxY8bB8QLkoKxIQeObCaDlJKewVlIEkuyYKm5An1tdVZ966w2+MPQ2l8LBZLjR+SgyV+nRkTIunzOYBMLQ==}
|
|
||||||
cpu: [arm]
|
|
||||||
os: [android]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@rollup/rollup-android-arm64@4.17.2:
|
|
||||||
resolution: {integrity: sha512-yeX/Usk7daNIVwkq2uGoq2BYJKZY1JfyLTaHO/jaiSwi/lsf8fTFoQW/n6IdAsx5tx+iotu2zCJwz8MxI6D/Bw==}
|
|
||||||
cpu: [arm64]
|
|
||||||
os: [android]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@rollup/rollup-darwin-arm64@4.17.2:
|
|
||||||
resolution: {integrity: sha512-kcMLpE6uCwls023+kknm71ug7MZOrtXo+y5p/tsg6jltpDtgQY1Eq5sGfHcQfb+lfuKwhBmEURDga9N0ol4YPw==}
|
|
||||||
cpu: [arm64]
|
|
||||||
os: [darwin]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@rollup/rollup-darwin-x64@4.17.2:
|
|
||||||
resolution: {integrity: sha512-AtKwD0VEx0zWkL0ZjixEkp5tbNLzX+FCqGG1SvOu993HnSz4qDI6S4kGzubrEJAljpVkhRSlg5bzpV//E6ysTQ==}
|
|
||||||
cpu: [x64]
|
|
||||||
os: [darwin]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@rollup/rollup-linux-arm-gnueabihf@4.17.2:
|
|
||||||
resolution: {integrity: sha512-3reX2fUHqN7sffBNqmEyMQVj/CKhIHZd4y631duy0hZqI8Qoqf6lTtmAKvJFYa6bhU95B1D0WgzHkmTg33In0A==}
|
|
||||||
cpu: [arm]
|
|
||||||
os: [linux]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@rollup/rollup-linux-arm-musleabihf@4.17.2:
|
|
||||||
resolution: {integrity: sha512-uSqpsp91mheRgw96xtyAGP9FW5ChctTFEoXP0r5FAzj/3ZRv3Uxjtc7taRQSaQM/q85KEKjKsZuiZM3GyUivRg==}
|
|
||||||
cpu: [arm]
|
|
||||||
os: [linux]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@rollup/rollup-linux-arm64-gnu@4.17.2:
|
|
||||||
resolution: {integrity: sha512-EMMPHkiCRtE8Wdk3Qhtciq6BndLtstqZIroHiiGzB3C5LDJmIZcSzVtLRbwuXuUft1Cnv+9fxuDtDxz3k3EW2A==}
|
|
||||||
cpu: [arm64]
|
|
||||||
os: [linux]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@rollup/rollup-linux-arm64-musl@4.17.2:
|
|
||||||
resolution: {integrity: sha512-NMPylUUZ1i0z/xJUIx6VUhISZDRT+uTWpBcjdv0/zkp7b/bQDF+NfnfdzuTiB1G6HTodgoFa93hp0O1xl+/UbA==}
|
|
||||||
cpu: [arm64]
|
|
||||||
os: [linux]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@rollup/rollup-linux-powerpc64le-gnu@4.17.2:
|
|
||||||
resolution: {integrity: sha512-T19My13y8uYXPw/L/k0JYaX1fJKFT/PWdXiHr8mTbXWxjVF1t+8Xl31DgBBvEKclw+1b00Chg0hxE2O7bTG7GQ==}
|
|
||||||
cpu: [ppc64]
|
|
||||||
os: [linux]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@rollup/rollup-linux-riscv64-gnu@4.17.2:
|
|
||||||
resolution: {integrity: sha512-BOaNfthf3X3fOWAB+IJ9kxTgPmMqPPH5f5k2DcCsRrBIbWnaJCgX2ll77dV1TdSy9SaXTR5iDXRL8n7AnoP5cg==}
|
|
||||||
cpu: [riscv64]
|
|
||||||
os: [linux]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@rollup/rollup-linux-s390x-gnu@4.17.2:
|
|
||||||
resolution: {integrity: sha512-W0UP/x7bnn3xN2eYMql2T/+wpASLE5SjObXILTMPUBDB/Fg/FxC+gX4nvCfPBCbNhz51C+HcqQp2qQ4u25ok6g==}
|
|
||||||
cpu: [s390x]
|
|
||||||
os: [linux]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@rollup/rollup-linux-x64-gnu@4.17.2:
|
|
||||||
resolution: {integrity: sha512-Hy7pLwByUOuyaFC6mAr7m+oMC+V7qyifzs/nW2OJfC8H4hbCzOX07Ov0VFk/zP3kBsELWNFi7rJtgbKYsav9QQ==}
|
|
||||||
cpu: [x64]
|
|
||||||
os: [linux]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@rollup/rollup-linux-x64-musl@4.17.2:
|
|
||||||
resolution: {integrity: sha512-h1+yTWeYbRdAyJ/jMiVw0l6fOOm/0D1vNLui9iPuqgRGnXA0u21gAqOyB5iHjlM9MMfNOm9RHCQ7zLIzT0x11Q==}
|
|
||||||
cpu: [x64]
|
|
||||||
os: [linux]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@rollup/rollup-win32-arm64-msvc@4.17.2:
|
|
||||||
resolution: {integrity: sha512-tmdtXMfKAjy5+IQsVtDiCfqbynAQE/TQRpWdVataHmhMb9DCoJxp9vLcCBjEQWMiUYxO1QprH/HbY9ragCEFLA==}
|
|
||||||
cpu: [arm64]
|
|
||||||
os: [win32]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@rollup/rollup-win32-ia32-msvc@4.17.2:
|
|
||||||
resolution: {integrity: sha512-7II/QCSTAHuE5vdZaQEwJq2ZACkBpQDOmQsE6D6XUbnBHW8IAhm4eTufL6msLJorzrHDFv3CF8oCA/hSIRuZeQ==}
|
|
||||||
cpu: [ia32]
|
|
||||||
os: [win32]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@rollup/rollup-win32-x64-msvc@4.17.2:
|
|
||||||
resolution: {integrity: sha512-TGGO7v7qOq4CYmSBVEYpI1Y5xDuCEnbVC5Vth8mOsW0gDSzxNrVERPc790IGHsrT2dQSimgMr9Ub3Y1Jci5/8w==}
|
|
||||||
cpu: [x64]
|
|
||||||
os: [win32]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/@types/estree@1.0.5:
|
|
||||||
resolution: {integrity: sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==}
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/esbuild@0.20.2:
|
|
||||||
resolution: {integrity: sha512-WdOOppmUNU+IbZ0PaDiTst80zjnrOkyJNHoKupIcVyU8Lvla3Ugx94VzkQ32Ijqd7UhHJy75gNWDMUekcrSJ6g==}
|
|
||||||
engines: {node: '>=12'}
|
|
||||||
hasBin: true
|
|
||||||
requiresBuild: true
|
|
||||||
optionalDependencies:
|
|
||||||
'@esbuild/aix-ppc64': 0.20.2
|
|
||||||
'@esbuild/android-arm': 0.20.2
|
|
||||||
'@esbuild/android-arm64': 0.20.2
|
|
||||||
'@esbuild/android-x64': 0.20.2
|
|
||||||
'@esbuild/darwin-arm64': 0.20.2
|
|
||||||
'@esbuild/darwin-x64': 0.20.2
|
|
||||||
'@esbuild/freebsd-arm64': 0.20.2
|
|
||||||
'@esbuild/freebsd-x64': 0.20.2
|
|
||||||
'@esbuild/linux-arm': 0.20.2
|
|
||||||
'@esbuild/linux-arm64': 0.20.2
|
|
||||||
'@esbuild/linux-ia32': 0.20.2
|
|
||||||
'@esbuild/linux-loong64': 0.20.2
|
|
||||||
'@esbuild/linux-mips64el': 0.20.2
|
|
||||||
'@esbuild/linux-ppc64': 0.20.2
|
|
||||||
'@esbuild/linux-riscv64': 0.20.2
|
|
||||||
'@esbuild/linux-s390x': 0.20.2
|
|
||||||
'@esbuild/linux-x64': 0.20.2
|
|
||||||
'@esbuild/netbsd-x64': 0.20.2
|
|
||||||
'@esbuild/openbsd-x64': 0.20.2
|
|
||||||
'@esbuild/sunos-x64': 0.20.2
|
|
||||||
'@esbuild/win32-arm64': 0.20.2
|
|
||||||
'@esbuild/win32-ia32': 0.20.2
|
|
||||||
'@esbuild/win32-x64': 0.20.2
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/fsevents@2.3.3:
|
|
||||||
resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==}
|
|
||||||
engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
|
|
||||||
os: [darwin]
|
|
||||||
requiresBuild: true
|
|
||||||
dev: true
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
/nanoid@3.3.7:
|
|
||||||
resolution: {integrity: sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==}
|
|
||||||
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
|
|
||||||
hasBin: true
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/node-addon-api@8.0.0:
|
|
||||||
resolution: {integrity: sha512-ipO7rsHEBqa9STO5C5T10fj732ml+5kLN1cAG8/jdHd56ldQeGj3Q7+scUS+VHK/qy1zLEwC4wMK5+yM0btPvw==}
|
|
||||||
engines: {node: ^18 || ^20 || >= 21}
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/node-gyp-build@4.8.1:
|
|
||||||
resolution: {integrity: sha512-OSs33Z9yWr148JZcbZd5WiAXhh/n9z8TxQcdMhIOlpN9AhWpLfvVFO73+m77bBABQMaY9XSvIa+qk0jlI7Gcaw==}
|
|
||||||
hasBin: true
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/picocolors@1.0.1:
|
|
||||||
resolution: {integrity: sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==}
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/postcss@8.4.38:
|
|
||||||
resolution: {integrity: sha512-Wglpdk03BSfXkHoQa3b/oulrotAkwrlLDRSOb9D0bN86FdRyE9lppSp33aHNPgBa0JKCoB+drFLZkQoRRYae5A==}
|
|
||||||
engines: {node: ^10 || ^12 || >=14}
|
|
||||||
dependencies:
|
|
||||||
nanoid: 3.3.7
|
|
||||||
picocolors: 1.0.1
|
|
||||||
source-map-js: 1.2.0
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/rollup@4.17.2:
|
|
||||||
resolution: {integrity: sha512-/9ClTJPByC0U4zNLowV1tMBe8yMEAxewtR3cUNX5BoEpGH3dQEWpJLr6CLp0fPdYRF/fzVOgvDb1zXuakwF5kQ==}
|
|
||||||
engines: {node: '>=18.0.0', npm: '>=8.0.0'}
|
|
||||||
hasBin: true
|
|
||||||
dependencies:
|
|
||||||
'@types/estree': 1.0.5
|
|
||||||
optionalDependencies:
|
|
||||||
'@rollup/rollup-android-arm-eabi': 4.17.2
|
|
||||||
'@rollup/rollup-android-arm64': 4.17.2
|
|
||||||
'@rollup/rollup-darwin-arm64': 4.17.2
|
|
||||||
'@rollup/rollup-darwin-x64': 4.17.2
|
|
||||||
'@rollup/rollup-linux-arm-gnueabihf': 4.17.2
|
|
||||||
'@rollup/rollup-linux-arm-musleabihf': 4.17.2
|
|
||||||
'@rollup/rollup-linux-arm64-gnu': 4.17.2
|
|
||||||
'@rollup/rollup-linux-arm64-musl': 4.17.2
|
|
||||||
'@rollup/rollup-linux-powerpc64le-gnu': 4.17.2
|
|
||||||
'@rollup/rollup-linux-riscv64-gnu': 4.17.2
|
|
||||||
'@rollup/rollup-linux-s390x-gnu': 4.17.2
|
|
||||||
'@rollup/rollup-linux-x64-gnu': 4.17.2
|
|
||||||
'@rollup/rollup-linux-x64-musl': 4.17.2
|
|
||||||
'@rollup/rollup-win32-arm64-msvc': 4.17.2
|
|
||||||
'@rollup/rollup-win32-ia32-msvc': 4.17.2
|
|
||||||
'@rollup/rollup-win32-x64-msvc': 4.17.2
|
|
||||||
fsevents: 2.3.3
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/source-map-js@1.2.0:
|
|
||||||
resolution: {integrity: sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==}
|
|
||||||
engines: {node: '>=0.10.0'}
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/tree-sitter-haskell@0.21.0(tree-sitter@0.21.1):
|
|
||||||
resolution: {integrity: sha512-b2RLegPHuYPh7nJ3YKWgkWnFYxmYlQDE8TDJuNH+iuNuBcCMYyaA9JlJlMHfCvf7DmJNPtqqbO9Kh9NXEmbatQ==}
|
|
||||||
requiresBuild: true
|
|
||||||
peerDependencies:
|
|
||||||
tree-sitter: ^0.21.0
|
|
||||||
tree_sitter: '*'
|
|
||||||
peerDependenciesMeta:
|
|
||||||
tree_sitter:
|
|
||||||
optional: true
|
|
||||||
dependencies:
|
|
||||||
node-addon-api: 8.0.0
|
|
||||||
node-gyp-build: 4.8.1
|
|
||||||
tree-sitter: 0.21.1
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/tree-sitter@0.21.1:
|
|
||||||
resolution: {integrity: sha512-7dxoA6kYvtgWw80265MyqJlkRl4yawIjO7S5MigytjELkX43fV2WsAXzsNfO7sBpPPCF5Gp0+XzHk0DwLCq3xQ==}
|
|
||||||
requiresBuild: true
|
|
||||||
dependencies:
|
|
||||||
node-addon-api: 8.0.0
|
|
||||||
node-gyp-build: 4.8.1
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/vite@5.2.11:
|
|
||||||
resolution: {integrity: sha512-HndV31LWW05i1BLPMUCE1B9E9GFbOu1MbenhS58FuK6owSO5qHm7GiCotrNY1YE5rMeQSFBGmT5ZaLEjFizgiQ==}
|
|
||||||
engines: {node: ^18.0.0 || >=20.0.0}
|
|
||||||
hasBin: true
|
|
||||||
peerDependencies:
|
|
||||||
'@types/node': ^18.0.0 || >=20.0.0
|
|
||||||
less: '*'
|
|
||||||
lightningcss: ^1.21.0
|
|
||||||
sass: '*'
|
|
||||||
stylus: '*'
|
|
||||||
sugarss: '*'
|
|
||||||
terser: ^5.4.0
|
|
||||||
peerDependenciesMeta:
|
|
||||||
'@types/node':
|
|
||||||
optional: true
|
|
||||||
less:
|
|
||||||
optional: true
|
|
||||||
lightningcss:
|
|
||||||
optional: true
|
|
||||||
sass:
|
|
||||||
optional: true
|
|
||||||
stylus:
|
|
||||||
optional: true
|
|
||||||
sugarss:
|
|
||||||
optional: true
|
|
||||||
terser:
|
|
||||||
optional: true
|
|
||||||
dependencies:
|
|
||||||
esbuild: 0.20.2
|
|
||||||
postcss: 8.4.38
|
|
||||||
rollup: 4.17.2
|
|
||||||
optionalDependencies:
|
|
||||||
fsevents: 2.3.3
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/web-tree-sitter@0.20.8:
|
|
||||||
resolution: {integrity: sha512-weOVgZ3aAARgdnb220GqYuh7+rZU0Ka9k9yfKtGAzEYMa6GgiCzW9JjQRJyCJakvibQW+dfjJdihjInKuuCAUQ==}
|
|
||||||
dev: false
|
|
||||||
@@ -1,136 +0,0 @@
|
|||||||
import { parse } from './parser.mjs';
|
|
||||||
|
|
||||||
function runApply(node, scope, ops) {
|
|
||||||
if (node.children.length !== 2)
|
|
||||||
throw new Error(`expected 2 children for node type apply, got ${node.children.length}`);
|
|
||||||
const [fn, arg] = node.children.map((child) => run(child, scope, ops));
|
|
||||||
if (typeof fn !== 'function') {
|
|
||||||
throw new Error(`${node.children[0].text} is not a function`);
|
|
||||||
}
|
|
||||||
// only works if fn is curried!
|
|
||||||
return fn(arg);
|
|
||||||
}
|
|
||||||
|
|
||||||
function runInfix(left, symbol, right, ops) {
|
|
||||||
const customOp = ops[symbol];
|
|
||||||
if (customOp) {
|
|
||||||
return customOp(left, right);
|
|
||||||
}
|
|
||||||
switch (symbol) {
|
|
||||||
case '+':
|
|
||||||
return left + right;
|
|
||||||
case '-':
|
|
||||||
return left - right;
|
|
||||||
case '*':
|
|
||||||
return left * right;
|
|
||||||
case '/':
|
|
||||||
return left / right;
|
|
||||||
case '$':
|
|
||||||
return left(right);
|
|
||||||
case '&':
|
|
||||||
console.log('right', right);
|
|
||||||
return right(left);
|
|
||||||
case '.':
|
|
||||||
return (x) => left(right(x));
|
|
||||||
default:
|
|
||||||
throw new Error('unexpected infix operator ' + symbol);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function curry(patterns, body, scope, ops) {
|
|
||||||
const [variable, ...rest] = patterns;
|
|
||||||
return (arg) => {
|
|
||||||
let _scope = { ...scope, [variable.text]: arg };
|
|
||||||
if (patterns.length === 1) {
|
|
||||||
const result = run(body, _scope, ops);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
return curry(rest, body, _scope, ops);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export function run(node, scope, ops = {}) {
|
|
||||||
let runInScope = (node, scp = scope) => run(node, scp, ops);
|
|
||||||
//console.log("node", node.type, node.text);
|
|
||||||
if (ops[node.type]) {
|
|
||||||
return ops[node.type](node);
|
|
||||||
}
|
|
||||||
switch (node.type) {
|
|
||||||
case 'ERROR':
|
|
||||||
throw new Error(`invalid syntax: "${node.text}"`);
|
|
||||||
case 'declarations':
|
|
||||||
let result;
|
|
||||||
node.children.forEach((declaration) => {
|
|
||||||
result = runInScope(declaration);
|
|
||||||
});
|
|
||||||
return result;
|
|
||||||
case 'integer':
|
|
||||||
return Number(node.text);
|
|
||||||
case 'float':
|
|
||||||
return Number(node.text);
|
|
||||||
case 'string':
|
|
||||||
const str = node.text.slice(1, -1);
|
|
||||||
return String(str);
|
|
||||||
case 'lambda':
|
|
||||||
const [_, lpatterns, __, lbody] = node.children;
|
|
||||||
return curry(lpatterns.children, lbody, scope, ops);
|
|
||||||
case 'function':
|
|
||||||
const [fvariable, fpatterns, fbody] = node.children;
|
|
||||||
scope[fvariable.text] = curry(fpatterns.children, fbody, scope, ops);
|
|
||||||
return scope[fvariable.text];
|
|
||||||
case 'list': {
|
|
||||||
return node.children
|
|
||||||
.filter((_, i) => i % 2 === 1) // elements are at odd indices
|
|
||||||
.map((node) => runInScope(node));
|
|
||||||
}
|
|
||||||
case 'match':
|
|
||||||
if (node.children[0].text !== '=' || node.children.length !== 2) {
|
|
||||||
throw new Error('match node so far only support simple assignments');
|
|
||||||
}
|
|
||||||
return runInScope(node.children[1]);
|
|
||||||
case 'bind':
|
|
||||||
if (node.children.length !== 2) throw new Error('expected 2 children for node type bind');
|
|
||||||
if (node.children[0].type !== 'variable') throw new Error('expected variable as first child of bind node');
|
|
||||||
if (node.children[1].type !== 'match') throw new Error('expected match as first child of bind node');
|
|
||||||
const [bvariable, bmatch] = node.children;
|
|
||||||
const value = runInScope(bmatch);
|
|
||||||
scope[bvariable.text] = value;
|
|
||||||
return value;
|
|
||||||
case 'variable':
|
|
||||||
return scope[node.text];
|
|
||||||
case 'infix': {
|
|
||||||
const [a, op, b] = node.children;
|
|
||||||
const symbol = op.text;
|
|
||||||
const [left, right] = [runInScope(a), runInScope(b)];
|
|
||||||
return runInfix(left, symbol, right, ops);
|
|
||||||
}
|
|
||||||
case 'apply':
|
|
||||||
return runApply(node, scope, ops);
|
|
||||||
case 'left_section': {
|
|
||||||
const [_, b, op] = node.children;
|
|
||||||
const right = runInScope(b);
|
|
||||||
return (left) => runInfix(left, op.text, right, ops);
|
|
||||||
}
|
|
||||||
case 'right_section': {
|
|
||||||
const [_, op, b] = node.children;
|
|
||||||
const right = runInScope(b);
|
|
||||||
return (left) => runInfix(left, op.text, right, ops);
|
|
||||||
}
|
|
||||||
case 'parens':
|
|
||||||
if (node.children.length !== 3) throw new Error('expected 3 children for node type parens');
|
|
||||||
return runInScope(node.children[1]);
|
|
||||||
default:
|
|
||||||
if (node.children.length === 0) {
|
|
||||||
throw new Error('unhandled leaf type ' + node.type);
|
|
||||||
}
|
|
||||||
if (node.children.length > 1) {
|
|
||||||
throw new Error('unhandled branch type ' + node.type);
|
|
||||||
}
|
|
||||||
return runInScope(node.children[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function evaluate(haskellCode, scope = globalThis, ops) {
|
|
||||||
const ast = parse(haskellCode);
|
|
||||||
return run(ast.rootNode, scope, ops);
|
|
||||||
}
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
export * from './hs2js.mjs';
|
|
||||||
export * from './parser.mjs';
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
import Parser from 'web-tree-sitter';
|
|
||||||
|
|
||||||
let base = '/';
|
|
||||||
export function setBase(path) {
|
|
||||||
base = path;
|
|
||||||
}
|
|
||||||
|
|
||||||
let isReady = false,
|
|
||||||
parser;
|
|
||||||
async function _loadParser() {
|
|
||||||
await Parser.init({
|
|
||||||
locateFile(scriptName, scriptDirectory) {
|
|
||||||
return `${base}${scriptName}`;
|
|
||||||
},
|
|
||||||
});
|
|
||||||
parser = new Parser();
|
|
||||||
const Lang = await Parser.Language.load(`${base}tree-sitter-haskell.wasm`);
|
|
||||||
parser.setLanguage(Lang);
|
|
||||||
isReady = true;
|
|
||||||
return parser;
|
|
||||||
}
|
|
||||||
|
|
||||||
let parserLoaded;
|
|
||||||
export function loadParser() {
|
|
||||||
if (!parserLoaded) {
|
|
||||||
parserLoaded = _loadParser();
|
|
||||||
}
|
|
||||||
return parserLoaded;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function parse(code) {
|
|
||||||
if (!isReady) {
|
|
||||||
throw new Error('hs2js not ready. await loadParser before calling evaluate or parse functions');
|
|
||||||
}
|
|
||||||
// for some reason, the parser doesn't like new lines..
|
|
||||||
return parser.parse(code.replaceAll('\n\n', '~~~~').replaceAll('\n', ' ').replaceAll('~~~~', ' \n'));
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
import { defineConfig } from 'vite';
|
|
||||||
import { resolve } from 'path';
|
|
||||||
|
|
||||||
// https://vitejs.dev/config/
|
|
||||||
export default defineConfig({
|
|
||||||
plugins: [],
|
|
||||||
build: {
|
|
||||||
lib: {
|
|
||||||
entry: resolve(__dirname, 'src', 'index.mjs'),
|
|
||||||
name: 'hs2js',
|
|
||||||
formats: ['es', 'iife'],
|
|
||||||
fileName: (ext) => ({ es: 'index.mjs', iife: 'index.js' })[ext],
|
|
||||||
},
|
|
||||||
rollupOptions: {
|
|
||||||
// external: [...Object.keys(dependencies)],
|
|
||||||
plugins: [],
|
|
||||||
},
|
|
||||||
target: 'esnext',
|
|
||||||
},
|
|
||||||
});
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { getDrawContext } from '@strudel/draw';
|
import { getDrawContext } from '@strudel/draw';
|
||||||
import { controls, getTime, reify } from '@strudel/core';
|
import { controls } from '@strudel/core';
|
||||||
|
|
||||||
let latestOptions;
|
let latestOptions;
|
||||||
let hydra;
|
let hydra;
|
||||||
@@ -27,7 +27,6 @@ export async function initHydra(options = {}) {
|
|||||||
hydraConfig.canvas = canvas;
|
hydraConfig.canvas = canvas;
|
||||||
|
|
||||||
await import(/* @vite-ignore */ src);
|
await import(/* @vite-ignore */ src);
|
||||||
/* eslint-disable-next-line */
|
|
||||||
hydra = new Hydra(hydraConfig);
|
hydra = new Hydra(hydraConfig);
|
||||||
if (feedStrudel) {
|
if (feedStrudel) {
|
||||||
const { canvas } = getDrawContext();
|
const { canvas } = getDrawContext();
|
||||||
@@ -47,4 +46,4 @@ export function clearHydra() {
|
|||||||
globalThis.shape = controls.shape;
|
globalThis.shape = controls.shape;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const H = (p) => () => reify(p).queryArc(getTime(), getTime())[0].value;
|
export const H = (p) => () => p.queryArc(getTime(), getTime())[0].value;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@strudel/hydra",
|
"name": "@strudel/hydra",
|
||||||
"version": "1.1.0",
|
"version": "1.0.1",
|
||||||
"description": "Hydra integration for strudel",
|
"description": "Hydra integration for strudel",
|
||||||
"main": "hydra.mjs",
|
"main": "hydra.mjs",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@strudel/midi",
|
"name": "@strudel/midi",
|
||||||
"version": "1.1.0",
|
"version": "1.0.1",
|
||||||
"description": "Midi API for strudel",
|
"description": "Midi API for strudel",
|
||||||
"main": "index.mjs",
|
"main": "index.mjs",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
import { describe, bench } from 'vitest';
|
|
||||||
|
|
||||||
import { calculateTactus } from '../../core/index.mjs';
|
|
||||||
import { mini } from '../index.mjs';
|
|
||||||
|
|
||||||
describe('mini', () => {
|
|
||||||
calculateTactus(true);
|
|
||||||
bench(
|
|
||||||
'+tactus',
|
|
||||||
() => {
|
|
||||||
mini('a b c*3 [c d e, f g] <a b [c d?]>').fast(64).firstCycle();
|
|
||||||
},
|
|
||||||
{ time: 1000 },
|
|
||||||
);
|
|
||||||
|
|
||||||
calculateTactus(false);
|
|
||||||
bench(
|
|
||||||
'-tactus',
|
|
||||||
() => {
|
|
||||||
mini('a b c*3 [c d e, f g] <a b [c d?]>').fast(64).firstCycle();
|
|
||||||
},
|
|
||||||
{ time: 1000 },
|
|
||||||
);
|
|
||||||
calculateTactus(true);
|
|
||||||
});
|
|
||||||
@@ -295,12 +295,13 @@ function peg$parse(input, options) {
|
|||||||
var peg$f6 = function(a) { return a };
|
var peg$f6 = function(a) { return a };
|
||||||
var peg$f7 = function(s) { s.arguments_.alignment = 'polymeter_slowcat'; return s; };
|
var peg$f7 = function(s) { s.arguments_.alignment = 'polymeter_slowcat'; return s; };
|
||||||
var peg$f8 = function(a) { return x => x.options_['weight'] = (x.options_['weight'] ?? 1) + (a ?? 2) - 1 };
|
var peg$f8 = function(a) { return x => x.options_['weight'] = (x.options_['weight'] ?? 1) + (a ?? 2) - 1 };
|
||||||
var peg$f9 = function(a) { return x => {// A bit fiddly, to support both x!4 and x!!! as equivalent..
|
var peg$f9 = function(a) { return x => {const reps = (x.options_['reps'] ?? 1) + (a ?? 2) - 1;
|
||||||
const reps = (x.options_['reps'] ?? 1) + (a ?? 2) - 1;
|
|
||||||
x.options_['reps'] = reps;
|
x.options_['reps'] = reps;
|
||||||
|
console.log("reps: ", reps)
|
||||||
x.options_['ops'] = x.options_['ops'].filter(x => x.type_ !== "replicate");
|
x.options_['ops'] = x.options_['ops'].filter(x => x.type_ !== "replicate");
|
||||||
x.options_['ops'].push({ type_: "replicate", arguments_ :{ amount:reps }});
|
x.options_['ops'].push({ type_: "replicate", arguments_ :{ amount:reps }});
|
||||||
x.options_['weight'] = reps;
|
x.options_['weight'] = reps;
|
||||||
|
console.log("options: ", x.options_);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
var peg$f10 = function(p, s, r) { return x => x.options_['ops'].push({ type_: "bjorklund", arguments_ :{ pulse: p, step:s, rotation:r }}) };
|
var peg$f10 = function(p, s, r) { return x => x.options_['ops'].push({ type_: "bjorklund", arguments_ :{ pulse: p, step:s, rotation:r }}) };
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@strudel/mini",
|
"name": "@strudel/mini",
|
||||||
"version": "1.1.0",
|
"version": "1.0.1",
|
||||||
"description": "Mini notation for strudel",
|
"description": "Mini notation for strudel",
|
||||||
"main": "index.mjs",
|
"main": "index.mjs",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
@@ -9,7 +9,6 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "vitest run",
|
"test": "vitest run",
|
||||||
"bench": "vitest bench",
|
|
||||||
"build:parser": "peggy -o krill-parser.js --format es ./krill.pegjs",
|
"build:parser": "peggy -o krill-parser.js --format es ./krill.pegjs",
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
"prepublishOnly": "npm run build"
|
"prepublishOnly": "npm run build"
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
# @strudel/node
|
||||||
|
|
||||||
|
This is an experiment to run strudel in node.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# Setup
|
||||||
|
# - make sure node >= 20 is installed
|
||||||
|
# - make sure pnpm is installed
|
||||||
|
cd packages/node
|
||||||
|
pnpm i
|
||||||
|
# Usage
|
||||||
|
pnpm start
|
||||||
|
```
|
||||||
|
|
||||||
|
Then run `sclang` with superdirt in another terminal.
|
||||||
|
|
||||||
|
You can now edit and save the file `pattern.mjs` to update your pattern!
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
import { createClock, evalScope } from '@strudel/core';
|
||||||
|
import { evaluate } from '@strudel/transpiler';
|
||||||
|
import watch from 'node-watch';
|
||||||
|
import fs from 'node:fs/promises';
|
||||||
|
import { AudioContext, OscillatorNode, GainNode } from 'node-web-audio-api';
|
||||||
|
|
||||||
|
const audioContext = new AudioContext();
|
||||||
|
|
||||||
|
let file = 'pattern.mjs';
|
||||||
|
let pattern;
|
||||||
|
async function evaluateFile() {
|
||||||
|
try {
|
||||||
|
console.log('// file evaluated:');
|
||||||
|
const code = await fs.readFile(file, { encoding: 'utf8' });
|
||||||
|
console.log(code);
|
||||||
|
const res = await evaluate(code);
|
||||||
|
pattern = res.pattern;
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// const getTime = () => performance.now() / 1000;
|
||||||
|
const getTime = () => audioContext.currentTime;
|
||||||
|
let minLatency = 50;
|
||||||
|
async function main() {
|
||||||
|
await evalScope(import('@strudel/core'), import('@strudel/mini'), import('@strudel/tonal'));
|
||||||
|
await evaluateFile();
|
||||||
|
watch(file, { recursive: true }, () => evaluateFile());
|
||||||
|
let lastEnd;
|
||||||
|
const clock = createClock(getTime, (phase) => {
|
||||||
|
if (!lastEnd) {
|
||||||
|
lastEnd = phase;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const haps = pattern.queryArc(lastEnd, phase);
|
||||||
|
lastEnd = phase;
|
||||||
|
const cps = 1;
|
||||||
|
const cycle = Math.floor(phase);
|
||||||
|
haps
|
||||||
|
.filter((h) => h.hasOnset())
|
||||||
|
.forEach((hap) => {
|
||||||
|
const env = new GainNode(audioContext, { gain: 0 });
|
||||||
|
const { attack = 0.01, gain = 1 } = hap.value;
|
||||||
|
env.connect(audioContext.destination);
|
||||||
|
const now = hap.whole.begin;
|
||||||
|
const duration = hap.duration;
|
||||||
|
env.gain
|
||||||
|
.setValueAtTime(0, now)
|
||||||
|
.linearRampToValueAtTime(gain * 0.2, now + attack)
|
||||||
|
.exponentialRampToValueAtTime(0.0001, now + duration);
|
||||||
|
const frequency = hap.value.freq;
|
||||||
|
|
||||||
|
const osc = new OscillatorNode(audioContext, { frequency });
|
||||||
|
osc.connect(env);
|
||||||
|
osc.start(now);
|
||||||
|
osc.stop(now + duration);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
clock.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
main();
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
import { createClock, evalScope } from '@strudel/core';
|
||||||
|
import { evaluate } from '@strudel/transpiler';
|
||||||
|
import OSC from 'osc-js';
|
||||||
|
import watch from 'node-watch';
|
||||||
|
import fs from 'node:fs/promises';
|
||||||
|
|
||||||
|
const config = {
|
||||||
|
receiver: 'udp', // @param {string} Where messages sent via 'send' method will be delivered to, 'ws' for Websocket clients, 'udp' for udp client
|
||||||
|
open: {
|
||||||
|
host: 'localhost', // @param {string} Hostname of udp server to bind to
|
||||||
|
port: 57121, // @param {number} Port of udp client for messaging
|
||||||
|
// enabling the following line will receive tidal messages:
|
||||||
|
// port: 57120, // @param {number} Port of udp client for messaging
|
||||||
|
exclusive: false, // @param {boolean} Exclusive flag
|
||||||
|
},
|
||||||
|
send: {
|
||||||
|
host: 'localhost', // @param {string} Hostname of udp client for messaging
|
||||||
|
port: 57120, // @param {number} Port of udp client for messaging
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const osc = new OSC({ plugin: new OSC.DatagramPlugin(config) });
|
||||||
|
|
||||||
|
osc.open(); // start a WebSocket server on port 8080
|
||||||
|
|
||||||
|
console.log('osc client running on port', config.open.port);
|
||||||
|
console.log('osc server running on port', config.send.port);
|
||||||
|
|
||||||
|
let file = 'pattern.mjs';
|
||||||
|
let pattern;
|
||||||
|
async function evaluateFile() {
|
||||||
|
try {
|
||||||
|
console.log('// file evaluated:');
|
||||||
|
const code = await fs.readFile(file, { encoding: 'utf8' });
|
||||||
|
console.log(code);
|
||||||
|
const res = await evaluate(code);
|
||||||
|
pattern = res.pattern;
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const getTime = () => performance.now() / 1000;
|
||||||
|
async function main() {
|
||||||
|
await evalScope(import('@strudel/core'), import('@strudel/mini'), import('@strudel/tonal'));
|
||||||
|
await evaluateFile();
|
||||||
|
watch(file, { recursive: true }, () => evaluateFile());
|
||||||
|
let lastEnd;
|
||||||
|
let minLatency = 50;
|
||||||
|
const clock = createClock(getTime, (phase) => {
|
||||||
|
if (!lastEnd) {
|
||||||
|
lastEnd = phase;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const haps = pattern.queryArc(lastEnd, phase);
|
||||||
|
lastEnd = phase;
|
||||||
|
const cps = 1;
|
||||||
|
const cycle = Math.floor(phase);
|
||||||
|
haps
|
||||||
|
.filter((h) => h.hasOnset())
|
||||||
|
.forEach((hap) => {
|
||||||
|
const delta = hap.duration.valueOf();
|
||||||
|
const controls = Object.assign({}, { cps, cycle, delta }, hap.value);
|
||||||
|
const keyvals = Object.entries(controls).flat();
|
||||||
|
const ts = Math.floor(performance.timeOrigin + hap.whole.begin * 1000 + minLatency);
|
||||||
|
const message = new OSC.Message('/dirt/play', ...keyvals);
|
||||||
|
const bundle = new OSC.Bundle([message], ts);
|
||||||
|
bundle.timestamp(ts); // workaround for https://github.com/adzialocha/osc-js/issues/60
|
||||||
|
osc.send(bundle);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
clock.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
main();
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
{
|
||||||
|
"name": "@strudel/node",
|
||||||
|
"version": "1.1.0",
|
||||||
|
"description": "Strudel running in node",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/tidalcycles/strudel.git"
|
||||||
|
},
|
||||||
|
"main": "index.mjs",
|
||||||
|
"scripts": {
|
||||||
|
"osc": "node osc-superdirt.mjs",
|
||||||
|
"waa": "node node-web-audio-api.mjs"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"tidalcycles",
|
||||||
|
"strudel",
|
||||||
|
"pattern",
|
||||||
|
"livecoding",
|
||||||
|
"algorave"
|
||||||
|
],
|
||||||
|
"author": "Felix Roos <flix91@gmail.com>",
|
||||||
|
"license": "AGPL-3.0-or-later",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/tidalcycles/strudel/issues"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/tidalcycles/strudel#readme",
|
||||||
|
"dependencies": {
|
||||||
|
"@strudel/core": "workspace:*",
|
||||||
|
"@strudel/mini": "workspace:*",
|
||||||
|
"@strudel/osc": "workspace:*",
|
||||||
|
"@strudel/tonal": "workspace:*",
|
||||||
|
"@strudel/transpiler": "workspace:*",
|
||||||
|
"node-watch": "^0.7.4",
|
||||||
|
"node-web-audio-api": "^0.20.0",
|
||||||
|
"osc-js": "^2.4.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
freq("110 220 [330 440,550,660]")
|
||||||
|
.attack(.1).gain(.4)
|
||||||
+2
-10
@@ -6,7 +6,7 @@ This program is free software: you can redistribute it and/or modify it under th
|
|||||||
|
|
||||||
import OSC from 'osc-js';
|
import OSC from 'osc-js';
|
||||||
|
|
||||||
import { logger, parseNumeral, Pattern, getEventOffsetMs, isNote, noteToMidi } from '@strudel/core';
|
import { logger, parseNumeral, Pattern, getEventOffsetMs } from '@strudel/core';
|
||||||
|
|
||||||
let connection; // Promise<OSC>
|
let connection; // Promise<OSC>
|
||||||
function connect() {
|
function connect() {
|
||||||
@@ -52,15 +52,7 @@ Pattern.prototype.osc = function () {
|
|||||||
const controls = Object.assign({}, { cps, cycle, delta }, hap.value);
|
const controls = Object.assign({}, { cps, cycle, delta }, hap.value);
|
||||||
// make sure n and note are numbers
|
// make sure n and note are numbers
|
||||||
controls.n && (controls.n = parseNumeral(controls.n));
|
controls.n && (controls.n = parseNumeral(controls.n));
|
||||||
if (typeof controls.note !== 'undefined') {
|
controls.note && (controls.note = parseNumeral(controls.note));
|
||||||
if (isNote(controls.note)) {
|
|
||||||
controls.midinote = noteToMidi(controls.note, controls.octave || 3);
|
|
||||||
} else {
|
|
||||||
controls.note = parseNumeral(controls.note);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
controls.bank && (controls.s = controls.bank + controls.s);
|
|
||||||
controls.roomsize && (controls.size = parseNumeral(controls.roomsize));
|
|
||||||
const keyvals = Object.entries(controls).flat();
|
const keyvals = Object.entries(controls).flat();
|
||||||
// time should be audio time of onset
|
// time should be audio time of onset
|
||||||
// currentTime should be current time of audio context (slightly before time)
|
// currentTime should be current time of audio context (slightly before time)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@strudel/osc",
|
"name": "@strudel/osc",
|
||||||
"version": "1.1.0",
|
"version": "1.0.1",
|
||||||
"description": "OSC messaging for strudel",
|
"description": "OSC messaging for strudel",
|
||||||
"main": "osc.mjs",
|
"main": "osc.mjs",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Copyright (C) 2022 Strudel contributors - see <https://github.com/tidalcycles/st
|
|||||||
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/>.
|
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 OSC from 'osc-js';
|
const OSC = require('osc-js');
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
receiver: 'ws', // @param {string} Where messages sent via 'send' method will be delivered to, 'ws' for Websocket clients, 'udp' for udp client
|
receiver: 'ws', // @param {string} Where messages sent via 'send' method will be delivered to, 'ws' for Websocket clients, 'udp' for udp client
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@strudel/repl",
|
"name": "@strudel/repl",
|
||||||
"version": "1.1.0",
|
"version": "1.0.2",
|
||||||
"description": "Strudel REPL as a Web Component",
|
"description": "Strudel REPL as a Web Component",
|
||||||
"module": "index.mjs",
|
"module": "index.mjs",
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@strudel/sampler",
|
"name": "@strudel/sampler",
|
||||||
"version": "0.1.0",
|
"version": "0.0.9",
|
||||||
"description": "",
|
"description": "",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"tidalcycles",
|
"tidalcycles",
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import cowsay from 'cowsay';
|
|||||||
import { createReadStream } from 'fs';
|
import { createReadStream } from 'fs';
|
||||||
import { readdir } from 'fs/promises';
|
import { readdir } from 'fs/promises';
|
||||||
import http from 'http';
|
import http from 'http';
|
||||||
import { join, sep } from 'path';
|
import { join } from 'path';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
|
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
@@ -45,16 +45,15 @@ async function getFilesInDirectory(directory) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function getBanks(directory) {
|
async function getBanks(directory) {
|
||||||
|
// const directory = resolve(__dirname, '.');
|
||||||
let files = await getFilesInDirectory(directory);
|
let files = await getFilesInDirectory(directory);
|
||||||
let banks = {};
|
let banks = {};
|
||||||
directory = directory.split(sep).join('/');
|
files = files.map((url) => {
|
||||||
files = files.map((path) => {
|
const [bank] = url.split('/').slice(-2);
|
||||||
path = path.split(sep).join('/');
|
|
||||||
const [bank] = path.split('/').slice(-2);
|
|
||||||
banks[bank] = banks[bank] || [];
|
banks[bank] = banks[bank] || [];
|
||||||
const relativeUrl = path.replace(directory, '');
|
url = url.replace(directory, '');
|
||||||
banks[bank].push(relativeUrl);
|
banks[bank].push(url);
|
||||||
return relativeUrl;
|
return url;
|
||||||
});
|
});
|
||||||
banks._base = `http://localhost:5432`;
|
banks._base = `http://localhost:5432`;
|
||||||
return { banks, files };
|
return { banks, files };
|
||||||
@@ -75,7 +74,7 @@ const server = http.createServer(async (req, res) => {
|
|||||||
res.end('File not found');
|
res.end('File not found');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const filePath = join(directory, subpath.split('/').join(sep));
|
const filePath = join(directory, subpath);
|
||||||
const readStream = createReadStream(filePath);
|
const readStream = createReadStream(filePath);
|
||||||
readStream.on('error', (err) => {
|
readStream.on('error', (err) => {
|
||||||
res.statusCode = 500;
|
res.statusCode = 500;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@strudel/serial",
|
"name": "@strudel/serial",
|
||||||
"version": "1.1.0",
|
"version": "1.0.1",
|
||||||
"description": "Webserial API for strudel",
|
"description": "Webserial API for strudel",
|
||||||
"main": "serial.mjs",
|
"main": "serial.mjs",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@strudel/soundfonts",
|
"name": "@strudel/soundfonts",
|
||||||
"version": "1.1.0",
|
"version": "1.0.1",
|
||||||
"description": "Soundsfont support for strudel",
|
"description": "Soundsfont support for strudel",
|
||||||
"main": "index.mjs",
|
"main": "index.mjs",
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
|
|||||||
@@ -14,15 +14,6 @@ const getSlope = (y1, y2, x1, x2) => {
|
|||||||
}
|
}
|
||||||
return (y2 - y1) / (x2 - x1);
|
return (y2 - y1) / (x2 - x1);
|
||||||
};
|
};
|
||||||
|
|
||||||
export function getWorklet(ac, processor, params, config) {
|
|
||||||
const node = new AudioWorkletNode(ac, processor, config);
|
|
||||||
Object.entries(params).forEach(([key, value]) => {
|
|
||||||
node.parameters.get(key).value = value;
|
|
||||||
});
|
|
||||||
return node;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const getParamADSR = (
|
export const getParamADSR = (
|
||||||
param,
|
param,
|
||||||
attack,
|
attack,
|
||||||
@@ -112,22 +103,14 @@ export const getADSRValues = (params, curve = 'linear', defaultValues) => {
|
|||||||
return [Math.max(a ?? 0, envmin), Math.max(d ?? 0, envmin), Math.min(sustain, envmax), Math.max(r ?? 0, releaseMin)];
|
return [Math.max(a ?? 0, envmin), Math.max(d ?? 0, envmin), Math.min(sustain, envmax), Math.max(r ?? 0, releaseMin)];
|
||||||
};
|
};
|
||||||
|
|
||||||
export function createFilter(context, type, frequency, Q, att, dec, sus, rel, fenv, start, end, fanchor, model, drive) {
|
export function createFilter(context, type, frequency, Q, att, dec, sus, rel, fenv, start, end, fanchor) {
|
||||||
const curve = 'exponential';
|
const curve = 'exponential';
|
||||||
const [attack, decay, sustain, release] = getADSRValues([att, dec, sus, rel], curve, [0.005, 0.14, 0, 0.1]);
|
const [attack, decay, sustain, release] = getADSRValues([att, dec, sus, rel], curve, [0.005, 0.14, 0, 0.1]);
|
||||||
let filter;
|
const filter = context.createBiquadFilter();
|
||||||
let frequencyParam;
|
|
||||||
if (model === 'ladder') {
|
|
||||||
filter = getWorklet(context, 'ladder-processor', { frequency, q: Q, drive });
|
|
||||||
frequencyParam = filter.parameters.get('frequency');
|
|
||||||
} else {
|
|
||||||
filter = context.createBiquadFilter();
|
|
||||||
filter.type = type;
|
filter.type = type;
|
||||||
filter.Q.value = Q;
|
filter.Q.value = Q;
|
||||||
filter.frequency.value = frequency;
|
filter.frequency.value = frequency;
|
||||||
frequencyParam = filter.frequency;
|
|
||||||
}
|
|
||||||
|
|
||||||
// envelope is active when any of these values is set
|
// envelope is active when any of these values is set
|
||||||
const hasEnvelope = att ?? dec ?? sus ?? rel ?? fenv;
|
const hasEnvelope = att ?? dec ?? sus ?? rel ?? fenv;
|
||||||
// Apply ADSR to filter frequency
|
// Apply ADSR to filter frequency
|
||||||
@@ -139,7 +122,7 @@ export function createFilter(context, type, frequency, Q, att, dec, sus, rel, fe
|
|||||||
let min = clamp(2 ** -offset * frequency, 0, 20000);
|
let min = clamp(2 ** -offset * frequency, 0, 20000);
|
||||||
let max = clamp(2 ** (fenvAbs - offset) * frequency, 0, 20000);
|
let max = clamp(2 ** (fenvAbs - offset) * frequency, 0, 20000);
|
||||||
if (fenv < 0) [min, max] = [max, min];
|
if (fenv < 0) [min, max] = [max, min];
|
||||||
getParamADSR(frequencyParam, attack, decay, sustain, release, min, max, start, end, curve);
|
getParamADSR(filter.frequency, attack, decay, sustain, release, min, max, start, end, curve);
|
||||||
return filter;
|
return filter;
|
||||||
}
|
}
|
||||||
return filter;
|
return filter;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "superdough",
|
"name": "superdough",
|
||||||
"version": "1.1.0",
|
"version": "1.0.1",
|
||||||
"description": "simple web audio synth and sampler intended for live coding. inspired by superdirt and webdirt.",
|
"description": "simple web audio synth and sampler intended for live coding. inspired by superdirt and webdirt.",
|
||||||
"main": "index.mjs",
|
"main": "index.mjs",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ This program is free software: you can redistribute it and/or modify it under th
|
|||||||
import './feedbackdelay.mjs';
|
import './feedbackdelay.mjs';
|
||||||
import './reverb.mjs';
|
import './reverb.mjs';
|
||||||
import './vowel.mjs';
|
import './vowel.mjs';
|
||||||
import { clamp, nanFallback, _mod } from './util.mjs';
|
import { clamp, nanFallback } from './util.mjs';
|
||||||
import workletsUrl from './worklets.mjs?url';
|
import workletsUrl from './worklets.mjs?url';
|
||||||
import { createFilter, gainNode, getCompressor, getWorklet } from './helpers.mjs';
|
import { createFilter, gainNode, getCompressor } from './helpers.mjs';
|
||||||
import { map } from 'nanostores';
|
import { map } from 'nanostores';
|
||||||
import { logger } from './logger.mjs';
|
import { logger } from './logger.mjs';
|
||||||
import { loadBuffer } from './sampler.mjs';
|
import { loadBuffer } from './sampler.mjs';
|
||||||
@@ -24,52 +24,6 @@ export function getSound(s) {
|
|||||||
return soundMap.get()[s];
|
return soundMap.get()[s];
|
||||||
}
|
}
|
||||||
|
|
||||||
const defaultDefaultValues = {
|
|
||||||
s: 'triangle',
|
|
||||||
gain: 0.8,
|
|
||||||
postgain: 1,
|
|
||||||
density: '.03',
|
|
||||||
ftype: '12db',
|
|
||||||
fanchor: 0,
|
|
||||||
resonance: 1,
|
|
||||||
hresonance: 1,
|
|
||||||
bandq: 1,
|
|
||||||
channels: [1, 2],
|
|
||||||
phaserdepth: 0.75,
|
|
||||||
shapevol: 1,
|
|
||||||
distortvol: 1,
|
|
||||||
delay: 0,
|
|
||||||
delayfeedback: 0.5,
|
|
||||||
delaytime: 0.25,
|
|
||||||
orbit: 1,
|
|
||||||
i: 1,
|
|
||||||
velocity: 1,
|
|
||||||
fft: 8,
|
|
||||||
};
|
|
||||||
|
|
||||||
let defaultControls = new Map(Object.entries(defaultDefaultValues));
|
|
||||||
|
|
||||||
export function setDefaultValue(key, value) {
|
|
||||||
defaultControls.set(key, value);
|
|
||||||
}
|
|
||||||
export function getDefaultValue(key) {
|
|
||||||
return defaultControls.get(key);
|
|
||||||
}
|
|
||||||
export function setDefaultValues(defaultsobj) {
|
|
||||||
Object.keys(defaultsobj).forEach((key) => {
|
|
||||||
setDefaultValue(key, defaultsobj[key]);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
export function resetDefaultValues() {
|
|
||||||
defaultControls = new Map(Object.entries(defaultDefaultValues));
|
|
||||||
}
|
|
||||||
export function setVersionDefaults(version) {
|
|
||||||
resetDefaultValues();
|
|
||||||
if (version === '1.0') {
|
|
||||||
setDefaultValue('fanchor', 0.5);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const resetLoadedSounds = () => soundMap.set({});
|
export const resetLoadedSounds = () => soundMap.set({});
|
||||||
|
|
||||||
let audioContext;
|
let audioContext;
|
||||||
@@ -83,49 +37,50 @@ export const getAudioContext = () => {
|
|||||||
if (!audioContext) {
|
if (!audioContext) {
|
||||||
return setDefaultAudioContext();
|
return setDefaultAudioContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
return audioContext;
|
return audioContext;
|
||||||
};
|
};
|
||||||
|
|
||||||
let workletsLoading;
|
let workletsLoading;
|
||||||
|
|
||||||
function loadWorklets() {
|
function loadWorklets() {
|
||||||
if (!workletsLoading) {
|
if (workletsLoading) {
|
||||||
workletsLoading = getAudioContext().audioWorklet.addModule(workletsUrl);
|
|
||||||
}
|
|
||||||
return workletsLoading;
|
return workletsLoading;
|
||||||
|
}
|
||||||
|
workletsLoading = getAudioContext().audioWorklet.addModule(workletsUrl);
|
||||||
|
return workletsLoading;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getWorklet(ac, processor, params, config) {
|
||||||
|
const node = new AudioWorkletNode(ac, processor, config);
|
||||||
|
Object.entries(params).forEach(([key, value]) => {
|
||||||
|
node.parameters.get(key).value = value;
|
||||||
|
});
|
||||||
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
// this function should be called on first user interaction (to avoid console warning)
|
// this function should be called on first user interaction (to avoid console warning)
|
||||||
export async function initAudio(options = {}) {
|
export async function initAudio(options = {}) {
|
||||||
const { disableWorklets = false } = options;
|
const { disableWorklets = false } = options;
|
||||||
if (typeof window === 'undefined') {
|
if (typeof window !== 'undefined') {
|
||||||
return;
|
|
||||||
}
|
|
||||||
await getAudioContext().resume();
|
await getAudioContext().resume();
|
||||||
if (disableWorklets) {
|
if (!disableWorklets) {
|
||||||
logger('[superdough]: AudioWorklets disabled with disableWorklets');
|
await loadWorklets().catch((err) => {
|
||||||
return;
|
console.warn('could not load AudioWorklet effects coarse, crush and shape', err);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
console.log('disableWorklets: AudioWorklet effects coarse, crush and shape are skipped!');
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
await loadWorklets();
|
|
||||||
logger('[superdough] AudioWorklets loaded');
|
|
||||||
} catch (err) {
|
|
||||||
console.warn('could not load AudioWorklet effects', err);
|
|
||||||
}
|
}
|
||||||
logger('[superdough] ready');
|
|
||||||
}
|
}
|
||||||
let audioReady;
|
|
||||||
export async function initAudioOnFirstClick(options) {
|
export async function initAudioOnFirstClick(options) {
|
||||||
if (!audioReady) {
|
return new Promise((resolve) => {
|
||||||
audioReady = new Promise((resolve) => {
|
|
||||||
document.addEventListener('click', async function listener() {
|
document.addEventListener('click', async function listener() {
|
||||||
document.removeEventListener('click', listener);
|
|
||||||
await initAudio(options);
|
await initAudio(options);
|
||||||
resolve();
|
resolve();
|
||||||
|
document.removeEventListener('click', listener);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
|
||||||
return audioReady;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let delays = {};
|
let delays = {};
|
||||||
@@ -189,25 +144,26 @@ function getDelay(orbit, delaytime, delayfeedback, t) {
|
|||||||
return delays[orbit];
|
return delays[orbit];
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPhaser(time, end, frequency = 1, depth = 0.5, centerFrequency = 1000, sweep = 2000) {
|
// each orbit will have its own lfo
|
||||||
|
const phaserLFOs = {};
|
||||||
|
function getPhaser(orbit, t, speed = 1, depth = 0.5, centerFrequency = 1000, sweep = 2000) {
|
||||||
//gain
|
//gain
|
||||||
const ac = getAudioContext();
|
const ac = getAudioContext();
|
||||||
const lfoGain = ac.createGain();
|
const lfoGain = ac.createGain();
|
||||||
lfoGain.gain.value = sweep * 2;
|
lfoGain.gain.value = sweep;
|
||||||
// centerFrequency = centerFrequency * 2;
|
|
||||||
// sweep = sweep * 1.5;
|
|
||||||
|
|
||||||
const lfo = getWorklet(ac, 'lfo-processor', {
|
//LFO
|
||||||
frequency,
|
if (phaserLFOs[orbit] == null) {
|
||||||
depth: 1,
|
phaserLFOs[orbit] = ac.createOscillator();
|
||||||
skew: 0,
|
phaserLFOs[orbit].frequency.value = speed;
|
||||||
phaseoffset: 0,
|
phaserLFOs[orbit].type = 'sine';
|
||||||
time,
|
phaserLFOs[orbit].start();
|
||||||
end,
|
}
|
||||||
shape: 1,
|
|
||||||
dcoffset: -0.5,
|
phaserLFOs[orbit].connect(lfoGain);
|
||||||
});
|
if (phaserLFOs[orbit].frequency.value != speed) {
|
||||||
lfo.connect(lfoGain);
|
phaserLFOs[orbit].frequency.setValueAtTime(speed, t);
|
||||||
|
}
|
||||||
|
|
||||||
//filters
|
//filters
|
||||||
const numStages = 2; //num of filters in series
|
const numStages = 2; //num of filters in series
|
||||||
@@ -230,14 +186,10 @@ function getPhaser(time, end, frequency = 1, depth = 0.5, centerFrequency = 1000
|
|||||||
return filterChain[filterChain.length - 1];
|
return filterChain[filterChain.length - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFilterType(ftype) {
|
|
||||||
ftype = ftype ?? 0;
|
|
||||||
const filterTypes = ['12db', 'ladder', '24db'];
|
|
||||||
return typeof ftype === 'number' ? filterTypes[Math.floor(_mod(ftype, filterTypes.length))] : ftype;
|
|
||||||
}
|
|
||||||
|
|
||||||
let reverbs = {};
|
let reverbs = {};
|
||||||
|
|
||||||
let hasChanged = (now, before) => now !== undefined && now !== before;
|
let hasChanged = (now, before) => now !== undefined && now !== before;
|
||||||
|
|
||||||
function getReverb(orbit, duration, fade, lp, dim, ir) {
|
function getReverb(orbit, duration, fade, lp, dim, ir) {
|
||||||
// If no reverb has been created for a given orbit, create one
|
// If no reverb has been created for a given orbit, create one
|
||||||
if (!reverbs[orbit]) {
|
if (!reverbs[orbit]) {
|
||||||
@@ -329,15 +281,15 @@ export const superdough = async (value, t, hapDuration) => {
|
|||||||
}
|
}
|
||||||
// destructure
|
// destructure
|
||||||
let {
|
let {
|
||||||
s = getDefaultValue('s'),
|
s = 'triangle',
|
||||||
bank,
|
bank,
|
||||||
source,
|
source,
|
||||||
gain = getDefaultValue('gain'),
|
gain = 0.8,
|
||||||
postgain = getDefaultValue('postgain'),
|
postgain = 1,
|
||||||
density = getDefaultValue('density'),
|
density = 0.03,
|
||||||
// filters
|
// filters
|
||||||
fanchor = getDefaultValue('fanchor'),
|
ftype = '12db',
|
||||||
drive = 0.69,
|
fanchor = 0.5,
|
||||||
// low pass
|
// low pass
|
||||||
cutoff,
|
cutoff,
|
||||||
lpenv,
|
lpenv,
|
||||||
@@ -345,7 +297,7 @@ export const superdough = async (value, t, hapDuration) => {
|
|||||||
lpdecay,
|
lpdecay,
|
||||||
lpsustain,
|
lpsustain,
|
||||||
lprelease,
|
lprelease,
|
||||||
resonance = getDefaultValue('resonance'),
|
resonance = 1,
|
||||||
// high pass
|
// high pass
|
||||||
hpenv,
|
hpenv,
|
||||||
hcutoff,
|
hcutoff,
|
||||||
@@ -353,7 +305,7 @@ export const superdough = async (value, t, hapDuration) => {
|
|||||||
hpdecay,
|
hpdecay,
|
||||||
hpsustain,
|
hpsustain,
|
||||||
hprelease,
|
hprelease,
|
||||||
hresonance = getDefaultValue('hresonance'),
|
hresonance = 1,
|
||||||
// band pass
|
// band pass
|
||||||
bpenv,
|
bpenv,
|
||||||
bandf,
|
bandf,
|
||||||
@@ -361,36 +313,36 @@ export const superdough = async (value, t, hapDuration) => {
|
|||||||
bpdecay,
|
bpdecay,
|
||||||
bpsustain,
|
bpsustain,
|
||||||
bprelease,
|
bprelease,
|
||||||
bandq = getDefaultValue('bandq'),
|
bandq = 1,
|
||||||
channels = getDefaultValue('channels'),
|
channels = [1, 2],
|
||||||
//phaser
|
//phaser
|
||||||
phaser,
|
phaser,
|
||||||
phaserdepth = getDefaultValue('phaserdepth'),
|
phaserdepth = 0.75,
|
||||||
phasersweep,
|
phasersweep,
|
||||||
phasercenter,
|
phasercenter,
|
||||||
//
|
//
|
||||||
coarse,
|
coarse,
|
||||||
crush,
|
crush,
|
||||||
shape,
|
shape,
|
||||||
shapevol = getDefaultValue('shapevol'),
|
shapevol = 1,
|
||||||
distort,
|
distort,
|
||||||
distortvol = getDefaultValue('distortvol'),
|
distortvol = 1,
|
||||||
pan,
|
pan,
|
||||||
vowel,
|
vowel,
|
||||||
delay = getDefaultValue('delay'),
|
delay = 0,
|
||||||
delayfeedback = getDefaultValue('delayfeedback'),
|
delayfeedback = 0.5,
|
||||||
delaytime = getDefaultValue('delaytime'),
|
delaytime = 0.25,
|
||||||
orbit = getDefaultValue('orbit'),
|
orbit = 1,
|
||||||
room,
|
room,
|
||||||
roomfade,
|
roomfade,
|
||||||
roomlp,
|
roomlp,
|
||||||
roomdim,
|
roomdim,
|
||||||
roomsize,
|
roomsize,
|
||||||
ir,
|
ir,
|
||||||
i = getDefaultValue('i'),
|
i = 0,
|
||||||
velocity = getDefaultValue('velocity'),
|
velocity = 1,
|
||||||
analyze, // analyser wet
|
analyze, // analyser wet
|
||||||
fft = getDefaultValue('fft'), // fftSize 0 - 10
|
fft = 8, // fftSize 0 - 10
|
||||||
compressor: compressorThreshold,
|
compressor: compressorThreshold,
|
||||||
compressorRatio,
|
compressorRatio,
|
||||||
compressorKnee,
|
compressorKnee,
|
||||||
@@ -442,8 +394,6 @@ export const superdough = async (value, t, hapDuration) => {
|
|||||||
// gain stage
|
// gain stage
|
||||||
chain.push(gainNode(gain));
|
chain.push(gainNode(gain));
|
||||||
|
|
||||||
//filter
|
|
||||||
const ftype = getFilterType(value.ftype);
|
|
||||||
if (cutoff !== undefined) {
|
if (cutoff !== undefined) {
|
||||||
let lp = () =>
|
let lp = () =>
|
||||||
createFilter(
|
createFilter(
|
||||||
@@ -459,8 +409,6 @@ export const superdough = async (value, t, hapDuration) => {
|
|||||||
t,
|
t,
|
||||||
t + hapDuration,
|
t + hapDuration,
|
||||||
fanchor,
|
fanchor,
|
||||||
ftype,
|
|
||||||
drive,
|
|
||||||
);
|
);
|
||||||
chain.push(lp());
|
chain.push(lp());
|
||||||
if (ftype === '24db') {
|
if (ftype === '24db') {
|
||||||
@@ -536,7 +484,7 @@ export const superdough = async (value, t, hapDuration) => {
|
|||||||
}
|
}
|
||||||
// phaser
|
// phaser
|
||||||
if (phaser !== undefined && phaserdepth > 0) {
|
if (phaser !== undefined && phaserdepth > 0) {
|
||||||
const phaserFX = getPhaser(t, t + hapDuration, phaser, phaserdepth, phasercenter, phasersweep);
|
const phaserFX = getPhaser(orbit, t, phaser, phaserdepth, phasercenter, phasersweep);
|
||||||
chain.push(phaserFX);
|
chain.push(phaserFX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { clamp, midiToFreq, noteToMidi } from './util.mjs';
|
import { clamp, midiToFreq, noteToMidi } from './util.mjs';
|
||||||
import { registerSound, getAudioContext } from './superdough.mjs';
|
import { registerSound, getAudioContext, getWorklet } from './superdough.mjs';
|
||||||
import {
|
import {
|
||||||
applyFM,
|
applyFM,
|
||||||
gainNode,
|
gainNode,
|
||||||
@@ -8,7 +8,6 @@ import {
|
|||||||
getPitchEnvelope,
|
getPitchEnvelope,
|
||||||
getVibratoOscillator,
|
getVibratoOscillator,
|
||||||
webAudioTimeout,
|
webAudioTimeout,
|
||||||
getWorklet,
|
|
||||||
} from './helpers.mjs';
|
} from './helpers.mjs';
|
||||||
import { getNoiseMix, getNoiseOscillator } from './noise.mjs';
|
import { getNoiseMix, getNoiseOscillator } from './noise.mjs';
|
||||||
|
|
||||||
|
|||||||
@@ -1,140 +1,5 @@
|
|||||||
// coarse, crush, and shape processors adapted from dktr0's webdirt: https://github.com/dktr0/WebDirt/blob/5ce3d698362c54d6e1b68acc47eb2955ac62c793/dist/AudioWorklets.js
|
// coarse, crush, and shape processors adapted from dktr0's webdirt: https://github.com/dktr0/WebDirt/blob/5ce3d698362c54d6e1b68acc47eb2955ac62c793/dist/AudioWorklets.js
|
||||||
// LICENSE GNU General Public License v3.0 see https://github.com/dktr0/WebDirt/blob/main/LICENSE
|
// LICENSE GNU General Public License v3.0 see https://github.com/dktr0/WebDirt/blob/main/LICENSE
|
||||||
// TOFIX: THIS FILE DOES NOT SUPPORT IMPORTS ON DEPOLYMENT
|
|
||||||
const clamp = (num, min, max) => Math.min(Math.max(num, min), max);
|
|
||||||
const _mod = (n, m) => ((n % m) + m) % m;
|
|
||||||
|
|
||||||
const blockSize = 128;
|
|
||||||
// adjust waveshape to remove frequencies above nyquist to prevent aliasing
|
|
||||||
// referenced from https://www.kvraudio.com/forum/viewtopic.php?t=375517
|
|
||||||
function polyBlep(phase, dt) {
|
|
||||||
// 0 <= phase < 1
|
|
||||||
if (phase < dt) {
|
|
||||||
phase /= dt;
|
|
||||||
// 2 * (phase - phase^2/2 - 0.5)
|
|
||||||
return phase + phase - phase * phase - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// -1 < phase < 0
|
|
||||||
else if (phase > 1 - dt) {
|
|
||||||
phase = (phase - 1) / dt;
|
|
||||||
// 2 * (phase^2/2 + phase + 0.5)
|
|
||||||
return phase * phase + phase + phase + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 0 otherwise
|
|
||||||
else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const waveshapes = {
|
|
||||||
tri(phase, skew = 0.5) {
|
|
||||||
const x = 1 - skew;
|
|
||||||
if (phase >= skew) {
|
|
||||||
return 1 / x - phase / x;
|
|
||||||
}
|
|
||||||
return phase / skew;
|
|
||||||
},
|
|
||||||
sine(phase) {
|
|
||||||
return Math.sin(Math.PI * 2 * phase) * 0.5 + 0.5;
|
|
||||||
},
|
|
||||||
ramp(phase) {
|
|
||||||
return phase;
|
|
||||||
},
|
|
||||||
saw(phase) {
|
|
||||||
return 1 - phase;
|
|
||||||
},
|
|
||||||
|
|
||||||
square(phase, skew = 0.5) {
|
|
||||||
if (phase >= skew) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
},
|
|
||||||
custom(phase, values = [0, 1]) {
|
|
||||||
const numParts = values.length - 1;
|
|
||||||
const currPart = Math.floor(phase * numParts);
|
|
||||||
|
|
||||||
const partLength = 1 / numParts;
|
|
||||||
const startVal = clamp(values[currPart], 0, 1);
|
|
||||||
const endVal = clamp(values[currPart + 1], 0, 1);
|
|
||||||
const y2 = endVal;
|
|
||||||
const y1 = startVal;
|
|
||||||
const x1 = 0;
|
|
||||||
const x2 = partLength;
|
|
||||||
const slope = (y2 - y1) / (x2 - x1);
|
|
||||||
return slope * (phase - partLength * currPart) + startVal;
|
|
||||||
},
|
|
||||||
sawblep(phase, dt) {
|
|
||||||
const v = 2 * phase - 1;
|
|
||||||
return v - polyBlep(phase, dt);
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const waveShapeNames = Object.keys(waveshapes);
|
|
||||||
class LFOProcessor extends AudioWorkletProcessor {
|
|
||||||
static get parameterDescriptors() {
|
|
||||||
return [
|
|
||||||
{ name: 'time', defaultValue: 0 },
|
|
||||||
{ name: 'end', defaultValue: 0 },
|
|
||||||
{ name: 'frequency', defaultValue: 0.5 },
|
|
||||||
{ name: 'skew', defaultValue: 0.5 },
|
|
||||||
{ name: 'depth', defaultValue: 1 },
|
|
||||||
{ name: 'phaseoffset', defaultValue: 0 },
|
|
||||||
{ name: 'shape', defaultValue: 0 },
|
|
||||||
{ name: 'dcoffset', defaultValue: 0 },
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor() {
|
|
||||||
super();
|
|
||||||
this.phase;
|
|
||||||
}
|
|
||||||
|
|
||||||
incrementPhase(dt) {
|
|
||||||
this.phase += dt;
|
|
||||||
if (this.phase > 1.0) {
|
|
||||||
this.phase = this.phase - 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
process(inputs, outputs, parameters) {
|
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
if (currentTime >= parameters.end[0]) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const output = outputs[0];
|
|
||||||
const frequency = parameters['frequency'][0];
|
|
||||||
|
|
||||||
const time = parameters['time'][0];
|
|
||||||
const depth = parameters['depth'][0];
|
|
||||||
const skew = parameters['skew'][0];
|
|
||||||
const phaseoffset = parameters['phaseoffset'][0];
|
|
||||||
|
|
||||||
const dcoffset = parameters['dcoffset'][0];
|
|
||||||
const shape = waveShapeNames[parameters['shape'][0]];
|
|
||||||
|
|
||||||
const blockSize = output[0].length ?? 0;
|
|
||||||
|
|
||||||
if (this.phase == null) {
|
|
||||||
this.phase = _mod(time * frequency + phaseoffset, 1);
|
|
||||||
}
|
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
const dt = frequency / sampleRate;
|
|
||||||
for (let n = 0; n < blockSize; n++) {
|
|
||||||
for (let i = 0; i < output.length; i++) {
|
|
||||||
const modval = (waveshapes[shape](this.phase, skew) + dcoffset) * depth;
|
|
||||||
output[i][n] = modval;
|
|
||||||
}
|
|
||||||
this.incrementPhase(dt);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
registerProcessor('lfo-processor', LFOProcessor);
|
|
||||||
|
|
||||||
class CoarseProcessor extends AudioWorkletProcessor {
|
class CoarseProcessor extends AudioWorkletProcessor {
|
||||||
static get parameterDescriptors() {
|
static get parameterDescriptors() {
|
||||||
@@ -143,21 +8,19 @@ class CoarseProcessor extends AudioWorkletProcessor {
|
|||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
this.started = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
process(inputs, outputs, parameters) {
|
process(inputs, outputs, parameters) {
|
||||||
const input = inputs[0];
|
const input = inputs[0];
|
||||||
const output = outputs[0];
|
const output = outputs[0];
|
||||||
|
const blockSize = 128;
|
||||||
const hasInput = !(input[0] === undefined);
|
|
||||||
if (this.started && !hasInput) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
this.started = hasInput;
|
|
||||||
|
|
||||||
let coarse = parameters.coarse[0] ?? 0;
|
let coarse = parameters.coarse[0] ?? 0;
|
||||||
coarse = Math.max(1, coarse);
|
coarse = Math.max(1, coarse);
|
||||||
|
|
||||||
|
if (input[0] == null || output[0] == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
for (let n = 0; n < blockSize; n++) {
|
for (let n = 0; n < blockSize; n++) {
|
||||||
for (let i = 0; i < input.length; i++) {
|
for (let i = 0; i < input.length; i++) {
|
||||||
output[i][n] = n % coarse === 0 ? input[i][n] : output[i][n - 1];
|
output[i][n] = n % coarse === 0 ? input[i][n] : output[i][n - 1];
|
||||||
@@ -175,22 +38,19 @@ class CrushProcessor extends AudioWorkletProcessor {
|
|||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
this.started = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
process(inputs, outputs, parameters) {
|
process(inputs, outputs, parameters) {
|
||||||
const input = inputs[0];
|
const input = inputs[0];
|
||||||
const output = outputs[0];
|
const output = outputs[0];
|
||||||
|
const blockSize = 128;
|
||||||
const hasInput = !(input[0] === undefined);
|
|
||||||
if (this.started && !hasInput) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
this.started = hasInput;
|
|
||||||
|
|
||||||
let crush = parameters.crush[0] ?? 8;
|
let crush = parameters.crush[0] ?? 8;
|
||||||
crush = Math.max(1, crush);
|
crush = Math.max(1, crush);
|
||||||
|
|
||||||
|
if (input[0] == null || output[0] == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
for (let n = 0; n < blockSize; n++) {
|
for (let n = 0; n < blockSize; n++) {
|
||||||
for (let i = 0; i < input.length; i++) {
|
for (let i = 0; i < input.length; i++) {
|
||||||
const x = Math.pow(2, crush - 1);
|
const x = Math.pow(2, crush - 1);
|
||||||
@@ -212,24 +72,21 @@ class ShapeProcessor extends AudioWorkletProcessor {
|
|||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
this.started = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
process(inputs, outputs, parameters) {
|
process(inputs, outputs, parameters) {
|
||||||
const input = inputs[0];
|
const input = inputs[0];
|
||||||
const output = outputs[0];
|
const output = outputs[0];
|
||||||
|
const blockSize = 128;
|
||||||
const hasInput = !(input[0] === undefined);
|
|
||||||
if (this.started && !hasInput) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
this.started = hasInput;
|
|
||||||
|
|
||||||
let shape = parameters.shape[0];
|
let shape = parameters.shape[0];
|
||||||
shape = shape < 1 ? shape : 1.0 - 4e-10;
|
shape = shape < 1 ? shape : 1.0 - 4e-10;
|
||||||
shape = (2.0 * shape) / (1.0 - shape);
|
shape = (2.0 * shape) / (1.0 - shape);
|
||||||
const postgain = Math.max(0.001, Math.min(1, parameters.postgain[0]));
|
const postgain = Math.max(0.001, Math.min(1, parameters.postgain[0]));
|
||||||
|
|
||||||
|
if (input[0] == null || output[0] == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
for (let n = 0; n < blockSize; n++) {
|
for (let n = 0; n < blockSize; n++) {
|
||||||
for (let i = 0; i < input.length; i++) {
|
for (let i = 0; i < input.length; i++) {
|
||||||
output[i][n] = (((1 + shape) * input[i][n]) / (1 + shape * Math.abs(input[i][n]))) * postgain;
|
output[i][n] = (((1 + shape) * input[i][n]) / (1 + shape * Math.abs(input[i][n]))) * postgain;
|
||||||
@@ -240,77 +97,6 @@ class ShapeProcessor extends AudioWorkletProcessor {
|
|||||||
}
|
}
|
||||||
registerProcessor('shape-processor', ShapeProcessor);
|
registerProcessor('shape-processor', ShapeProcessor);
|
||||||
|
|
||||||
function fast_tanh(x) {
|
|
||||||
const x2 = x * x;
|
|
||||||
return (x * (27.0 + x2)) / (27.0 + 9.0 * x2);
|
|
||||||
}
|
|
||||||
const _PI = 3.14159265359;
|
|
||||||
//adapted from https://github.com/TheBouteillacBear/webaudioworklet-wasm?tab=MIT-1-ov-file
|
|
||||||
class LadderProcessor extends AudioWorkletProcessor {
|
|
||||||
static get parameterDescriptors() {
|
|
||||||
return [
|
|
||||||
{ name: 'frequency', defaultValue: 500 },
|
|
||||||
{ name: 'q', defaultValue: 1 },
|
|
||||||
{ name: 'drive', defaultValue: 0.69 },
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor() {
|
|
||||||
super();
|
|
||||||
this.started = false;
|
|
||||||
this.p0 = [0, 0];
|
|
||||||
this.p1 = [0, 0];
|
|
||||||
this.p2 = [0, 0];
|
|
||||||
this.p3 = [0, 0];
|
|
||||||
this.p32 = [0, 0];
|
|
||||||
this.p33 = [0, 0];
|
|
||||||
this.p34 = [0, 0];
|
|
||||||
}
|
|
||||||
|
|
||||||
process(inputs, outputs, parameters) {
|
|
||||||
const input = inputs[0];
|
|
||||||
const output = outputs[0];
|
|
||||||
|
|
||||||
const hasInput = !(input[0] === undefined);
|
|
||||||
if (this.started && !hasInput) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.started = hasInput;
|
|
||||||
|
|
||||||
const resonance = parameters.q[0];
|
|
||||||
const drive = clamp(Math.exp(parameters.drive[0]), 0.1, 2000);
|
|
||||||
|
|
||||||
let cutoff = parameters.frequency[0];
|
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
cutoff = (cutoff * 2 * _PI) / sampleRate;
|
|
||||||
cutoff = cutoff > 1 ? 1 : cutoff;
|
|
||||||
|
|
||||||
const k = Math.min(8, resonance * 0.4);
|
|
||||||
// drive makeup * resonance volume loss makeup
|
|
||||||
let makeupgain = (1 / drive) * Math.min(1.75, 1 + k);
|
|
||||||
|
|
||||||
for (let n = 0; n < blockSize; n++) {
|
|
||||||
for (let i = 0; i < input.length; i++) {
|
|
||||||
const out = this.p3[i] * 0.360891 + this.p32[i] * 0.41729 + this.p33[i] * 0.177896 + this.p34[i] * 0.0439725;
|
|
||||||
|
|
||||||
this.p34[i] = this.p33[i];
|
|
||||||
this.p33[i] = this.p32[i];
|
|
||||||
this.p32[i] = this.p3[i];
|
|
||||||
|
|
||||||
this.p0[i] += (fast_tanh(input[i][n] * drive - k * out) - fast_tanh(this.p0[i])) * cutoff;
|
|
||||||
this.p1[i] += (fast_tanh(this.p0[i]) - fast_tanh(this.p1[i])) * cutoff;
|
|
||||||
this.p2[i] += (fast_tanh(this.p1[i]) - fast_tanh(this.p2[i])) * cutoff;
|
|
||||||
this.p3[i] += (fast_tanh(this.p2[i]) - fast_tanh(this.p3[i])) * cutoff;
|
|
||||||
|
|
||||||
output[i][n] = out * makeupgain;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
registerProcessor('ladder-processor', LadderProcessor);
|
|
||||||
|
|
||||||
class DistortProcessor extends AudioWorkletProcessor {
|
class DistortProcessor extends AudioWorkletProcessor {
|
||||||
static get parameterDescriptors() {
|
static get parameterDescriptors() {
|
||||||
return [
|
return [
|
||||||
@@ -321,22 +107,19 @@ class DistortProcessor extends AudioWorkletProcessor {
|
|||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
this.started = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
process(inputs, outputs, parameters) {
|
process(inputs, outputs, parameters) {
|
||||||
const input = inputs[0];
|
const input = inputs[0];
|
||||||
const output = outputs[0];
|
const output = outputs[0];
|
||||||
|
const blockSize = 128;
|
||||||
const hasInput = !(input[0] === undefined);
|
|
||||||
if (this.started && !hasInput) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
this.started = hasInput;
|
|
||||||
|
|
||||||
const shape = Math.expm1(parameters.distort[0]);
|
const shape = Math.expm1(parameters.distort[0]);
|
||||||
const postgain = Math.max(0.001, Math.min(1, parameters.postgain[0]));
|
const postgain = Math.max(0.001, Math.min(1, parameters.postgain[0]));
|
||||||
|
|
||||||
|
if (input[0] == null || output[0] == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
for (let n = 0; n < blockSize; n++) {
|
for (let n = 0; n < blockSize; n++) {
|
||||||
for (let i = 0; i < input.length; i++) {
|
for (let i = 0; i < input.length; i++) {
|
||||||
output[i][n] = (((1 + shape) * input[i][n]) / (1 + shape * Math.abs(input[i][n]))) * postgain;
|
output[i][n] = (((1 + shape) * input[i][n]) / (1 + shape * Math.abs(input[i][n]))) * postgain;
|
||||||
@@ -347,7 +130,34 @@ class DistortProcessor extends AudioWorkletProcessor {
|
|||||||
}
|
}
|
||||||
registerProcessor('distort-processor', DistortProcessor);
|
registerProcessor('distort-processor', DistortProcessor);
|
||||||
|
|
||||||
// SUPERSAW
|
// adjust waveshape to remove frequencies above nyquist to prevent aliasing
|
||||||
|
// referenced from https://www.kvraudio.com/forum/viewtopic.php?t=375517
|
||||||
|
const polyBlep = (phase, dt) => {
|
||||||
|
// 0 <= phase < 1
|
||||||
|
if (phase < dt) {
|
||||||
|
phase /= dt;
|
||||||
|
// 2 * (phase - phase^2/2 - 0.5)
|
||||||
|
return phase + phase - phase * phase - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// -1 < phase < 0
|
||||||
|
else if (phase > 1 - dt) {
|
||||||
|
phase = (phase - 1) / dt;
|
||||||
|
// 2 * (phase^2/2 + phase + 0.5)
|
||||||
|
return phase * phase + phase + phase + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 0 otherwise
|
||||||
|
else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const saw = (phase, dt) => {
|
||||||
|
const v = 2 * phase - 1;
|
||||||
|
return v - polyBlep(phase, dt);
|
||||||
|
};
|
||||||
|
|
||||||
function lerp(a, b, n) {
|
function lerp(a, b, n) {
|
||||||
return n * (b - a) + a;
|
return n * (b - a) + a;
|
||||||
}
|
}
|
||||||
@@ -447,7 +257,7 @@ class SuperSawOscillatorProcessor extends AudioWorkletProcessor {
|
|||||||
|
|
||||||
for (let i = 0; i < output[0].length; i++) {
|
for (let i = 0; i < output[0].length; i++) {
|
||||||
this.phase[n] = this.phase[n] ?? Math.random();
|
this.phase[n] = this.phase[n] ?? Math.random();
|
||||||
const v = waveshapes.sawblep(this.phase[n], dt);
|
const v = saw(this.phase[n], dt);
|
||||||
|
|
||||||
output[0][i] = output[0][i] + v * gainL;
|
output[0][i] = output[0][i] + v * gainL;
|
||||||
output[1][i] = output[1][i] + v * gainR;
|
output[1][i] = output[1][i] + v * gainR;
|
||||||
|
|||||||
@@ -1,28 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "@strudel/tidal",
|
|
||||||
"version": "0.1.0",
|
|
||||||
"description": "Experimental Tidal Code interpreter",
|
|
||||||
"module": "tidal.mjs",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/felixroos/hs2js.git"
|
|
||||||
},
|
|
||||||
"keywords": [
|
|
||||||
"haskell",
|
|
||||||
"javascript"
|
|
||||||
],
|
|
||||||
"author": "Felix Roos <flix91@gmail.com>",
|
|
||||||
"license": "AGPL-3.0-or-later",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/tidalcycles/strudel/issues"
|
|
||||||
},
|
|
||||||
"homepage": "https://github.com/tidalcycles/strudel/tree/main/packages/hs2js",
|
|
||||||
"dependencies": {
|
|
||||||
"@strudel/core": "workspace:*",
|
|
||||||
"@strudel/mini": "workspace:*",
|
|
||||||
"hs2js": "workspace:*"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"vite": "^5.0.10"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,73 +0,0 @@
|
|||||||
import { reify } from '@strudel/core';
|
|
||||||
import { m } from '@strudel/mini';
|
|
||||||
import { loadParser, evaluate } from 'hs2js';
|
|
||||||
|
|
||||||
function getInfixOperators() {
|
|
||||||
let operators = {
|
|
||||||
'>': 'set',
|
|
||||||
'#': 'set',
|
|
||||||
'+': 'add',
|
|
||||||
'-': 'sub',
|
|
||||||
'*': 'mul',
|
|
||||||
'/': 'div',
|
|
||||||
};
|
|
||||||
let alignments = {
|
|
||||||
in: (s) => '|' + s,
|
|
||||||
out: (s) => s + '|',
|
|
||||||
mix: (s) => '|' + s + '|',
|
|
||||||
};
|
|
||||||
let ops = {};
|
|
||||||
Object.entries(operators).forEach(([o, name]) => {
|
|
||||||
// operator without alignment
|
|
||||||
ops[o] = (l, r) => reify(l)[name](reify(r));
|
|
||||||
Object.entries(alignments).forEach(([a, getSymbol]) => {
|
|
||||||
// get symbol with alignment
|
|
||||||
let symbol = getSymbol(o);
|
|
||||||
ops[symbol] = (l, r) => reify(l)[name][a](reify(r));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
ops['~>'] = (l, r) => reify(l).late(reify(r));
|
|
||||||
ops['<~'] = (l, r) => reify(l).early(reify(r));
|
|
||||||
ops['<$>'] = (l, r) => reify(r).fmap(l).outerJoin(); // is this right?
|
|
||||||
return ops;
|
|
||||||
}
|
|
||||||
const ops = getInfixOperators();
|
|
||||||
|
|
||||||
export async function initTidal() {
|
|
||||||
// TODO: implement this in regular land
|
|
||||||
window.d1 = (pat) => pat.p('d1');
|
|
||||||
window.d2 = (pat) => pat.p('d2');
|
|
||||||
window.d3 = (pat) => pat.p('d3');
|
|
||||||
window.d4 = (pat) => pat.p('d4');
|
|
||||||
window.d5 = (pat) => pat.p('d5');
|
|
||||||
window.d6 = (pat) => pat.p('d6');
|
|
||||||
window.d7 = (pat) => pat.p('d7');
|
|
||||||
window.d8 = (pat) => pat.p('d8');
|
|
||||||
window.d9 = (pat) => pat.p('d9');
|
|
||||||
return loadParser();
|
|
||||||
}
|
|
||||||
|
|
||||||
// offset is expected to be passed in from transpiler
|
|
||||||
/*
|
|
||||||
1. acorn parses JS to find location of tidal call
|
|
||||||
2. haskell-tree-sitter calls "string" function with node (including location)
|
|
||||||
3. m function sets locations for individual mini notation atom
|
|
||||||
|
|
||||||
so the location for a mini notation atom is:
|
|
||||||
|
|
||||||
js offset + hs offset + atom offset
|
|
||||||
*/
|
|
||||||
export function tidal(code, offset = 0) {
|
|
||||||
if (Array.isArray(code)) {
|
|
||||||
code = code.join('');
|
|
||||||
}
|
|
||||||
return evaluate(code, window, {
|
|
||||||
...ops,
|
|
||||||
string: (node) => {
|
|
||||||
// parses strings as mini notation and passes location
|
|
||||||
const str = node.text.slice(1, -1);
|
|
||||||
const col = node.startIndex + offset;
|
|
||||||
return m(str, col);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@strudel/tonal",
|
"name": "@strudel/tonal",
|
||||||
"version": "1.1.0",
|
"version": "1.0.1",
|
||||||
"description": "Tonal functions for strudel",
|
"description": "Tonal functions for strudel",
|
||||||
"main": "index.mjs",
|
"main": "index.mjs",
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@strudel/transpiler",
|
"name": "@strudel/transpiler",
|
||||||
"version": "1.1.0",
|
"version": "1.0.1",
|
||||||
"description": "Transpiler for strudel user code. Converts syntactically correct but semantically meaningless JS into evaluatable strudel code.",
|
"description": "Transpiler for strudel user code. Converts syntactically correct but semantically meaningless JS into evaluatable strudel code.",
|
||||||
"main": "index.mjs",
|
"main": "index.mjs",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
@@ -26,16 +26,6 @@ export function transpiler(input, options = {}) {
|
|||||||
|
|
||||||
walk(ast, {
|
walk(ast, {
|
||||||
enter(node, parent /* , prop, index */) {
|
enter(node, parent /* , prop, index */) {
|
||||||
if (isTidalTeplateLiteral(node)) {
|
|
||||||
const raw = node.quasi.quasis[0].value.raw;
|
|
||||||
const offset = node.quasi.start + 1;
|
|
||||||
if (emitMiniLocations) {
|
|
||||||
const stringLocs = collectHaskellMiniLocations(raw, offset);
|
|
||||||
miniLocations = miniLocations.concat(stringLocs);
|
|
||||||
}
|
|
||||||
this.skip();
|
|
||||||
return this.replace(tidalWithLocation(raw, offset));
|
|
||||||
}
|
|
||||||
if (isBackTickString(node, parent)) {
|
if (isBackTickString(node, parent)) {
|
||||||
const { quasis } = node;
|
const { quasis } = node;
|
||||||
const { raw } = quasis[0].value;
|
const { raw } = quasis[0].value;
|
||||||
@@ -217,47 +207,3 @@ function labelToP(node) {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// tidal highlighting
|
|
||||||
// this feels kind of stupid, when we also know the location inside the string op (tidal.mjs)
|
|
||||||
// but maybe it's the only way
|
|
||||||
|
|
||||||
function isTidalTeplateLiteral(node) {
|
|
||||||
return node.type === 'TaggedTemplateExpression' && node.tag.name === 'tidal';
|
|
||||||
}
|
|
||||||
|
|
||||||
function collectHaskellMiniLocations(haskellCode, offset) {
|
|
||||||
return haskellCode
|
|
||||||
.split('')
|
|
||||||
.reduce((acc, char, i) => {
|
|
||||||
if (char !== '"') {
|
|
||||||
return acc;
|
|
||||||
}
|
|
||||||
if (!acc.length || acc[acc.length - 1].length > 1) {
|
|
||||||
acc.push([i + 1]);
|
|
||||||
} else {
|
|
||||||
acc[acc.length - 1].push(i);
|
|
||||||
}
|
|
||||||
return acc;
|
|
||||||
}, [])
|
|
||||||
.map(([start, end]) => {
|
|
||||||
const miniString = haskellCode.slice(start, end);
|
|
||||||
return getLeafLocations(`"${miniString}"`, offset + start - 1);
|
|
||||||
})
|
|
||||||
.flat();
|
|
||||||
}
|
|
||||||
|
|
||||||
function tidalWithLocation(value, offset) {
|
|
||||||
return {
|
|
||||||
type: 'CallExpression',
|
|
||||||
callee: {
|
|
||||||
type: 'Identifier',
|
|
||||||
name: 'tidal',
|
|
||||||
},
|
|
||||||
arguments: [
|
|
||||||
{ type: 'Literal', value },
|
|
||||||
{ type: 'Literal', value: offset },
|
|
||||||
],
|
|
||||||
optional: false,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -72,13 +72,7 @@ document.getElementById('play').addEventListener('stop',
|
|||||||
There is a tiny difference between the [Strudel REPL](https://strudel.cc/) and `@strudel/web`.
|
There is a tiny difference between the [Strudel REPL](https://strudel.cc/) and `@strudel/web`.
|
||||||
In the REPL you can use 'single quotes' for regular JS strings and "double quotes" for mini notation patterns.
|
In the REPL you can use 'single quotes' for regular JS strings and "double quotes" for mini notation patterns.
|
||||||
In `@strudel/web`, it does not matter which types of quotes you're using.
|
In `@strudel/web`, it does not matter which types of quotes you're using.
|
||||||
|
There will probably be an escapte hatch for that in the future.
|
||||||
This difference means that you cannot call pattern methods on raw strings, for example `"1 2 3".slow(2)`.
|
|
||||||
To make it work you can either:
|
|
||||||
|
|
||||||
1. Use the `evaluate` function, which behaves exactly like the Strudel REPL, interpreting double quoted strings as mini notation.
|
|
||||||
2. wrap the string with `m`: `m("1 2 3").slow(2)`
|
|
||||||
3. wrap the string in a control function: `n("1 2 3").slow(2)` depending on your context.
|
|
||||||
|
|
||||||
## More Examples
|
## More Examples
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@strudel/web",
|
"name": "@strudel/web",
|
||||||
"version": "1.1.0",
|
"version": "1.0.3",
|
||||||
"description": "Easy to setup, opiniated bundle of Strudel for the browser.",
|
"description": "Easy to setup, opiniated bundle of Strudel for the browser.",
|
||||||
"module": "web.mjs",
|
"module": "web.mjs",
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
"@strudel/webaudio": "workspace:*"
|
"@strudel/webaudio": "workspace:*"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@rollup/plugin-replace": "^5.0.5",
|
"vite": "^5.0.10",
|
||||||
"vite": "^5.0.10"
|
"@rollup/plugin-replace": "^5.0.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+14
-15
@@ -5,10 +5,10 @@ export * from '@strudel/transpiler';
|
|||||||
export * from '@strudel/mini';
|
export * from '@strudel/mini';
|
||||||
export * from '@strudel/tonal';
|
export * from '@strudel/tonal';
|
||||||
export * from '@strudel/webaudio';
|
export * from '@strudel/webaudio';
|
||||||
import { Pattern, evalScope, setTime } from '@strudel/core';
|
import { Pattern, evalScope } from '@strudel/core';
|
||||||
import { initAudioOnFirstClick, registerSynthSounds, webaudioRepl } from '@strudel/webaudio';
|
import { initAudioOnFirstClick, registerSynthSounds, webaudioScheduler } from '@strudel/webaudio';
|
||||||
// import { registerSoundfonts } from '@strudel/soundfonts';
|
// import { registerSoundfonts } from '@strudel/soundfonts';
|
||||||
import { evaluate as _evaluate, transpiler } from '@strudel/transpiler';
|
import { evaluate as _evaluate } from '@strudel/transpiler';
|
||||||
import { miniAllStrings } from '@strudel/mini';
|
import { miniAllStrings } from '@strudel/mini';
|
||||||
|
|
||||||
// init logic
|
// init logic
|
||||||
@@ -27,40 +27,39 @@ export async function defaultPrebake() {
|
|||||||
// when this function finishes, everything is initialized
|
// when this function finishes, everything is initialized
|
||||||
let initDone;
|
let initDone;
|
||||||
|
|
||||||
let repl;
|
let scheduler;
|
||||||
export function initStrudel(options = {}) {
|
export function initStrudel(options = {}) {
|
||||||
initAudioOnFirstClick();
|
initAudioOnFirstClick();
|
||||||
options.miniAllStrings !== false && miniAllStrings();
|
miniAllStrings();
|
||||||
const { prebake, ...replOptions } = options;
|
const { prebake, ...schedulerOptions } = options;
|
||||||
repl = webaudioRepl({ ...replOptions, transpiler });
|
|
||||||
initDone = (async () => {
|
initDone = (async () => {
|
||||||
await defaultPrebake();
|
await defaultPrebake();
|
||||||
await prebake?.();
|
await prebake?.();
|
||||||
return repl;
|
|
||||||
})();
|
})();
|
||||||
setTime(() => repl.scheduler.now());
|
scheduler = webaudioScheduler(schedulerOptions);
|
||||||
return initDone;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
window.initStrudel = initStrudel;
|
window.initStrudel = initStrudel;
|
||||||
|
|
||||||
// this method will play the pattern on the default scheduler
|
// this method will play the pattern on the default scheduler
|
||||||
Pattern.prototype.play = function () {
|
Pattern.prototype.play = function () {
|
||||||
if (!repl) {
|
if (!scheduler) {
|
||||||
throw new Error('.play: no repl found. Have you called initStrudel?');
|
throw new Error('.play: no scheduler found. Have you called init?');
|
||||||
}
|
}
|
||||||
initDone.then(() => {
|
initDone.then(() => {
|
||||||
repl.setPattern(this, true);
|
scheduler.setPattern(this, true);
|
||||||
});
|
});
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
// stop playback
|
// stop playback
|
||||||
export function hush() {
|
export function hush() {
|
||||||
repl.stop();
|
scheduler.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
// evaluate and play the given code using the transpiler
|
// evaluate and play the given code using the transpiler
|
||||||
export async function evaluate(code, autoplay = true) {
|
export async function evaluate(code, autoplay = true) {
|
||||||
return repl.evaluate(code, autoplay);
|
const { pattern } = await _evaluate(code);
|
||||||
|
autoplay && pattern.play();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@strudel/webaudio",
|
"name": "@strudel/webaudio",
|
||||||
"version": "1.1.0",
|
"version": "1.0.1",
|
||||||
"description": "Web Audio helpers for Strudel",
|
"description": "Web Audio helpers for Strudel",
|
||||||
"main": "index.mjs",
|
"main": "index.mjs",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ This program is free software: you can redistribute it and/or modify it under th
|
|||||||
|
|
||||||
import * as strudel from '@strudel/core';
|
import * as strudel from '@strudel/core';
|
||||||
import { superdough, getAudioContext, setLogger, doughTrigger } from 'superdough';
|
import { superdough, getAudioContext, setLogger, doughTrigger } from 'superdough';
|
||||||
const { Pattern, logger, repl } = strudel;
|
const { Pattern, logger } = strudel;
|
||||||
|
|
||||||
setLogger(logger);
|
setLogger(logger);
|
||||||
|
|
||||||
@@ -24,13 +24,17 @@ Pattern.prototype.webaudio = function () {
|
|||||||
return this.onTrigger(webaudioOutputTrigger);
|
return this.onTrigger(webaudioOutputTrigger);
|
||||||
};
|
};
|
||||||
|
|
||||||
export function webaudioRepl(options = {}) {
|
export function webaudioScheduler(options = {}) {
|
||||||
options = {
|
options = {
|
||||||
getTime: () => getAudioContext().currentTime,
|
getTime: () => getAudioContext().currentTime,
|
||||||
defaultOutput: webaudioOutput,
|
defaultOutput: webaudioOutput,
|
||||||
...options,
|
...options,
|
||||||
};
|
};
|
||||||
return repl(options);
|
const { defaultOutput, getTime } = options;
|
||||||
|
return new strudel.Cyclist({
|
||||||
|
...options,
|
||||||
|
onTrigger: strudel.getTrigger({ defaultOutput, getTime }),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Pattern.prototype.dough = function () {
|
Pattern.prototype.dough = function () {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@strudel/xen",
|
"name": "@strudel/xen",
|
||||||
"version": "1.1.0",
|
"version": "1.0.1",
|
||||||
"description": "Xenharmonic API for strudel",
|
"description": "Xenharmonic API for strudel",
|
||||||
"main": "index.mjs",
|
"main": "index.mjs",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
Generated
+62
-94
@@ -78,9 +78,6 @@ importers:
|
|||||||
'@strudel/core':
|
'@strudel/core':
|
||||||
specifier: workspace:*
|
specifier: workspace:*
|
||||||
version: link:../../packages/core
|
version: link:../../packages/core
|
||||||
'@strudel/draw':
|
|
||||||
specifier: workspace:*
|
|
||||||
version: link:../../packages/draw
|
|
||||||
'@strudel/mini':
|
'@strudel/mini':
|
||||||
specifier: workspace:*
|
specifier: workspace:*
|
||||||
version: link:../../packages/mini
|
version: link:../../packages/mini
|
||||||
@@ -143,19 +140,6 @@ importers:
|
|||||||
specifier: ^5.0.10
|
specifier: ^5.0.10
|
||||||
version: 5.0.10
|
version: 5.0.10
|
||||||
|
|
||||||
examples/tidal-repl:
|
|
||||||
dependencies:
|
|
||||||
'@strudel/web':
|
|
||||||
specifier: workspace:*
|
|
||||||
version: link:../../packages/web
|
|
||||||
hs2js:
|
|
||||||
specifier: workspace:*
|
|
||||||
version: link:../../packages/hs2js
|
|
||||||
devDependencies:
|
|
||||||
vite:
|
|
||||||
specifier: ^5.0.8
|
|
||||||
version: 5.2.2(@types/node@20.10.6)
|
|
||||||
|
|
||||||
packages/codemirror:
|
packages/codemirror:
|
||||||
dependencies:
|
dependencies:
|
||||||
'@codemirror/autocomplete':
|
'@codemirror/autocomplete':
|
||||||
@@ -267,19 +251,6 @@ importers:
|
|||||||
|
|
||||||
packages/embed: {}
|
packages/embed: {}
|
||||||
|
|
||||||
packages/hs2js:
|
|
||||||
dependencies:
|
|
||||||
web-tree-sitter:
|
|
||||||
specifier: ^0.20.8
|
|
||||||
version: 0.20.8
|
|
||||||
devDependencies:
|
|
||||||
tree-sitter-haskell:
|
|
||||||
specifier: ^0.21.0
|
|
||||||
version: 0.21.0(tree-sitter@0.21.1)
|
|
||||||
vite:
|
|
||||||
specifier: ^5.0.10
|
|
||||||
version: 5.2.2(@types/node@20.10.6)
|
|
||||||
|
|
||||||
packages/hydra:
|
packages/hydra:
|
||||||
dependencies:
|
dependencies:
|
||||||
'@strudel/core':
|
'@strudel/core':
|
||||||
@@ -331,6 +302,33 @@ importers:
|
|||||||
specifier: ^1.1.0
|
specifier: ^1.1.0
|
||||||
version: 1.1.0(@vitest/ui@1.1.0)
|
version: 1.1.0(@vitest/ui@1.1.0)
|
||||||
|
|
||||||
|
packages/node:
|
||||||
|
dependencies:
|
||||||
|
'@strudel/core':
|
||||||
|
specifier: workspace:*
|
||||||
|
version: link:../core
|
||||||
|
'@strudel/mini':
|
||||||
|
specifier: workspace:*
|
||||||
|
version: link:../mini
|
||||||
|
'@strudel/osc':
|
||||||
|
specifier: workspace:*
|
||||||
|
version: link:../osc
|
||||||
|
'@strudel/tonal':
|
||||||
|
specifier: workspace:*
|
||||||
|
version: link:../tonal
|
||||||
|
'@strudel/transpiler':
|
||||||
|
specifier: workspace:*
|
||||||
|
version: link:../transpiler
|
||||||
|
node-watch:
|
||||||
|
specifier: ^0.7.4
|
||||||
|
version: 0.7.4
|
||||||
|
node-web-audio-api:
|
||||||
|
specifier: ^0.20.0
|
||||||
|
version: 0.20.0
|
||||||
|
osc-js:
|
||||||
|
specifier: ^2.4.0
|
||||||
|
version: 2.4.0
|
||||||
|
|
||||||
packages/osc:
|
packages/osc:
|
||||||
dependencies:
|
dependencies:
|
||||||
'@strudel/core':
|
'@strudel/core':
|
||||||
@@ -438,22 +436,6 @@ importers:
|
|||||||
specifier: ^5.0.10
|
specifier: ^5.0.10
|
||||||
version: 5.0.10
|
version: 5.0.10
|
||||||
|
|
||||||
packages/tidal:
|
|
||||||
dependencies:
|
|
||||||
'@strudel/core':
|
|
||||||
specifier: workspace:*
|
|
||||||
version: link:../core
|
|
||||||
'@strudel/mini':
|
|
||||||
specifier: workspace:*
|
|
||||||
version: link:../mini
|
|
||||||
hs2js:
|
|
||||||
specifier: workspace:*
|
|
||||||
version: link:../hs2js
|
|
||||||
devDependencies:
|
|
||||||
vite:
|
|
||||||
specifier: ^5.0.10
|
|
||||||
version: 5.2.2(@types/node@20.10.6)
|
|
||||||
|
|
||||||
packages/tonal:
|
packages/tonal:
|
||||||
dependencies:
|
dependencies:
|
||||||
'@strudel/core':
|
'@strudel/core':
|
||||||
@@ -632,9 +614,6 @@ importers:
|
|||||||
'@strudel/soundfonts':
|
'@strudel/soundfonts':
|
||||||
specifier: workspace:*
|
specifier: workspace:*
|
||||||
version: link:../packages/soundfonts
|
version: link:../packages/soundfonts
|
||||||
'@strudel/tidal':
|
|
||||||
specifier: workspace:*
|
|
||||||
version: link:../packages/tidal
|
|
||||||
'@strudel/tonal':
|
'@strudel/tonal':
|
||||||
specifier: workspace:*
|
specifier: workspace:*
|
||||||
version: link:../packages/tonal
|
version: link:../packages/tonal
|
||||||
@@ -677,9 +656,6 @@ importers:
|
|||||||
date-fns:
|
date-fns:
|
||||||
specifier: ^3.2.0
|
specifier: ^3.2.0
|
||||||
version: 3.2.0
|
version: 3.2.0
|
||||||
hs2js:
|
|
||||||
specifier: 0.0.8
|
|
||||||
version: 0.0.8
|
|
||||||
nanoid:
|
nanoid:
|
||||||
specifier: ^5.0.4
|
specifier: ^5.0.4
|
||||||
version: 5.0.4
|
version: 5.0.4
|
||||||
@@ -3518,6 +3494,22 @@ packages:
|
|||||||
react: 18.2.0
|
react: 18.2.0
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
/@napi-rs/cli@2.18.2:
|
||||||
|
resolution: {integrity: sha512-IXQji3IF5eStxTHe/PxDSRjPrFymYAQ5FbIvqurxzxyWR8nJql9mtvmCP8y2g8tSoW5xhaToLQW0+mO3lUZq4w==}
|
||||||
|
engines: {node: '>= 10'}
|
||||||
|
hasBin: true
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/@napi-rs/triples@1.2.0:
|
||||||
|
resolution: {integrity: sha512-HAPjR3bnCsdXBsATpDIP5WCrw0JcACwhhrwIAQhiR46n+jm+a2F8kBsfseAuWtSyQ+H3Yebt2k43B5dy+04yMA==}
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/@node-rs/helper@1.6.0:
|
||||||
|
resolution: {integrity: sha512-2OTh/tokcLA1qom1zuCJm2gQzaZljCCbtX1YCrwRVd/toz7KxaDRFeLTAPwhs8m9hWgzrBn5rShRm6IaZofCPw==}
|
||||||
|
dependencies:
|
||||||
|
'@napi-rs/triples': 1.2.0
|
||||||
|
dev: false
|
||||||
|
|
||||||
/@nodelib/fs.scandir@2.1.5:
|
/@nodelib/fs.scandir@2.1.5:
|
||||||
resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==}
|
resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==}
|
||||||
engines: {node: '>= 8'}
|
engines: {node: '>= 8'}
|
||||||
@@ -8525,12 +8517,6 @@ packages:
|
|||||||
lru-cache: 10.1.0
|
lru-cache: 10.1.0
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/hs2js@0.0.8:
|
|
||||||
resolution: {integrity: sha512-wFSenhY2MB1ACuwaJq0QyDk6yZiYwha/yOgAa2scsLvqEJTdHY2KXhsy8uZw+G2oVxQGyXs0OPf5gXN7HkP9mA==}
|
|
||||||
dependencies:
|
|
||||||
web-tree-sitter: 0.20.8
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/html-escaper@3.0.3:
|
/html-escaper@3.0.3:
|
||||||
resolution: {integrity: sha512-RuMffC89BOWQoY0WKGpIhn5gX3iI54O6nRA0yC124NYVtzjmFWBIiFd8M0x+ZdX0P9R4lADg1mgP8C7PxGOWuQ==}
|
resolution: {integrity: sha512-RuMffC89BOWQoY0WKGpIhn5gX3iI54O6nRA0yC124NYVtzjmFWBIiFd8M0x+ZdX0P9R4lADg1mgP8C7PxGOWuQ==}
|
||||||
|
|
||||||
@@ -10694,11 +10680,6 @@ packages:
|
|||||||
semver: 7.5.4
|
semver: 7.5.4
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/node-addon-api@8.0.0:
|
|
||||||
resolution: {integrity: sha512-ipO7rsHEBqa9STO5C5T10fj732ml+5kLN1cAG8/jdHd56ldQeGj3Q7+scUS+VHK/qy1zLEwC4wMK5+yM0btPvw==}
|
|
||||||
engines: {node: ^18 || ^20 || >= 21}
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/node-domexception@1.0.0:
|
/node-domexception@1.0.0:
|
||||||
resolution: {integrity: sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==}
|
resolution: {integrity: sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==}
|
||||||
engines: {node: '>=10.5.0'}
|
engines: {node: '>=10.5.0'}
|
||||||
@@ -10742,11 +10723,6 @@ packages:
|
|||||||
engines: {node: '>= 0.6.0'}
|
engines: {node: '>= 0.6.0'}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/node-gyp-build@4.8.1:
|
|
||||||
resolution: {integrity: sha512-OSs33Z9yWr148JZcbZd5WiAXhh/n9z8TxQcdMhIOlpN9AhWpLfvVFO73+m77bBABQMaY9XSvIa+qk0jlI7Gcaw==}
|
|
||||||
hasBin: true
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/node-gyp@10.0.1:
|
/node-gyp@10.0.1:
|
||||||
resolution: {integrity: sha512-gg3/bHehQfZivQVfqIyy8wTdSymF9yTyP4CJifK73imyNMU8AIGQE2pUa7dNWfmMeG9cDVF2eehiRMv0LC1iAg==}
|
resolution: {integrity: sha512-gg3/bHehQfZivQVfqIyy8wTdSymF9yTyP4CJifK73imyNMU8AIGQE2pUa7dNWfmMeG9cDVF2eehiRMv0LC1iAg==}
|
||||||
engines: {node: ^16.14.0 || >=18.0.0}
|
engines: {node: ^16.14.0 || >=18.0.0}
|
||||||
@@ -10784,6 +10760,20 @@ packages:
|
|||||||
'@babel/parser': 7.23.6
|
'@babel/parser': 7.23.6
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/node-watch@0.7.4:
|
||||||
|
resolution: {integrity: sha512-RinNxoz4W1cep1b928fuFhvAQ5ag/+1UlMDV7rbyGthBIgsiEouS4kvRayvvboxii4m8eolKOIBo3OjDqbc+uQ==}
|
||||||
|
engines: {node: '>=6'}
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/node-web-audio-api@0.20.0:
|
||||||
|
resolution: {integrity: sha512-DPsRSG3IsI8cLCdejpruir+XgSwUFFJBSfilrtoT+BU/uFcXv/eFyKkulnKIE2642j5b00z9aOHxTHbzdUvTtw==}
|
||||||
|
engines: {node: '>= 14'}
|
||||||
|
dependencies:
|
||||||
|
'@napi-rs/cli': 2.18.2
|
||||||
|
'@node-rs/helper': 1.6.0
|
||||||
|
webidl-conversions: 7.0.0
|
||||||
|
dev: false
|
||||||
|
|
||||||
/nopt@7.1.0:
|
/nopt@7.1.0:
|
||||||
resolution: {integrity: sha512-ZFPLe9Iu0tnx7oWhFxAo4s7QTn8+NNDDxYNaKLjE7Dp0tbakQ3M1QhQzsnzXHQBTUO3K9BmwaxnyO8Ayn2I95Q==}
|
resolution: {integrity: sha512-ZFPLe9Iu0tnx7oWhFxAo4s7QTn8+NNDDxYNaKLjE7Dp0tbakQ3M1QhQzsnzXHQBTUO3K9BmwaxnyO8Ayn2I95Q==}
|
||||||
engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0}
|
engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0}
|
||||||
@@ -13459,29 +13449,6 @@ packages:
|
|||||||
punycode: 2.3.1
|
punycode: 2.3.1
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/tree-sitter-haskell@0.21.0(tree-sitter@0.21.1):
|
|
||||||
resolution: {integrity: sha512-b2RLegPHuYPh7nJ3YKWgkWnFYxmYlQDE8TDJuNH+iuNuBcCMYyaA9JlJlMHfCvf7DmJNPtqqbO9Kh9NXEmbatQ==}
|
|
||||||
requiresBuild: true
|
|
||||||
peerDependencies:
|
|
||||||
tree-sitter: ^0.21.0
|
|
||||||
tree_sitter: '*'
|
|
||||||
peerDependenciesMeta:
|
|
||||||
tree_sitter:
|
|
||||||
optional: true
|
|
||||||
dependencies:
|
|
||||||
node-addon-api: 8.0.0
|
|
||||||
node-gyp-build: 4.8.1
|
|
||||||
tree-sitter: 0.21.1
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/tree-sitter@0.21.1:
|
|
||||||
resolution: {integrity: sha512-7dxoA6kYvtgWw80265MyqJlkRl4yawIjO7S5MigytjELkX43fV2WsAXzsNfO7sBpPPCF5Gp0+XzHk0DwLCq3xQ==}
|
|
||||||
requiresBuild: true
|
|
||||||
dependencies:
|
|
||||||
node-addon-api: 8.0.0
|
|
||||||
node-gyp-build: 4.8.1
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/trim-lines@3.0.1:
|
/trim-lines@3.0.1:
|
||||||
resolution: {integrity: sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==}
|
resolution: {integrity: sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==}
|
||||||
|
|
||||||
@@ -14276,10 +14243,6 @@ packages:
|
|||||||
engines: {node: '>= 8'}
|
engines: {node: '>= 8'}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/web-tree-sitter@0.20.8:
|
|
||||||
resolution: {integrity: sha512-weOVgZ3aAARgdnb220GqYuh7+rZU0Ka9k9yfKtGAzEYMa6GgiCzW9JjQRJyCJakvibQW+dfjJdihjInKuuCAUQ==}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/webidl-conversions@3.0.1:
|
/webidl-conversions@3.0.1:
|
||||||
resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==}
|
resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==}
|
||||||
|
|
||||||
@@ -14287,6 +14250,11 @@ packages:
|
|||||||
resolution: {integrity: sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==}
|
resolution: {integrity: sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/webidl-conversions@7.0.0:
|
||||||
|
resolution: {integrity: sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
dev: false
|
||||||
|
|
||||||
/webmidi@3.1.8:
|
/webmidi@3.1.8:
|
||||||
resolution: {integrity: sha512-PCRic1iTpKxeheb888G0mDe6MBdz/u+s/xfdV6+1ZhZnS6dKtV9gMBth5cpmMip2Livv5lL+ep4/S9DCzHfumg==}
|
resolution: {integrity: sha512-PCRic1iTpKxeheb888G0mDe6MBdz/u+s/xfdV6+1ZhZnS6dKtV9gMBth5cpmMip2Livv5lL+ep4/S9DCzHfumg==}
|
||||||
engines: {node: '>=8.5'}
|
engines: {node: '>=8.5'}
|
||||||
|
|||||||
@@ -2197,75 +2197,6 @@ exports[`runs examples > example "djf" example index 0 1`] = `
|
|||||||
|
|
||||||
exports[`runs examples > example "drawLine" example index 0 1`] = `[]`;
|
exports[`runs examples > example "drawLine" example index 0 1`] = `[]`;
|
||||||
|
|
||||||
exports[`runs examples > example "drive" example index 0 1`] = `
|
|
||||||
[
|
|
||||||
"[ 0/1 → 1/16 | note:36 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:0.5 ]",
|
|
||||||
"[ 1/16 → 1/8 | note:38 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:0.5 ]",
|
|
||||||
"[ 1/8 → 3/16 | note:38 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:0.5 ]",
|
|
||||||
"[ 3/16 → 1/4 | note:31 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:0.5 ]",
|
|
||||||
"[ 1/4 → 5/16 | note:33 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:0.5 ]",
|
|
||||||
"[ 5/16 → 3/8 | note:40 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:0.5 ]",
|
|
||||||
"[ 3/8 → 7/16 | note:41 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:0.5 ]",
|
|
||||||
"[ 7/16 → 1/2 | note:36 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:0.5 ]",
|
|
||||||
"[ 1/2 → 9/16 | note:38 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:0.5 ]",
|
|
||||||
"[ 9/16 → 5/8 | note:38 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:0.5 ]",
|
|
||||||
"[ 5/8 → 11/16 | note:31 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:0.5 ]",
|
|
||||||
"[ 11/16 → 3/4 | note:33 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:0.5 ]",
|
|
||||||
"[ 3/4 → 13/16 | note:40 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:0.5 ]",
|
|
||||||
"[ 13/16 → 7/8 | note:41 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:0.5 ]",
|
|
||||||
"[ 7/8 → 15/16 | note:36 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:0.5 ]",
|
|
||||||
"[ 15/16 → 1/1 | note:38 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:0.5 ]",
|
|
||||||
"[ 1/1 → 17/16 | note:38 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:4 ]",
|
|
||||||
"[ 17/16 → 9/8 | note:31 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:4 ]",
|
|
||||||
"[ 9/8 → 19/16 | note:33 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:4 ]",
|
|
||||||
"[ 19/16 → 5/4 | note:40 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:4 ]",
|
|
||||||
"[ 5/4 → 21/16 | note:41 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:4 ]",
|
|
||||||
"[ 21/16 → 11/8 | note:36 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:4 ]",
|
|
||||||
"[ 11/8 → 23/16 | note:38 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:4 ]",
|
|
||||||
"[ 23/16 → 3/2 | note:38 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:4 ]",
|
|
||||||
"[ 3/2 → 25/16 | note:31 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:4 ]",
|
|
||||||
"[ 25/16 → 13/8 | note:33 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:4 ]",
|
|
||||||
"[ 13/8 → 27/16 | note:40 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:4 ]",
|
|
||||||
"[ 27/16 → 7/4 | note:41 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:4 ]",
|
|
||||||
"[ 7/4 → 29/16 | note:36 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:4 ]",
|
|
||||||
"[ 29/16 → 15/8 | note:38 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:4 ]",
|
|
||||||
"[ 15/8 → 31/16 | note:38 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:4 ]",
|
|
||||||
"[ 31/16 → 2/1 | note:31 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:4 ]",
|
|
||||||
"[ 2/1 → 33/16 | note:33 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:0.5 ]",
|
|
||||||
"[ 33/16 → 17/8 | note:40 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:0.5 ]",
|
|
||||||
"[ 17/8 → 35/16 | note:41 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:0.5 ]",
|
|
||||||
"[ 35/16 → 9/4 | note:36 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:0.5 ]",
|
|
||||||
"[ 9/4 → 37/16 | note:38 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:0.5 ]",
|
|
||||||
"[ 37/16 → 19/8 | note:38 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:0.5 ]",
|
|
||||||
"[ 19/8 → 39/16 | note:31 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:0.5 ]",
|
|
||||||
"[ 39/16 → 5/2 | note:33 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:0.5 ]",
|
|
||||||
"[ 5/2 → 41/16 | note:40 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:0.5 ]",
|
|
||||||
"[ 41/16 → 21/8 | note:41 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:0.5 ]",
|
|
||||||
"[ 21/8 → 43/16 | note:36 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:0.5 ]",
|
|
||||||
"[ 43/16 → 11/4 | note:38 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:0.5 ]",
|
|
||||||
"[ 11/4 → 45/16 | note:38 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:0.5 ]",
|
|
||||||
"[ 45/16 → 23/8 | note:31 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:0.5 ]",
|
|
||||||
"[ 23/8 → 47/16 | note:33 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:0.5 ]",
|
|
||||||
"[ 47/16 → 3/1 | note:40 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:0.5 ]",
|
|
||||||
"[ 3/1 → 49/16 | note:41 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:4 ]",
|
|
||||||
"[ 49/16 → 25/8 | note:36 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:4 ]",
|
|
||||||
"[ 25/8 → 51/16 | note:38 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:4 ]",
|
|
||||||
"[ 51/16 → 13/4 | note:38 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:4 ]",
|
|
||||||
"[ 13/4 → 53/16 | note:31 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:4 ]",
|
|
||||||
"[ 53/16 → 27/8 | note:33 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:4 ]",
|
|
||||||
"[ 27/8 → 55/16 | note:40 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:4 ]",
|
|
||||||
"[ 55/16 → 7/2 | note:41 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:4 ]",
|
|
||||||
"[ 7/2 → 57/16 | note:36 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:4 ]",
|
|
||||||
"[ 57/16 → 29/8 | note:38 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:4 ]",
|
|
||||||
"[ 29/8 → 59/16 | note:38 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:4 ]",
|
|
||||||
"[ 59/16 → 15/4 | note:31 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:4 ]",
|
|
||||||
"[ 15/4 → 61/16 | note:33 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:4 ]",
|
|
||||||
"[ 61/16 → 31/8 | note:40 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:4 ]",
|
|
||||||
"[ 31/8 → 63/16 | note:41 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:4 ]",
|
|
||||||
"[ 63/16 → 4/1 | note:36 s:supersaw lpenv:8 cutoff:150 resonance:0.8 ftype:ladder drive:4 ]",
|
|
||||||
]
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`runs examples > example "dry" example index 0 1`] = `
|
exports[`runs examples > example "dry" example index 0 1`] = `
|
||||||
[
|
[
|
||||||
"[ 0/1 → 1/8 | n:0 s:superpiano room:0.7 dry:0 ]",
|
"[ 0/1 → 1/8 | n:0 s:superpiano room:0.7 dry:0 ]",
|
||||||
@@ -2562,43 +2493,6 @@ exports[`runs examples > example "every" example index 0 1`] = `
|
|||||||
]
|
]
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`runs examples > example "fanchor" example index 0 1`] = `
|
|
||||||
[
|
|
||||||
"[ 0/1 → 1/8 | note:f s:sawtooth cutoff:1000 lpenv:8 fanchor:0 ]",
|
|
||||||
"[ 1/8 → 1/4 | note:g s:sawtooth cutoff:1000 lpenv:8 fanchor:0 ]",
|
|
||||||
"[ 1/4 → 3/8 | note:g s:sawtooth cutoff:1000 lpenv:8 fanchor:0 ]",
|
|
||||||
"[ 3/8 → 1/2 | note:c s:sawtooth cutoff:1000 lpenv:8 fanchor:0 ]",
|
|
||||||
"[ 1/2 → 5/8 | note:d s:sawtooth cutoff:1000 lpenv:8 fanchor:0 ]",
|
|
||||||
"[ 5/8 → 3/4 | note:a s:sawtooth cutoff:1000 lpenv:8 fanchor:0 ]",
|
|
||||||
"[ 3/4 → 7/8 | note:a# s:sawtooth cutoff:1000 lpenv:8 fanchor:0 ]",
|
|
||||||
"[ 7/8 → 1/1 | note:f s:sawtooth cutoff:1000 lpenv:8 fanchor:0 ]",
|
|
||||||
"[ 1/1 → 9/8 | note:g s:sawtooth cutoff:1000 lpenv:8 fanchor:0.5 ]",
|
|
||||||
"[ 9/8 → 5/4 | note:g s:sawtooth cutoff:1000 lpenv:8 fanchor:0.5 ]",
|
|
||||||
"[ 5/4 → 11/8 | note:c s:sawtooth cutoff:1000 lpenv:8 fanchor:0.5 ]",
|
|
||||||
"[ 11/8 → 3/2 | note:d s:sawtooth cutoff:1000 lpenv:8 fanchor:0.5 ]",
|
|
||||||
"[ 3/2 → 13/8 | note:a s:sawtooth cutoff:1000 lpenv:8 fanchor:0.5 ]",
|
|
||||||
"[ 13/8 → 7/4 | note:a# s:sawtooth cutoff:1000 lpenv:8 fanchor:0.5 ]",
|
|
||||||
"[ 7/4 → 15/8 | note:f s:sawtooth cutoff:1000 lpenv:8 fanchor:0.5 ]",
|
|
||||||
"[ 15/8 → 2/1 | note:g s:sawtooth cutoff:1000 lpenv:8 fanchor:0.5 ]",
|
|
||||||
"[ 2/1 → 17/8 | note:g s:sawtooth cutoff:1000 lpenv:8 fanchor:1 ]",
|
|
||||||
"[ 17/8 → 9/4 | note:c s:sawtooth cutoff:1000 lpenv:8 fanchor:1 ]",
|
|
||||||
"[ 9/4 → 19/8 | note:d s:sawtooth cutoff:1000 lpenv:8 fanchor:1 ]",
|
|
||||||
"[ 19/8 → 5/2 | note:a s:sawtooth cutoff:1000 lpenv:8 fanchor:1 ]",
|
|
||||||
"[ 5/2 → 21/8 | note:a# s:sawtooth cutoff:1000 lpenv:8 fanchor:1 ]",
|
|
||||||
"[ 21/8 → 11/4 | note:f s:sawtooth cutoff:1000 lpenv:8 fanchor:1 ]",
|
|
||||||
"[ 11/4 → 23/8 | note:g s:sawtooth cutoff:1000 lpenv:8 fanchor:1 ]",
|
|
||||||
"[ 23/8 → 3/1 | note:g s:sawtooth cutoff:1000 lpenv:8 fanchor:1 ]",
|
|
||||||
"[ 3/1 → 25/8 | note:c s:sawtooth cutoff:1000 lpenv:8 fanchor:0 ]",
|
|
||||||
"[ 25/8 → 13/4 | note:d s:sawtooth cutoff:1000 lpenv:8 fanchor:0 ]",
|
|
||||||
"[ 13/4 → 27/8 | note:a s:sawtooth cutoff:1000 lpenv:8 fanchor:0 ]",
|
|
||||||
"[ 27/8 → 7/2 | note:a# s:sawtooth cutoff:1000 lpenv:8 fanchor:0 ]",
|
|
||||||
"[ 7/2 → 29/8 | note:f s:sawtooth cutoff:1000 lpenv:8 fanchor:0 ]",
|
|
||||||
"[ 29/8 → 15/4 | note:g s:sawtooth cutoff:1000 lpenv:8 fanchor:0 ]",
|
|
||||||
"[ 15/4 → 31/8 | note:g s:sawtooth cutoff:1000 lpenv:8 fanchor:0 ]",
|
|
||||||
"[ 31/8 → 4/1 | note:c s:sawtooth cutoff:1000 lpenv:8 fanchor:0 ]",
|
|
||||||
]
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`runs examples > example "fast" example index 0 1`] = `
|
exports[`runs examples > example "fast" example index 0 1`] = `
|
||||||
[
|
[
|
||||||
"[ 0/1 → 1/8 | s:bd ]",
|
"[ 0/1 → 1/8 | s:bd ]",
|
||||||
@@ -2983,99 +2877,22 @@ exports[`runs examples > example "fscope" example index 0 1`] = `
|
|||||||
|
|
||||||
exports[`runs examples > example "ftype" example index 0 1`] = `
|
exports[`runs examples > example "ftype" example index 0 1`] = `
|
||||||
[
|
[
|
||||||
"[ 0/1 → 1/8 | note:f s:sawtooth lpenv:4 cutoff:500 ftype:0 resonance:1 ]",
|
"[ 0/1 → 1/4 | note:c2 s:sawtooth cutoff:500 bpenv:4 ftype:12db ]",
|
||||||
"[ 1/8 → 1/4 | note:g s:sawtooth lpenv:4 cutoff:500 ftype:0 resonance:1 ]",
|
"[ 1/4 → 1/2 | note:e2 s:sawtooth cutoff:500 bpenv:4 ftype:12db ]",
|
||||||
"[ 1/4 → 3/8 | note:g s:sawtooth lpenv:4 cutoff:500 ftype:0 resonance:1 ]",
|
"[ 1/2 → 3/4 | note:f2 s:sawtooth cutoff:500 bpenv:4 ftype:24db ]",
|
||||||
"[ 3/8 → 1/2 | note:c s:sawtooth lpenv:4 cutoff:500 ftype:0 resonance:1 ]",
|
"[ 3/4 → 1/1 | note:g2 s:sawtooth cutoff:500 bpenv:4 ftype:24db ]",
|
||||||
"[ 1/2 → 5/8 | note:d s:sawtooth lpenv:4 cutoff:500 ftype:0 resonance:1 ]",
|
"[ 1/1 → 5/4 | note:c2 s:sawtooth cutoff:500 bpenv:4 ftype:12db ]",
|
||||||
"[ 5/8 → 3/4 | note:a s:sawtooth lpenv:4 cutoff:500 ftype:0 resonance:1 ]",
|
"[ 5/4 → 3/2 | note:e2 s:sawtooth cutoff:500 bpenv:4 ftype:12db ]",
|
||||||
"[ 3/4 → 7/8 | note:a# s:sawtooth lpenv:4 cutoff:500 ftype:0 resonance:1 ]",
|
"[ 3/2 → 7/4 | note:f2 s:sawtooth cutoff:500 bpenv:4 ftype:24db ]",
|
||||||
"[ 7/8 → 1/1 | note:f s:sawtooth lpenv:4 cutoff:500 ftype:0 resonance:1 ]",
|
"[ 7/4 → 2/1 | note:g2 s:sawtooth cutoff:500 bpenv:4 ftype:24db ]",
|
||||||
"[ 1/1 → 9/8 | note:g s:sawtooth lpenv:4 cutoff:500 ftype:1 resonance:1 ]",
|
"[ 2/1 → 9/4 | note:c2 s:sawtooth cutoff:500 bpenv:4 ftype:12db ]",
|
||||||
"[ 9/8 → 5/4 | note:g s:sawtooth lpenv:4 cutoff:500 ftype:1 resonance:1 ]",
|
"[ 9/4 → 5/2 | note:e2 s:sawtooth cutoff:500 bpenv:4 ftype:12db ]",
|
||||||
"[ 5/4 → 11/8 | note:c s:sawtooth lpenv:4 cutoff:500 ftype:1 resonance:1 ]",
|
"[ 5/2 → 11/4 | note:f2 s:sawtooth cutoff:500 bpenv:4 ftype:24db ]",
|
||||||
"[ 11/8 → 3/2 | note:d s:sawtooth lpenv:4 cutoff:500 ftype:1 resonance:1 ]",
|
"[ 11/4 → 3/1 | note:g2 s:sawtooth cutoff:500 bpenv:4 ftype:24db ]",
|
||||||
"[ 3/2 → 13/8 | note:a s:sawtooth lpenv:4 cutoff:500 ftype:1 resonance:1 ]",
|
"[ 3/1 → 13/4 | note:c2 s:sawtooth cutoff:500 bpenv:4 ftype:12db ]",
|
||||||
"[ 13/8 → 7/4 | note:a# s:sawtooth lpenv:4 cutoff:500 ftype:1 resonance:1 ]",
|
"[ 13/4 → 7/2 | note:e2 s:sawtooth cutoff:500 bpenv:4 ftype:12db ]",
|
||||||
"[ 7/4 → 15/8 | note:f s:sawtooth lpenv:4 cutoff:500 ftype:1 resonance:1 ]",
|
"[ 7/2 → 15/4 | note:f2 s:sawtooth cutoff:500 bpenv:4 ftype:24db ]",
|
||||||
"[ 15/8 → 2/1 | note:g s:sawtooth lpenv:4 cutoff:500 ftype:1 resonance:1 ]",
|
"[ 15/4 → 4/1 | note:g2 s:sawtooth cutoff:500 bpenv:4 ftype:24db ]",
|
||||||
"[ 2/1 → 17/8 | note:g s:sawtooth lpenv:4 cutoff:500 ftype:2 resonance:1 ]",
|
|
||||||
"[ 17/8 → 9/4 | note:c s:sawtooth lpenv:4 cutoff:500 ftype:2 resonance:1 ]",
|
|
||||||
"[ 9/4 → 19/8 | note:d s:sawtooth lpenv:4 cutoff:500 ftype:2 resonance:1 ]",
|
|
||||||
"[ 19/8 → 5/2 | note:a s:sawtooth lpenv:4 cutoff:500 ftype:2 resonance:1 ]",
|
|
||||||
"[ 5/2 → 21/8 | note:a# s:sawtooth lpenv:4 cutoff:500 ftype:2 resonance:1 ]",
|
|
||||||
"[ 21/8 → 11/4 | note:f s:sawtooth lpenv:4 cutoff:500 ftype:2 resonance:1 ]",
|
|
||||||
"[ 11/4 → 23/8 | note:g s:sawtooth lpenv:4 cutoff:500 ftype:2 resonance:1 ]",
|
|
||||||
"[ 23/8 → 3/1 | note:g s:sawtooth lpenv:4 cutoff:500 ftype:2 resonance:1 ]",
|
|
||||||
"[ 3/1 → 25/8 | note:c s:sawtooth lpenv:4 cutoff:500 ftype:0 resonance:1 ]",
|
|
||||||
"[ 25/8 → 13/4 | note:d s:sawtooth lpenv:4 cutoff:500 ftype:0 resonance:1 ]",
|
|
||||||
"[ 13/4 → 27/8 | note:a s:sawtooth lpenv:4 cutoff:500 ftype:0 resonance:1 ]",
|
|
||||||
"[ 27/8 → 7/2 | note:a# s:sawtooth lpenv:4 cutoff:500 ftype:0 resonance:1 ]",
|
|
||||||
"[ 7/2 → 29/8 | note:f s:sawtooth lpenv:4 cutoff:500 ftype:0 resonance:1 ]",
|
|
||||||
"[ 29/8 → 15/4 | note:g s:sawtooth lpenv:4 cutoff:500 ftype:0 resonance:1 ]",
|
|
||||||
"[ 15/4 → 31/8 | note:g s:sawtooth lpenv:4 cutoff:500 ftype:0 resonance:1 ]",
|
|
||||||
"[ 31/8 → 4/1 | note:c s:sawtooth lpenv:4 cutoff:500 ftype:0 resonance:1 ]",
|
|
||||||
]
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`runs examples > example "ftype" example index 1 1`] = `
|
|
||||||
[
|
|
||||||
"[ 0/1 → 1/14 | note:c s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:ladder ]",
|
|
||||||
"[ 1/14 → 1/7 | note:f s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:ladder ]",
|
|
||||||
"[ 1/7 → 3/14 | note:g s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:ladder ]",
|
|
||||||
"[ 3/14 → 2/7 | note:g s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:ladder ]",
|
|
||||||
"[ 2/7 → 5/14 | note:a s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:ladder ]",
|
|
||||||
"[ 5/14 → 3/7 | note:c s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:ladder ]",
|
|
||||||
"[ 3/7 → 1/2 | note:d4 s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:ladder ]",
|
|
||||||
"[ 1/2 → 4/7 | note:c s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:ladder ]",
|
|
||||||
"[ 4/7 → 9/14 | note:f s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:ladder ]",
|
|
||||||
"[ 9/14 → 5/7 | note:g s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:ladder ]",
|
|
||||||
"[ 5/7 → 11/14 | note:g s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:ladder ]",
|
|
||||||
"[ 11/14 → 6/7 | note:a s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:ladder ]",
|
|
||||||
"[ 6/7 → 13/14 | note:c s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:ladder ]",
|
|
||||||
"[ 13/14 → 1/1 | note:d4 s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:ladder ]",
|
|
||||||
"[ 1/1 → 15/14 | note:c s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:12db ]",
|
|
||||||
"[ 15/14 → 8/7 | note:f s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:12db ]",
|
|
||||||
"[ 8/7 → 17/14 | note:g s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:12db ]",
|
|
||||||
"[ 17/14 → 9/7 | note:g s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:12db ]",
|
|
||||||
"[ 9/7 → 19/14 | note:a s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:12db ]",
|
|
||||||
"[ 19/14 → 10/7 | note:c s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:12db ]",
|
|
||||||
"[ 10/7 → 3/2 | note:d4 s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:12db ]",
|
|
||||||
"[ 3/2 → 11/7 | note:c s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:12db ]",
|
|
||||||
"[ 11/7 → 23/14 | note:f s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:12db ]",
|
|
||||||
"[ 23/14 → 12/7 | note:g s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:12db ]",
|
|
||||||
"[ 12/7 → 25/14 | note:g s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:12db ]",
|
|
||||||
"[ 25/14 → 13/7 | note:a s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:12db ]",
|
|
||||||
"[ 13/7 → 27/14 | note:c s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:12db ]",
|
|
||||||
"[ 27/14 → 2/1 | note:d4 s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:12db ]",
|
|
||||||
"[ 2/1 → 29/14 | note:c s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:24db ]",
|
|
||||||
"[ 29/14 → 15/7 | note:f s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:24db ]",
|
|
||||||
"[ 15/7 → 31/14 | note:g s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:24db ]",
|
|
||||||
"[ 31/14 → 16/7 | note:g s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:24db ]",
|
|
||||||
"[ 16/7 → 33/14 | note:a s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:24db ]",
|
|
||||||
"[ 33/14 → 17/7 | note:c s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:24db ]",
|
|
||||||
"[ 17/7 → 5/2 | note:d4 s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:24db ]",
|
|
||||||
"[ 5/2 → 18/7 | note:c s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:24db ]",
|
|
||||||
"[ 18/7 → 37/14 | note:f s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:24db ]",
|
|
||||||
"[ 37/14 → 19/7 | note:g s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:24db ]",
|
|
||||||
"[ 19/7 → 39/14 | note:g s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:24db ]",
|
|
||||||
"[ 39/14 → 20/7 | note:a s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:24db ]",
|
|
||||||
"[ 20/7 → 41/14 | note:c s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:24db ]",
|
|
||||||
"[ 41/14 → 3/1 | note:d4 s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:24db ]",
|
|
||||||
"[ 3/1 → 43/14 | note:c s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:ladder ]",
|
|
||||||
"[ 43/14 → 22/7 | note:f s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:ladder ]",
|
|
||||||
"[ 22/7 → 45/14 | note:g s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:ladder ]",
|
|
||||||
"[ 45/14 → 23/7 | note:g s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:ladder ]",
|
|
||||||
"[ 23/7 → 47/14 | note:a s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:ladder ]",
|
|
||||||
"[ 47/14 → 24/7 | note:c s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:ladder ]",
|
|
||||||
"[ 24/7 → 7/2 | note:d4 s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:ladder ]",
|
|
||||||
"[ 7/2 → 25/7 | note:c s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:ladder ]",
|
|
||||||
"[ 25/7 → 51/14 | note:f s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:ladder ]",
|
|
||||||
"[ 51/14 → 26/7 | note:g s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:ladder ]",
|
|
||||||
"[ 26/7 → 53/14 | note:g s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:ladder ]",
|
|
||||||
"[ 53/14 → 27/7 | note:a s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:ladder ]",
|
|
||||||
"[ 27/7 → 55/14 | note:c s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:ladder ]",
|
|
||||||
"[ 55/14 → 4/1 | note:d4 s:sawtooth cutoff:200 fanchor:0 lpenv:3 resonance:1 ftype:ladder ]",
|
|
||||||
]
|
]
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@@ -4060,64 +3877,64 @@ exports[`runs examples > example "loopEnd" example index 0 1`] = `
|
|||||||
|
|
||||||
exports[`runs examples > example "lpattack" example index 0 1`] = `
|
exports[`runs examples > example "lpattack" example index 0 1`] = `
|
||||||
[
|
[
|
||||||
"[ 0/1 → 1/4 | note:c2 s:sawtooth cutoff:300 lpattack:0.5 lpenv:4 ]",
|
"[ 0/1 → 1/4 | note:c2 s:sawtooth cutoff:500 lpattack:0.5 lpenv:4 ]",
|
||||||
"[ 1/4 → 1/2 | note:e2 s:sawtooth cutoff:300 lpattack:0.5 lpenv:4 ]",
|
"[ 1/4 → 1/2 | note:e2 s:sawtooth cutoff:500 lpattack:0.5 lpenv:4 ]",
|
||||||
"[ 1/2 → 3/4 | note:f2 s:sawtooth cutoff:300 lpattack:0.5 lpenv:4 ]",
|
"[ 1/2 → 3/4 | note:f2 s:sawtooth cutoff:500 lpattack:0.5 lpenv:4 ]",
|
||||||
"[ 3/4 → 1/1 | note:g2 s:sawtooth cutoff:300 lpattack:0.5 lpenv:4 ]",
|
"[ 3/4 → 1/1 | note:g2 s:sawtooth cutoff:500 lpattack:0.5 lpenv:4 ]",
|
||||||
"[ 1/1 → 5/4 | note:c2 s:sawtooth cutoff:300 lpattack:0.5 lpenv:4 ]",
|
"[ 1/1 → 5/4 | note:c2 s:sawtooth cutoff:500 lpattack:0.5 lpenv:4 ]",
|
||||||
"[ 5/4 → 3/2 | note:e2 s:sawtooth cutoff:300 lpattack:0.5 lpenv:4 ]",
|
"[ 5/4 → 3/2 | note:e2 s:sawtooth cutoff:500 lpattack:0.5 lpenv:4 ]",
|
||||||
"[ 3/2 → 7/4 | note:f2 s:sawtooth cutoff:300 lpattack:0.5 lpenv:4 ]",
|
"[ 3/2 → 7/4 | note:f2 s:sawtooth cutoff:500 lpattack:0.5 lpenv:4 ]",
|
||||||
"[ 7/4 → 2/1 | note:g2 s:sawtooth cutoff:300 lpattack:0.5 lpenv:4 ]",
|
"[ 7/4 → 2/1 | note:g2 s:sawtooth cutoff:500 lpattack:0.5 lpenv:4 ]",
|
||||||
"[ 2/1 → 9/4 | note:c2 s:sawtooth cutoff:300 lpattack:0.5 lpenv:4 ]",
|
"[ 2/1 → 9/4 | note:c2 s:sawtooth cutoff:500 lpattack:0.5 lpenv:4 ]",
|
||||||
"[ 9/4 → 5/2 | note:e2 s:sawtooth cutoff:300 lpattack:0.5 lpenv:4 ]",
|
"[ 9/4 → 5/2 | note:e2 s:sawtooth cutoff:500 lpattack:0.5 lpenv:4 ]",
|
||||||
"[ 5/2 → 11/4 | note:f2 s:sawtooth cutoff:300 lpattack:0.5 lpenv:4 ]",
|
"[ 5/2 → 11/4 | note:f2 s:sawtooth cutoff:500 lpattack:0.5 lpenv:4 ]",
|
||||||
"[ 11/4 → 3/1 | note:g2 s:sawtooth cutoff:300 lpattack:0.5 lpenv:4 ]",
|
"[ 11/4 → 3/1 | note:g2 s:sawtooth cutoff:500 lpattack:0.5 lpenv:4 ]",
|
||||||
"[ 3/1 → 13/4 | note:c2 s:sawtooth cutoff:300 lpattack:0.5 lpenv:4 ]",
|
"[ 3/1 → 13/4 | note:c2 s:sawtooth cutoff:500 lpattack:0.5 lpenv:4 ]",
|
||||||
"[ 13/4 → 7/2 | note:e2 s:sawtooth cutoff:300 lpattack:0.5 lpenv:4 ]",
|
"[ 13/4 → 7/2 | note:e2 s:sawtooth cutoff:500 lpattack:0.5 lpenv:4 ]",
|
||||||
"[ 7/2 → 15/4 | note:f2 s:sawtooth cutoff:300 lpattack:0.5 lpenv:4 ]",
|
"[ 7/2 → 15/4 | note:f2 s:sawtooth cutoff:500 lpattack:0.5 lpenv:4 ]",
|
||||||
"[ 15/4 → 4/1 | note:g2 s:sawtooth cutoff:300 lpattack:0.5 lpenv:4 ]",
|
"[ 15/4 → 4/1 | note:g2 s:sawtooth cutoff:500 lpattack:0.5 lpenv:4 ]",
|
||||||
]
|
]
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`runs examples > example "lpdecay" example index 0 1`] = `
|
exports[`runs examples > example "lpdecay" example index 0 1`] = `
|
||||||
[
|
[
|
||||||
"[ 0/1 → 1/4 | note:c2 s:sawtooth cutoff:300 lpdecay:0.5 lpenv:4 ]",
|
"[ 0/1 → 1/4 | note:c2 s:sawtooth cutoff:500 lpdecay:0.5 lpsustain:0.2 lpenv:4 ]",
|
||||||
"[ 1/4 → 1/2 | note:e2 s:sawtooth cutoff:300 lpdecay:0.5 lpenv:4 ]",
|
"[ 1/4 → 1/2 | note:e2 s:sawtooth cutoff:500 lpdecay:0.5 lpsustain:0.2 lpenv:4 ]",
|
||||||
"[ 1/2 → 3/4 | note:f2 s:sawtooth cutoff:300 lpdecay:0.5 lpenv:4 ]",
|
"[ 1/2 → 3/4 | note:f2 s:sawtooth cutoff:500 lpdecay:0.5 lpsustain:0.2 lpenv:4 ]",
|
||||||
"[ 3/4 → 1/1 | note:g2 s:sawtooth cutoff:300 lpdecay:0.5 lpenv:4 ]",
|
"[ 3/4 → 1/1 | note:g2 s:sawtooth cutoff:500 lpdecay:0.5 lpsustain:0.2 lpenv:4 ]",
|
||||||
"[ 1/1 → 5/4 | note:c2 s:sawtooth cutoff:300 lpdecay:0.5 lpenv:4 ]",
|
"[ 1/1 → 5/4 | note:c2 s:sawtooth cutoff:500 lpdecay:0.5 lpsustain:0.2 lpenv:4 ]",
|
||||||
"[ 5/4 → 3/2 | note:e2 s:sawtooth cutoff:300 lpdecay:0.5 lpenv:4 ]",
|
"[ 5/4 → 3/2 | note:e2 s:sawtooth cutoff:500 lpdecay:0.5 lpsustain:0.2 lpenv:4 ]",
|
||||||
"[ 3/2 → 7/4 | note:f2 s:sawtooth cutoff:300 lpdecay:0.5 lpenv:4 ]",
|
"[ 3/2 → 7/4 | note:f2 s:sawtooth cutoff:500 lpdecay:0.5 lpsustain:0.2 lpenv:4 ]",
|
||||||
"[ 7/4 → 2/1 | note:g2 s:sawtooth cutoff:300 lpdecay:0.5 lpenv:4 ]",
|
"[ 7/4 → 2/1 | note:g2 s:sawtooth cutoff:500 lpdecay:0.5 lpsustain:0.2 lpenv:4 ]",
|
||||||
"[ 2/1 → 9/4 | note:c2 s:sawtooth cutoff:300 lpdecay:0.5 lpenv:4 ]",
|
"[ 2/1 → 9/4 | note:c2 s:sawtooth cutoff:500 lpdecay:0.5 lpsustain:0.2 lpenv:4 ]",
|
||||||
"[ 9/4 → 5/2 | note:e2 s:sawtooth cutoff:300 lpdecay:0.5 lpenv:4 ]",
|
"[ 9/4 → 5/2 | note:e2 s:sawtooth cutoff:500 lpdecay:0.5 lpsustain:0.2 lpenv:4 ]",
|
||||||
"[ 5/2 → 11/4 | note:f2 s:sawtooth cutoff:300 lpdecay:0.5 lpenv:4 ]",
|
"[ 5/2 → 11/4 | note:f2 s:sawtooth cutoff:500 lpdecay:0.5 lpsustain:0.2 lpenv:4 ]",
|
||||||
"[ 11/4 → 3/1 | note:g2 s:sawtooth cutoff:300 lpdecay:0.5 lpenv:4 ]",
|
"[ 11/4 → 3/1 | note:g2 s:sawtooth cutoff:500 lpdecay:0.5 lpsustain:0.2 lpenv:4 ]",
|
||||||
"[ 3/1 → 13/4 | note:c2 s:sawtooth cutoff:300 lpdecay:0.5 lpenv:4 ]",
|
"[ 3/1 → 13/4 | note:c2 s:sawtooth cutoff:500 lpdecay:0.5 lpsustain:0.2 lpenv:4 ]",
|
||||||
"[ 13/4 → 7/2 | note:e2 s:sawtooth cutoff:300 lpdecay:0.5 lpenv:4 ]",
|
"[ 13/4 → 7/2 | note:e2 s:sawtooth cutoff:500 lpdecay:0.5 lpsustain:0.2 lpenv:4 ]",
|
||||||
"[ 7/2 → 15/4 | note:f2 s:sawtooth cutoff:300 lpdecay:0.5 lpenv:4 ]",
|
"[ 7/2 → 15/4 | note:f2 s:sawtooth cutoff:500 lpdecay:0.5 lpsustain:0.2 lpenv:4 ]",
|
||||||
"[ 15/4 → 4/1 | note:g2 s:sawtooth cutoff:300 lpdecay:0.5 lpenv:4 ]",
|
"[ 15/4 → 4/1 | note:g2 s:sawtooth cutoff:500 lpdecay:0.5 lpsustain:0.2 lpenv:4 ]",
|
||||||
]
|
]
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`runs examples > example "lpenv" example index 0 1`] = `
|
exports[`runs examples > example "lpenv" example index 0 1`] = `
|
||||||
[
|
[
|
||||||
"[ 0/1 → 1/4 | note:c2 s:sawtooth cutoff:300 lpattack:0.5 lpenv:4 ]",
|
"[ 0/1 → 1/4 | note:c2 s:sawtooth cutoff:500 lpattack:0.5 lpenv:4 ]",
|
||||||
"[ 1/4 → 1/2 | note:e2 s:sawtooth cutoff:300 lpattack:0.5 lpenv:4 ]",
|
"[ 1/4 → 1/2 | note:e2 s:sawtooth cutoff:500 lpattack:0.5 lpenv:4 ]",
|
||||||
"[ 1/2 → 3/4 | note:f2 s:sawtooth cutoff:300 lpattack:0.5 lpenv:4 ]",
|
"[ 1/2 → 3/4 | note:f2 s:sawtooth cutoff:500 lpattack:0.5 lpenv:4 ]",
|
||||||
"[ 3/4 → 1/1 | note:g2 s:sawtooth cutoff:300 lpattack:0.5 lpenv:4 ]",
|
"[ 3/4 → 1/1 | note:g2 s:sawtooth cutoff:500 lpattack:0.5 lpenv:4 ]",
|
||||||
"[ 1/1 → 5/4 | note:c2 s:sawtooth cutoff:300 lpattack:0.5 lpenv:4 ]",
|
"[ 1/1 → 5/4 | note:c2 s:sawtooth cutoff:500 lpattack:0.5 lpenv:4 ]",
|
||||||
"[ 5/4 → 3/2 | note:e2 s:sawtooth cutoff:300 lpattack:0.5 lpenv:4 ]",
|
"[ 5/4 → 3/2 | note:e2 s:sawtooth cutoff:500 lpattack:0.5 lpenv:4 ]",
|
||||||
"[ 3/2 → 7/4 | note:f2 s:sawtooth cutoff:300 lpattack:0.5 lpenv:4 ]",
|
"[ 3/2 → 7/4 | note:f2 s:sawtooth cutoff:500 lpattack:0.5 lpenv:4 ]",
|
||||||
"[ 7/4 → 2/1 | note:g2 s:sawtooth cutoff:300 lpattack:0.5 lpenv:4 ]",
|
"[ 7/4 → 2/1 | note:g2 s:sawtooth cutoff:500 lpattack:0.5 lpenv:4 ]",
|
||||||
"[ 2/1 → 9/4 | note:c2 s:sawtooth cutoff:300 lpattack:0.5 lpenv:4 ]",
|
"[ 2/1 → 9/4 | note:c2 s:sawtooth cutoff:500 lpattack:0.5 lpenv:4 ]",
|
||||||
"[ 9/4 → 5/2 | note:e2 s:sawtooth cutoff:300 lpattack:0.5 lpenv:4 ]",
|
"[ 9/4 → 5/2 | note:e2 s:sawtooth cutoff:500 lpattack:0.5 lpenv:4 ]",
|
||||||
"[ 5/2 → 11/4 | note:f2 s:sawtooth cutoff:300 lpattack:0.5 lpenv:4 ]",
|
"[ 5/2 → 11/4 | note:f2 s:sawtooth cutoff:500 lpattack:0.5 lpenv:4 ]",
|
||||||
"[ 11/4 → 3/1 | note:g2 s:sawtooth cutoff:300 lpattack:0.5 lpenv:4 ]",
|
"[ 11/4 → 3/1 | note:g2 s:sawtooth cutoff:500 lpattack:0.5 lpenv:4 ]",
|
||||||
"[ 3/1 → 13/4 | note:c2 s:sawtooth cutoff:300 lpattack:0.5 lpenv:4 ]",
|
"[ 3/1 → 13/4 | note:c2 s:sawtooth cutoff:500 lpattack:0.5 lpenv:4 ]",
|
||||||
"[ 13/4 → 7/2 | note:e2 s:sawtooth cutoff:300 lpattack:0.5 lpenv:4 ]",
|
"[ 13/4 → 7/2 | note:e2 s:sawtooth cutoff:500 lpattack:0.5 lpenv:4 ]",
|
||||||
"[ 7/2 → 15/4 | note:f2 s:sawtooth cutoff:300 lpattack:0.5 lpenv:4 ]",
|
"[ 7/2 → 15/4 | note:f2 s:sawtooth cutoff:500 lpattack:0.5 lpenv:4 ]",
|
||||||
"[ 15/4 → 4/1 | note:g2 s:sawtooth cutoff:300 lpattack:0.5 lpenv:4 ]",
|
"[ 15/4 → 4/1 | note:g2 s:sawtooth cutoff:500 lpattack:0.5 lpenv:4 ]",
|
||||||
]
|
]
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@@ -4290,43 +4107,43 @@ exports[`runs examples > example "lpq" example index 0 1`] = `
|
|||||||
|
|
||||||
exports[`runs examples > example "lprelease" example index 0 1`] = `
|
exports[`runs examples > example "lprelease" example index 0 1`] = `
|
||||||
[
|
[
|
||||||
"[ 0/1 → 1/4 | note:c2 s:sawtooth clip:0.5 cutoff:300 lpenv:4 lprelease:0.5 release:0.5 ]",
|
"[ 0/1 → 1/4 | note:c2 s:sawtooth clip:0.5 cutoff:500 lpenv:4 lprelease:0.5 release:0.5 ]",
|
||||||
"[ 1/4 → 1/2 | note:e2 s:sawtooth clip:0.5 cutoff:300 lpenv:4 lprelease:0.5 release:0.5 ]",
|
"[ 1/4 → 1/2 | note:e2 s:sawtooth clip:0.5 cutoff:500 lpenv:4 lprelease:0.5 release:0.5 ]",
|
||||||
"[ 1/2 → 3/4 | note:f2 s:sawtooth clip:0.5 cutoff:300 lpenv:4 lprelease:0.5 release:0.5 ]",
|
"[ 1/2 → 3/4 | note:f2 s:sawtooth clip:0.5 cutoff:500 lpenv:4 lprelease:0.5 release:0.5 ]",
|
||||||
"[ 3/4 → 1/1 | note:g2 s:sawtooth clip:0.5 cutoff:300 lpenv:4 lprelease:0.5 release:0.5 ]",
|
"[ 3/4 → 1/1 | note:g2 s:sawtooth clip:0.5 cutoff:500 lpenv:4 lprelease:0.5 release:0.5 ]",
|
||||||
"[ 1/1 → 5/4 | note:c2 s:sawtooth clip:0.5 cutoff:300 lpenv:4 lprelease:0.5 release:0.5 ]",
|
"[ 1/1 → 5/4 | note:c2 s:sawtooth clip:0.5 cutoff:500 lpenv:4 lprelease:0.5 release:0.5 ]",
|
||||||
"[ 5/4 → 3/2 | note:e2 s:sawtooth clip:0.5 cutoff:300 lpenv:4 lprelease:0.5 release:0.5 ]",
|
"[ 5/4 → 3/2 | note:e2 s:sawtooth clip:0.5 cutoff:500 lpenv:4 lprelease:0.5 release:0.5 ]",
|
||||||
"[ 3/2 → 7/4 | note:f2 s:sawtooth clip:0.5 cutoff:300 lpenv:4 lprelease:0.5 release:0.5 ]",
|
"[ 3/2 → 7/4 | note:f2 s:sawtooth clip:0.5 cutoff:500 lpenv:4 lprelease:0.5 release:0.5 ]",
|
||||||
"[ 7/4 → 2/1 | note:g2 s:sawtooth clip:0.5 cutoff:300 lpenv:4 lprelease:0.5 release:0.5 ]",
|
"[ 7/4 → 2/1 | note:g2 s:sawtooth clip:0.5 cutoff:500 lpenv:4 lprelease:0.5 release:0.5 ]",
|
||||||
"[ 2/1 → 9/4 | note:c2 s:sawtooth clip:0.5 cutoff:300 lpenv:4 lprelease:0.5 release:0.5 ]",
|
"[ 2/1 → 9/4 | note:c2 s:sawtooth clip:0.5 cutoff:500 lpenv:4 lprelease:0.5 release:0.5 ]",
|
||||||
"[ 9/4 → 5/2 | note:e2 s:sawtooth clip:0.5 cutoff:300 lpenv:4 lprelease:0.5 release:0.5 ]",
|
"[ 9/4 → 5/2 | note:e2 s:sawtooth clip:0.5 cutoff:500 lpenv:4 lprelease:0.5 release:0.5 ]",
|
||||||
"[ 5/2 → 11/4 | note:f2 s:sawtooth clip:0.5 cutoff:300 lpenv:4 lprelease:0.5 release:0.5 ]",
|
"[ 5/2 → 11/4 | note:f2 s:sawtooth clip:0.5 cutoff:500 lpenv:4 lprelease:0.5 release:0.5 ]",
|
||||||
"[ 11/4 → 3/1 | note:g2 s:sawtooth clip:0.5 cutoff:300 lpenv:4 lprelease:0.5 release:0.5 ]",
|
"[ 11/4 → 3/1 | note:g2 s:sawtooth clip:0.5 cutoff:500 lpenv:4 lprelease:0.5 release:0.5 ]",
|
||||||
"[ 3/1 → 13/4 | note:c2 s:sawtooth clip:0.5 cutoff:300 lpenv:4 lprelease:0.5 release:0.5 ]",
|
"[ 3/1 → 13/4 | note:c2 s:sawtooth clip:0.5 cutoff:500 lpenv:4 lprelease:0.5 release:0.5 ]",
|
||||||
"[ 13/4 → 7/2 | note:e2 s:sawtooth clip:0.5 cutoff:300 lpenv:4 lprelease:0.5 release:0.5 ]",
|
"[ 13/4 → 7/2 | note:e2 s:sawtooth clip:0.5 cutoff:500 lpenv:4 lprelease:0.5 release:0.5 ]",
|
||||||
"[ 7/2 → 15/4 | note:f2 s:sawtooth clip:0.5 cutoff:300 lpenv:4 lprelease:0.5 release:0.5 ]",
|
"[ 7/2 → 15/4 | note:f2 s:sawtooth clip:0.5 cutoff:500 lpenv:4 lprelease:0.5 release:0.5 ]",
|
||||||
"[ 15/4 → 4/1 | note:g2 s:sawtooth clip:0.5 cutoff:300 lpenv:4 lprelease:0.5 release:0.5 ]",
|
"[ 15/4 → 4/1 | note:g2 s:sawtooth clip:0.5 cutoff:500 lpenv:4 lprelease:0.5 release:0.5 ]",
|
||||||
]
|
]
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`runs examples > example "lpsustain" example index 0 1`] = `
|
exports[`runs examples > example "lpsustain" example index 0 1`] = `
|
||||||
[
|
[
|
||||||
"[ 0/1 → 1/4 | note:c2 s:sawtooth cutoff:300 lpdecay:0.5 lpsustain:0 lpenv:4 ]",
|
"[ 0/1 → 1/4 | note:c2 s:sawtooth cutoff:500 lpdecay:0.5 lpsustain:0 lpenv:4 ]",
|
||||||
"[ 1/4 → 1/2 | note:e2 s:sawtooth cutoff:300 lpdecay:0.5 lpsustain:0 lpenv:4 ]",
|
"[ 1/4 → 1/2 | note:e2 s:sawtooth cutoff:500 lpdecay:0.5 lpsustain:0 lpenv:4 ]",
|
||||||
"[ 1/2 → 3/4 | note:f2 s:sawtooth cutoff:300 lpdecay:0.5 lpsustain:0 lpenv:4 ]",
|
"[ 1/2 → 3/4 | note:f2 s:sawtooth cutoff:500 lpdecay:0.5 lpsustain:0 lpenv:4 ]",
|
||||||
"[ 3/4 → 1/1 | note:g2 s:sawtooth cutoff:300 lpdecay:0.5 lpsustain:0 lpenv:4 ]",
|
"[ 3/4 → 1/1 | note:g2 s:sawtooth cutoff:500 lpdecay:0.5 lpsustain:0 lpenv:4 ]",
|
||||||
"[ 1/1 → 5/4 | note:c2 s:sawtooth cutoff:300 lpdecay:0.5 lpsustain:0 lpenv:4 ]",
|
"[ 1/1 → 5/4 | note:c2 s:sawtooth cutoff:500 lpdecay:0.5 lpsustain:0 lpenv:4 ]",
|
||||||
"[ 5/4 → 3/2 | note:e2 s:sawtooth cutoff:300 lpdecay:0.5 lpsustain:0 lpenv:4 ]",
|
"[ 5/4 → 3/2 | note:e2 s:sawtooth cutoff:500 lpdecay:0.5 lpsustain:0 lpenv:4 ]",
|
||||||
"[ 3/2 → 7/4 | note:f2 s:sawtooth cutoff:300 lpdecay:0.5 lpsustain:0 lpenv:4 ]",
|
"[ 3/2 → 7/4 | note:f2 s:sawtooth cutoff:500 lpdecay:0.5 lpsustain:0 lpenv:4 ]",
|
||||||
"[ 7/4 → 2/1 | note:g2 s:sawtooth cutoff:300 lpdecay:0.5 lpsustain:0 lpenv:4 ]",
|
"[ 7/4 → 2/1 | note:g2 s:sawtooth cutoff:500 lpdecay:0.5 lpsustain:0 lpenv:4 ]",
|
||||||
"[ 2/1 → 9/4 | note:c2 s:sawtooth cutoff:300 lpdecay:0.5 lpsustain:0 lpenv:4 ]",
|
"[ 2/1 → 9/4 | note:c2 s:sawtooth cutoff:500 lpdecay:0.5 lpsustain:0 lpenv:4 ]",
|
||||||
"[ 9/4 → 5/2 | note:e2 s:sawtooth cutoff:300 lpdecay:0.5 lpsustain:0 lpenv:4 ]",
|
"[ 9/4 → 5/2 | note:e2 s:sawtooth cutoff:500 lpdecay:0.5 lpsustain:0 lpenv:4 ]",
|
||||||
"[ 5/2 → 11/4 | note:f2 s:sawtooth cutoff:300 lpdecay:0.5 lpsustain:0 lpenv:4 ]",
|
"[ 5/2 → 11/4 | note:f2 s:sawtooth cutoff:500 lpdecay:0.5 lpsustain:0 lpenv:4 ]",
|
||||||
"[ 11/4 → 3/1 | note:g2 s:sawtooth cutoff:300 lpdecay:0.5 lpsustain:0 lpenv:4 ]",
|
"[ 11/4 → 3/1 | note:g2 s:sawtooth cutoff:500 lpdecay:0.5 lpsustain:0 lpenv:4 ]",
|
||||||
"[ 3/1 → 13/4 | note:c2 s:sawtooth cutoff:300 lpdecay:0.5 lpsustain:0 lpenv:4 ]",
|
"[ 3/1 → 13/4 | note:c2 s:sawtooth cutoff:500 lpdecay:0.5 lpsustain:0 lpenv:4 ]",
|
||||||
"[ 13/4 → 7/2 | note:e2 s:sawtooth cutoff:300 lpdecay:0.5 lpsustain:0 lpenv:4 ]",
|
"[ 13/4 → 7/2 | note:e2 s:sawtooth cutoff:500 lpdecay:0.5 lpsustain:0 lpenv:4 ]",
|
||||||
"[ 7/2 → 15/4 | note:f2 s:sawtooth cutoff:300 lpdecay:0.5 lpsustain:0 lpenv:4 ]",
|
"[ 7/2 → 15/4 | note:f2 s:sawtooth cutoff:500 lpdecay:0.5 lpsustain:0 lpenv:4 ]",
|
||||||
"[ 15/4 → 4/1 | note:g2 s:sawtooth cutoff:300 lpdecay:0.5 lpsustain:0 lpenv:4 ]",
|
"[ 15/4 → 4/1 | note:g2 s:sawtooth cutoff:500 lpdecay:0.5 lpsustain:0 lpenv:4 ]",
|
||||||
]
|
]
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@@ -4387,48 +4204,6 @@ exports[`runs examples > example "mask" example index 0 1`] = `
|
|||||||
]
|
]
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`runs examples > example "mousex" example index 0 1`] = `
|
|
||||||
[
|
|
||||||
"[ 0/1 → 1/4 | note:C3 ]",
|
|
||||||
"[ 1/4 → 1/2 | note:C3 ]",
|
|
||||||
"[ 1/2 → 3/4 | note:C3 ]",
|
|
||||||
"[ 3/4 → 1/1 | note:C3 ]",
|
|
||||||
"[ 1/1 → 5/4 | note:C3 ]",
|
|
||||||
"[ 5/4 → 3/2 | note:C3 ]",
|
|
||||||
"[ 3/2 → 7/4 | note:C3 ]",
|
|
||||||
"[ 7/4 → 2/1 | note:C3 ]",
|
|
||||||
"[ 2/1 → 9/4 | note:C3 ]",
|
|
||||||
"[ 9/4 → 5/2 | note:C3 ]",
|
|
||||||
"[ 5/2 → 11/4 | note:C3 ]",
|
|
||||||
"[ 11/4 → 3/1 | note:C3 ]",
|
|
||||||
"[ 3/1 → 13/4 | note:C3 ]",
|
|
||||||
"[ 13/4 → 7/2 | note:C3 ]",
|
|
||||||
"[ 7/2 → 15/4 | note:C3 ]",
|
|
||||||
"[ 15/4 → 4/1 | note:C3 ]",
|
|
||||||
]
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`runs examples > example "mousey" example index 0 1`] = `
|
|
||||||
[
|
|
||||||
"[ 0/1 → 1/4 | note:C3 ]",
|
|
||||||
"[ 1/4 → 1/2 | note:C3 ]",
|
|
||||||
"[ 1/2 → 3/4 | note:C3 ]",
|
|
||||||
"[ 3/4 → 1/1 | note:C3 ]",
|
|
||||||
"[ 1/1 → 5/4 | note:C3 ]",
|
|
||||||
"[ 5/4 → 3/2 | note:C3 ]",
|
|
||||||
"[ 3/2 → 7/4 | note:C3 ]",
|
|
||||||
"[ 7/4 → 2/1 | note:C3 ]",
|
|
||||||
"[ 2/1 → 9/4 | note:C3 ]",
|
|
||||||
"[ 9/4 → 5/2 | note:C3 ]",
|
|
||||||
"[ 5/2 → 11/4 | note:C3 ]",
|
|
||||||
"[ 11/4 → 3/1 | note:C3 ]",
|
|
||||||
"[ 3/1 → 13/4 | note:C3 ]",
|
|
||||||
"[ 13/4 → 7/2 | note:C3 ]",
|
|
||||||
"[ 7/2 → 15/4 | note:C3 ]",
|
|
||||||
"[ 15/4 → 4/1 | note:C3 ]",
|
|
||||||
]
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`runs examples > example "mul" example index 0 1`] = `
|
exports[`runs examples > example "mul" example index 0 1`] = `
|
||||||
[
|
[
|
||||||
"[ 0/1 → 1/4 | freq:150 ]",
|
"[ 0/1 → 1/4 | freq:150 ]",
|
||||||
@@ -5260,6 +5035,72 @@ exports[`runs examples > example "ply" example index 0 1`] = `
|
|||||||
]
|
]
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
exports[`runs examples > example "polymeter" example index 0 1`] = `
|
||||||
|
[
|
||||||
|
"[ 0/1 → 1/3 | c ]",
|
||||||
|
"[ 0/1 → 1/3 | c2 ]",
|
||||||
|
"[ 1/3 → 2/3 | eb ]",
|
||||||
|
"[ 1/3 → 2/3 | g2 ]",
|
||||||
|
"[ 2/3 → 1/1 | g ]",
|
||||||
|
"[ 2/3 → 1/1 | c2 ]",
|
||||||
|
"[ 1/1 → 4/3 | c ]",
|
||||||
|
"[ 1/1 → 4/3 | g2 ]",
|
||||||
|
"[ 4/3 → 5/3 | eb ]",
|
||||||
|
"[ 4/3 → 5/3 | c2 ]",
|
||||||
|
"[ 5/3 → 2/1 | g ]",
|
||||||
|
"[ 5/3 → 2/1 | g2 ]",
|
||||||
|
"[ 2/1 → 7/3 | c ]",
|
||||||
|
"[ 2/1 → 7/3 | c2 ]",
|
||||||
|
"[ 7/3 → 8/3 | eb ]",
|
||||||
|
"[ 7/3 → 8/3 | g2 ]",
|
||||||
|
"[ 8/3 → 3/1 | g ]",
|
||||||
|
"[ 8/3 → 3/1 | c2 ]",
|
||||||
|
"[ 3/1 → 10/3 | c ]",
|
||||||
|
"[ 3/1 → 10/3 | g2 ]",
|
||||||
|
"[ 10/3 → 11/3 | eb ]",
|
||||||
|
"[ 10/3 → 11/3 | c2 ]",
|
||||||
|
"[ 11/3 → 4/1 | g ]",
|
||||||
|
"[ 11/3 → 4/1 | g2 ]",
|
||||||
|
]
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`runs examples > example "polymeterSteps" example index 0 1`] = `
|
||||||
|
[
|
||||||
|
"[ 0/1 → 1/4 | c ]",
|
||||||
|
"[ 0/1 → 1/4 | e ]",
|
||||||
|
"[ 1/4 → 1/2 | d ]",
|
||||||
|
"[ 1/4 → 1/2 | f ]",
|
||||||
|
"[ 1/2 → 3/4 | c ]",
|
||||||
|
"[ 1/2 → 3/4 | g ]",
|
||||||
|
"[ 3/4 → 1/1 | d ]",
|
||||||
|
"[ 3/4 → 1/1 | e ]",
|
||||||
|
"[ 1/1 → 5/4 | c ]",
|
||||||
|
"[ 1/1 → 5/4 | f ]",
|
||||||
|
"[ 5/4 → 3/2 | d ]",
|
||||||
|
"[ 5/4 → 3/2 | g ]",
|
||||||
|
"[ 3/2 → 7/4 | c ]",
|
||||||
|
"[ 3/2 → 7/4 | e ]",
|
||||||
|
"[ 7/4 → 2/1 | d ]",
|
||||||
|
"[ 7/4 → 2/1 | f ]",
|
||||||
|
"[ 2/1 → 9/4 | c ]",
|
||||||
|
"[ 2/1 → 9/4 | g ]",
|
||||||
|
"[ 9/4 → 5/2 | d ]",
|
||||||
|
"[ 9/4 → 5/2 | e ]",
|
||||||
|
"[ 5/2 → 11/4 | c ]",
|
||||||
|
"[ 5/2 → 11/4 | f ]",
|
||||||
|
"[ 11/4 → 3/1 | d ]",
|
||||||
|
"[ 11/4 → 3/1 | g ]",
|
||||||
|
"[ 3/1 → 13/4 | c ]",
|
||||||
|
"[ 3/1 → 13/4 | e ]",
|
||||||
|
"[ 13/4 → 7/2 | d ]",
|
||||||
|
"[ 13/4 → 7/2 | f ]",
|
||||||
|
"[ 7/2 → 15/4 | c ]",
|
||||||
|
"[ 7/2 → 15/4 | g ]",
|
||||||
|
"[ 15/4 → 4/1 | d ]",
|
||||||
|
"[ 15/4 → 4/1 | e ]",
|
||||||
|
]
|
||||||
|
`;
|
||||||
|
|
||||||
exports[`runs examples > example "postgain" example index 0 1`] = `
|
exports[`runs examples > example "postgain" example index 0 1`] = `
|
||||||
[
|
[
|
||||||
"[ 0/1 → 1/8 | s:hh compressor:-20 compressorRatio:20 compressorKnee:10 compressorAttack:0.002 compressorRelease:0.02 postgain:1.5 ]",
|
"[ 0/1 → 1/8 | s:hh compressor:-20 compressorRatio:20 compressorKnee:10 compressorAttack:0.002 compressorRelease:0.02 postgain:1.5 ]",
|
||||||
@@ -7375,6 +7216,31 @@ exports[`runs examples > example "stack" example index 0 2`] = `
|
|||||||
]
|
]
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
exports[`runs examples > example "stepcat" example index 0 1`] = `
|
||||||
|
[
|
||||||
|
"[ 0/1 → 1/5 | s:bd ]",
|
||||||
|
"[ 1/5 → 2/5 | s:cp ]",
|
||||||
|
"[ 2/5 → 3/5 | s:bd ]",
|
||||||
|
"[ 3/5 → 4/5 | s:mt ]",
|
||||||
|
"[ 4/5 → 1/1 | s:bd ]",
|
||||||
|
"[ 1/1 → 6/5 | s:bd ]",
|
||||||
|
"[ 6/5 → 7/5 | s:cp ]",
|
||||||
|
"[ 7/5 → 8/5 | s:bd ]",
|
||||||
|
"[ 8/5 → 9/5 | s:mt ]",
|
||||||
|
"[ 9/5 → 2/1 | s:bd ]",
|
||||||
|
"[ 2/1 → 11/5 | s:bd ]",
|
||||||
|
"[ 11/5 → 12/5 | s:cp ]",
|
||||||
|
"[ 12/5 → 13/5 | s:bd ]",
|
||||||
|
"[ 13/5 → 14/5 | s:mt ]",
|
||||||
|
"[ 14/5 → 3/1 | s:bd ]",
|
||||||
|
"[ 3/1 → 16/5 | s:bd ]",
|
||||||
|
"[ 16/5 → 17/5 | s:cp ]",
|
||||||
|
"[ 17/5 → 18/5 | s:bd ]",
|
||||||
|
"[ 18/5 → 19/5 | s:mt ]",
|
||||||
|
"[ 19/5 → 4/1 | s:bd ]",
|
||||||
|
]
|
||||||
|
`;
|
||||||
|
|
||||||
exports[`runs examples > example "steps" example index 0 1`] = `
|
exports[`runs examples > example "steps" example index 0 1`] = `
|
||||||
[
|
[
|
||||||
"[ 0/1 → 1/4 | s:bd ]",
|
"[ 0/1 → 1/4 | s:bd ]",
|
||||||
@@ -7688,6 +7554,65 @@ exports[`runs examples > example "swingBy" example index 0 1`] = `
|
|||||||
]
|
]
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
exports[`runs examples > example "timecat" example index 0 1`] = `
|
||||||
|
[
|
||||||
|
"[ 0/1 → 3/4 | note:e3 ]",
|
||||||
|
"[ 3/4 → 1/1 | note:g3 ]",
|
||||||
|
"[ 1/1 → 7/4 | note:e3 ]",
|
||||||
|
"[ 7/4 → 2/1 | note:g3 ]",
|
||||||
|
"[ 2/1 → 11/4 | note:e3 ]",
|
||||||
|
"[ 11/4 → 3/1 | note:g3 ]",
|
||||||
|
"[ 3/1 → 15/4 | note:e3 ]",
|
||||||
|
"[ 15/4 → 4/1 | note:g3 ]",
|
||||||
|
]
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`runs examples > example "timecat" example index 1 1`] = `
|
||||||
|
[
|
||||||
|
"[ 0/1 → 1/5 | s:bd ]",
|
||||||
|
"[ 1/5 → 2/5 | s:sd ]",
|
||||||
|
"[ 2/5 → 3/5 | s:cp ]",
|
||||||
|
"[ 3/5 → 4/5 | s:hh ]",
|
||||||
|
"[ 4/5 → 1/1 | s:hh ]",
|
||||||
|
"[ 1/1 → 6/5 | s:bd ]",
|
||||||
|
"[ 6/5 → 7/5 | s:sd ]",
|
||||||
|
"[ 7/5 → 8/5 | s:cp ]",
|
||||||
|
"[ 8/5 → 9/5 | s:hh ]",
|
||||||
|
"[ 9/5 → 2/1 | s:hh ]",
|
||||||
|
"[ 2/1 → 11/5 | s:bd ]",
|
||||||
|
"[ 11/5 → 12/5 | s:sd ]",
|
||||||
|
"[ 12/5 → 13/5 | s:cp ]",
|
||||||
|
"[ 13/5 → 14/5 | s:hh ]",
|
||||||
|
"[ 14/5 → 3/1 | s:hh ]",
|
||||||
|
"[ 3/1 → 16/5 | s:bd ]",
|
||||||
|
"[ 16/5 → 17/5 | s:sd ]",
|
||||||
|
"[ 17/5 → 18/5 | s:cp ]",
|
||||||
|
"[ 18/5 → 19/5 | s:hh ]",
|
||||||
|
"[ 19/5 → 4/1 | s:hh ]",
|
||||||
|
]
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`runs examples > example "toTactus" example index 0 1`] = `
|
||||||
|
[
|
||||||
|
"[ 0/1 → 1/4 | s:bd ]",
|
||||||
|
"[ 1/4 → 1/2 | s:sd ]",
|
||||||
|
"[ 1/2 → 3/4 | s:cp ]",
|
||||||
|
"[ 3/4 → 1/1 | s:bd ]",
|
||||||
|
"[ 1/1 → 5/4 | s:sd ]",
|
||||||
|
"[ 5/4 → 3/2 | s:cp ]",
|
||||||
|
"[ 3/2 → 7/4 | s:bd ]",
|
||||||
|
"[ 7/4 → 2/1 | s:sd ]",
|
||||||
|
"[ 2/1 → 9/4 | s:cp ]",
|
||||||
|
"[ 9/4 → 5/2 | s:bd ]",
|
||||||
|
"[ 5/2 → 11/4 | s:sd ]",
|
||||||
|
"[ 11/4 → 3/1 | s:cp ]",
|
||||||
|
"[ 3/1 → 13/4 | s:bd ]",
|
||||||
|
"[ 13/4 → 7/2 | s:sd ]",
|
||||||
|
"[ 7/2 → 15/4 | s:cp ]",
|
||||||
|
"[ 15/4 → 4/1 | s:bd ]",
|
||||||
|
]
|
||||||
|
`;
|
||||||
|
|
||||||
exports[`runs examples > example "transpose" example index 0 1`] = `
|
exports[`runs examples > example "transpose" example index 0 1`] = `
|
||||||
[
|
[
|
||||||
"[ 0/1 → 1/4 | note:C2 ]",
|
"[ 0/1 → 1/4 | note:C2 ]",
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -649,7 +649,7 @@
|
|||||||
"/packages/webaudio/webaudio.mjs": [
|
"/packages/webaudio/webaudio.mjs": [
|
||||||
"webaudioOutputTrigger",
|
"webaudioOutputTrigger",
|
||||||
"webaudioOutput",
|
"webaudioOutput",
|
||||||
"webaudioRepl"
|
"webaudioScheduler"
|
||||||
],
|
],
|
||||||
"/packages/webaudio/scope.mjs": [
|
"/packages/webaudio/scope.mjs": [
|
||||||
"drawTimeScope",
|
"drawTimeScope",
|
||||||
|
|||||||
@@ -17,6 +17,3 @@ pnpm-debug.log*
|
|||||||
|
|
||||||
# macOS-specific files
|
# macOS-specific files
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
public/tree-sitter.wasm
|
|
||||||
public/tree-sitter-haskell.wasm
|
|
||||||
@@ -9,8 +9,7 @@
|
|||||||
"check": "astro check && tsc",
|
"check": "astro check && tsc",
|
||||||
"build": "astro build",
|
"build": "astro build",
|
||||||
"preview": "astro preview --port 3009 --host 0.0.0.0",
|
"preview": "astro preview --port 3009 --host 0.0.0.0",
|
||||||
"astro": "astro",
|
"astro": "astro"
|
||||||
"postinstall": "cp node_modules/hs2js/dist/tree-sitter.wasm public && cp node_modules/hs2js/dist/tree-sitter-haskell.wasm public"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@algolia/client-search": "^4.22.0",
|
"@algolia/client-search": "^4.22.0",
|
||||||
@@ -40,7 +39,6 @@
|
|||||||
"@strudel/transpiler": "workspace:*",
|
"@strudel/transpiler": "workspace:*",
|
||||||
"@strudel/webaudio": "workspace:*",
|
"@strudel/webaudio": "workspace:*",
|
||||||
"@strudel/xen": "workspace:*",
|
"@strudel/xen": "workspace:*",
|
||||||
"@strudel/tidal": "workspace:*",
|
|
||||||
"@supabase/supabase-js": "^2.39.1",
|
"@supabase/supabase-js": "^2.39.1",
|
||||||
"@tailwindcss/forms": "^0.5.7",
|
"@tailwindcss/forms": "^0.5.7",
|
||||||
"@tailwindcss/typography": "^0.5.10",
|
"@tailwindcss/typography": "^0.5.10",
|
||||||
@@ -51,7 +49,6 @@
|
|||||||
"astro": "^4.0.8",
|
"astro": "^4.0.8",
|
||||||
"claviature": "^0.1.0",
|
"claviature": "^0.1.0",
|
||||||
"date-fns": "^3.2.0",
|
"date-fns": "^3.2.0",
|
||||||
"hs2js": "0.0.8",
|
|
||||||
"nanoid": "^5.0.4",
|
"nanoid": "^5.0.4",
|
||||||
"nanostores": "^0.9.5",
|
"nanostores": "^0.9.5",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
|
|||||||
@@ -6,15 +6,15 @@ import { transpiler } from '@strudel/transpiler';
|
|||||||
import { getAudioContext, webaudioOutput, initAudioOnFirstClick } from '@strudel/webaudio';
|
import { getAudioContext, webaudioOutput, initAudioOnFirstClick } from '@strudel/webaudio';
|
||||||
import { StrudelMirror } from '@strudel/codemirror';
|
import { StrudelMirror } from '@strudel/codemirror';
|
||||||
import { prebake } from '../repl/prebake.mjs';
|
import { prebake } from '../repl/prebake.mjs';
|
||||||
import { loadModules, setVersionDefaultsFrom } from '../repl/util.mjs';
|
import { loadModules } from '../repl/util.mjs';
|
||||||
import Claviature from '@components/Claviature';
|
import Claviature from '@components/Claviature';
|
||||||
import useClient from '@src/useClient.mjs';
|
import useClient from '@src/useClient.mjs';
|
||||||
|
|
||||||
let prebaked, modulesLoading, audioReady;
|
let prebaked, modulesLoading, audioLoading;
|
||||||
if (typeof window !== 'undefined') {
|
if (typeof window !== 'undefined') {
|
||||||
prebaked = prebake();
|
prebaked = prebake();
|
||||||
modulesLoading = loadModules();
|
modulesLoading = loadModules();
|
||||||
audioReady = initAudioOnFirstClick();
|
audioLoading = initAudioOnFirstClick();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function MiniRepl({
|
export function MiniRepl({
|
||||||
@@ -69,12 +69,10 @@ export function MiniRepl({
|
|||||||
}
|
}
|
||||||
return pat;
|
return pat;
|
||||||
},
|
},
|
||||||
prebake: async () => Promise.all([modulesLoading, prebaked]),
|
prebake: async () => Promise.all([modulesLoading, prebaked, audioLoading]),
|
||||||
onUpdateState: (state) => {
|
onUpdateState: (state) => {
|
||||||
setReplState({ ...state });
|
setReplState({ ...state });
|
||||||
},
|
},
|
||||||
beforeEval: () => audioReady, // not doing this in prebake to make sure viz is drawn
|
|
||||||
afterEval: ({ code }) => setVersionDefaultsFrom(code),
|
|
||||||
});
|
});
|
||||||
// init settings
|
// init settings
|
||||||
editor.setCode(code);
|
editor.setCode(code);
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
export const examples = [
|
export const examples = [
|
||||||
`// "coastline" @by eddyflux
|
`// "coastline" @by eddyflux
|
||||||
// @version 1.0
|
|
||||||
samples('github:eddyflux/crate')
|
samples('github:eddyflux/crate')
|
||||||
setcps(.75)
|
setcps(.75)
|
||||||
let chords = chord("<Bbm9 Fm9>/4").dict('ireal')
|
let chords = chord("<Bbm9 Fm9>/4").dict('ireal')
|
||||||
@@ -19,7 +18,7 @@ stack(
|
|||||||
n("<0!3 1*2>").set(chords).mode("root:g2")
|
n("<0!3 1*2>").set(chords).mode("root:g2")
|
||||||
.voicing().s("gm_acoustic_bass"),
|
.voicing().s("gm_acoustic_bass"),
|
||||||
chords.n("[0 <4 3 <2 5>>*2](<3 5>,8)")
|
chords.n("[0 <4 3 <2 5>>*2](<3 5>,8)")
|
||||||
.anchor("D5").voicing()
|
.set(x).anchor("D5").voicing()
|
||||||
.segment(4).clip(rand.range(.4,.8))
|
.segment(4).clip(rand.range(.4,.8))
|
||||||
.room(.75).shape(.3).delay(.25)
|
.room(.75).shape(.3).delay(.25)
|
||||||
.fm(sine.range(3,8).slow(8))
|
.fm(sine.range(3,8).slow(8))
|
||||||
@@ -30,7 +29,6 @@ stack(
|
|||||||
)
|
)
|
||||||
.late("[0 .01]*4").late("[0 .01]*2").size(4)`,
|
.late("[0 .01]*4").late("[0 .01]*2").size(4)`,
|
||||||
`// "broken cut 1" @by froos
|
`// "broken cut 1" @by froos
|
||||||
// @version 1.0
|
|
||||||
|
|
||||||
samples('github:tidalcycles/dirt-samples')
|
samples('github:tidalcycles/dirt-samples')
|
||||||
samples({
|
samples({
|
||||||
@@ -58,7 +56,6 @@ note("[c2 ~](3,8)*2,eb,g,bb,d").s("sawtooth")
|
|||||||
s("<whirl attack>?").delay(".8:.1:.8").room(2).slow(8).cut(2),
|
s("<whirl attack>?").delay(".8:.1:.8").room(2).slow(8).cut(2),
|
||||||
).reset("<x@30 [x*[8 [8 [16 32]]]]@2>".late(2))`,
|
).reset("<x@30 [x*[8 [8 [16 32]]]]@2>".late(2))`,
|
||||||
`// "acidic tooth" @by eddyflux
|
`// "acidic tooth" @by eddyflux
|
||||||
// @version 1.0
|
|
||||||
setcps(1)
|
setcps(1)
|
||||||
stack(
|
stack(
|
||||||
note("[<g1 f1>/8](<3 5>,8)")
|
note("[<g1 f1>/8](<3 5>,8)")
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ Probier `ply` mit einem pattern zu automatisieren, z.b. `"<1 2 1 3>"`
|
|||||||
.off(1/8, x=>x.add(4))
|
.off(1/8, x=>x.add(4))
|
||||||
//.off(1/4, x=>x.add(7))
|
//.off(1/4, x=>x.add(7))
|
||||||
).scale("<C5:minor Db5:mixolydian>/4")
|
).scale("<C5:minor Db5:mixolydian>/4")
|
||||||
.s("triangle").room(.5).dec(.1).delay(.5)`}
|
.s("triangle").room(.5).ds(".1:0").delay(.5)`}
|
||||||
punchcard
|
punchcard
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ Each filter can receive an additional filter envelope controlling the cutoff val
|
|||||||
client:idle
|
client:idle
|
||||||
tune={`note("[c eb g <f bb>](3,8,<0 1>)".sub(12))
|
tune={`note("[c eb g <f bb>](3,8,<0 1>)".sub(12))
|
||||||
.s("<sawtooth>/64")
|
.s("<sawtooth>/64")
|
||||||
.lpf(sine.range(300,2000).slow(16))
|
.lpf(sine.range(500,3000).slow(16))
|
||||||
.lpa(0.005)
|
.lpa(0.005)
|
||||||
.lpd(perlin.range(.02,.2))
|
.lpd(perlin.range(.02,.2))
|
||||||
.lps(perlin.range(0,.5).slow(3))
|
.lps(perlin.range(0,.5).slow(3))
|
||||||
@@ -106,7 +106,7 @@ Each filter can receive an additional filter envelope controlling the cutoff val
|
|||||||
.juxBy(.5,rev)
|
.juxBy(.5,rev)
|
||||||
.sometimes(add(note(12)))
|
.sometimes(add(note(12)))
|
||||||
.stack(s("bd*2").bank('RolandTR909'))
|
.stack(s("bd*2").bank('RolandTR909'))
|
||||||
.gain(.5).fast(2)`}
|
.gain(.5)`}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
There is one filter envelope for each filter type and thus one set of envelope filter parameters preceded either by `lp`, `hp` or `bp`:
|
There is one filter envelope for each filter type and thus one set of envelope filter parameters preceded either by `lp`, `hp` or `bp`:
|
||||||
|
|||||||
@@ -55,12 +55,4 @@ There is also `saw2`, `sine2`, `cosine2`, `tri2`, `square2` and `rand2` which ha
|
|||||||
|
|
||||||
<JsDoc client:idle name="brandBy" h={0} />
|
<JsDoc client:idle name="brandBy" h={0} />
|
||||||
|
|
||||||
## mouseX
|
|
||||||
|
|
||||||
<JsDoc client:idle name="mousex" h={0} />
|
|
||||||
|
|
||||||
## mouseY
|
|
||||||
|
|
||||||
<JsDoc client:idle name="mousey" h={0} />
|
|
||||||
|
|
||||||
Next up: [Random Modifiers](/learn/random-modifiers)
|
Next up: [Random Modifiers](/learn/random-modifiers)
|
||||||
|
|||||||
@@ -308,7 +308,7 @@ Running through different wavetables can also give interesting variations:
|
|||||||
<MiniRepl
|
<MiniRepl
|
||||||
client:visible
|
client:visible
|
||||||
tune={`samples('github:bubobubobubobubo/dough-waveforms')
|
tune={`samples('github:bubobubobubobubo/dough-waveforms')
|
||||||
note("c2*8").s("wt_dbass").n(run(8)).fast(2)`}
|
note("c2*8").s("wt_dbass").n(run(8))`}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
...adding a filter envelope + reverb:
|
...adding a filter envelope + reverb:
|
||||||
@@ -317,6 +317,6 @@ note("c2*8").s("wt_dbass").n(run(8)).fast(2)`}
|
|||||||
client:visible
|
client:visible
|
||||||
tune={`samples('github:bubobubobubobubo/dough-waveforms')
|
tune={`samples('github:bubobubobubobubo/dough-waveforms')
|
||||||
note("c2*8").s("wt_dbass").n(run(8))
|
note("c2*8").s("wt_dbass").n(run(8))
|
||||||
.lpf(perlin.range(100,1000).slow(8))
|
.lpf(perlin.range(200,2000).slow(8))
|
||||||
.lpenv(-3).lpa(.1).room(.5).fast(2)`}
|
.lpenv(-3).lpa(.1).room(.5)`}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -205,7 +205,7 @@ note("[~ [<[d3,a3,f4]!2 [d3,bb3,g4]!2> ~]]*2")
|
|||||||
sound("<bd rim>").bank("RolandTR707").delay(.5),
|
sound("<bd rim>").bank("RolandTR707").delay(.5),
|
||||||
n("<4 [3@3 4] [<2 0> ~@16] ~>")
|
n("<4 [3@3 4] [<2 0> ~@16] ~>")
|
||||||
.scale("D4:minor").sound("gm_accordion:2")
|
.scale("D4:minor").sound("gm_accordion:2")
|
||||||
.room(2).gain(.5)
|
room(2).gain(.5)
|
||||||
)`}
|
)`}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -262,7 +262,7 @@ By the way, inside Mini-Notation, `fast` is `*` and `slow` is `/`.
|
|||||||
|
|
||||||
<MiniRepl client:visible tune={`sound("[bd*4,~ rim ~ cp]*<1 [2 4]>")`} />
|
<MiniRepl client:visible tune={`sound("[bd*4,~ rim ~ cp]*<1 [2 4]>")`} />
|
||||||
|
|
||||||
## modulation with signals
|
## automation with signals
|
||||||
|
|
||||||
Instead of changing values stepwise, we can also control them with signals:
|
Instead of changing values stepwise, we can also control them with signals:
|
||||||
|
|
||||||
@@ -290,7 +290,7 @@ What happens if you flip the range values?
|
|||||||
|
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
We can change the modulation speed with slow / fast:
|
We can change the automation speed with slow / fast:
|
||||||
|
|
||||||
<MiniRepl
|
<MiniRepl
|
||||||
client:visible
|
client:visible
|
||||||
@@ -301,7 +301,7 @@ We can change the modulation speed with slow / fast:
|
|||||||
|
|
||||||
<Box>
|
<Box>
|
||||||
|
|
||||||
The whole modulation will now take 8 cycles to repeat.
|
The whole automation will now take 8 cycles to repeat.
|
||||||
|
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
|
|||||||
@@ -145,17 +145,13 @@ Try patterning the `ply` function, for example using `"<1 2 1 3>"`
|
|||||||
.off(1/16, x=>x.add(4))
|
.off(1/16, x=>x.add(4))
|
||||||
//.off(1/8, x=>x.add(7))
|
//.off(1/8, x=>x.add(7))
|
||||||
).scale("<C5:minor Db5:mixolydian>/2")
|
).scale("<C5:minor Db5:mixolydian>/2")
|
||||||
.s("triangle").room(.5).dec(.1)`}
|
.s("triangle").room(.5).ds(".1:0").delay(.5)`}
|
||||||
punchcard
|
punchcard
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Box>
|
<Box>
|
||||||
|
|
||||||
In the notation `.off(1/16, x=>x.add(4))`, says:
|
In the notation `x=>x.`, the `x` is the shifted pattern, which where modifying.
|
||||||
|
|
||||||
- take the original pattern named as `x`
|
|
||||||
- modify `x` with `.add(4)`, and
|
|
||||||
- play it offset to the original pattern by `1/16` of a cycle.
|
|
||||||
|
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
|
|||||||
@@ -10,13 +10,13 @@ import cx from '@src/cx.mjs';
|
|||||||
import { transpiler } from '@strudel/transpiler';
|
import { transpiler } from '@strudel/transpiler';
|
||||||
import {
|
import {
|
||||||
getAudioContext,
|
getAudioContext,
|
||||||
|
initAudioOnFirstClick,
|
||||||
webaudioOutput,
|
webaudioOutput,
|
||||||
resetGlobalEffects,
|
resetGlobalEffects,
|
||||||
resetLoadedSounds,
|
resetLoadedSounds,
|
||||||
initAudioOnFirstClick,
|
|
||||||
} from '@strudel/webaudio';
|
} from '@strudel/webaudio';
|
||||||
import { defaultAudioDeviceName } from '../settings.mjs';
|
import { defaultAudioDeviceName } from '../settings.mjs';
|
||||||
import { getAudioDevices, setAudioDevice, setVersionDefaultsFrom } from './util.mjs';
|
import { getAudioDevices, setAudioDevice } from './util.mjs';
|
||||||
import { StrudelMirror, defaultSettings } from '@strudel/codemirror';
|
import { StrudelMirror, defaultSettings } from '@strudel/codemirror';
|
||||||
import { clearHydra } from '@strudel/hydra';
|
import { clearHydra } from '@strudel/hydra';
|
||||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||||
@@ -38,14 +38,12 @@ import { getRandomTune, initCode, loadModules, shareCode, ReplContext } from './
|
|||||||
import PlayCircleIcon from '@heroicons/react/20/solid/PlayCircleIcon';
|
import PlayCircleIcon from '@heroicons/react/20/solid/PlayCircleIcon';
|
||||||
import './Repl.css';
|
import './Repl.css';
|
||||||
import { setInterval, clearInterval } from 'worker-timers';
|
import { setInterval, clearInterval } from 'worker-timers';
|
||||||
import { getMetadata } from '../metadata_parser';
|
|
||||||
|
|
||||||
const { latestCode } = settingsMap.get();
|
const { latestCode } = settingsMap.get();
|
||||||
|
|
||||||
let modulesLoading, presets, drawContext, clearCanvas, isIframe, audioReady;
|
let modulesLoading, presets, drawContext, clearCanvas, isIframe;
|
||||||
|
|
||||||
if (typeof window !== 'undefined') {
|
if (typeof window !== 'undefined') {
|
||||||
audioReady = initAudioOnFirstClick();
|
initAudioOnFirstClick();
|
||||||
modulesLoading = loadModules();
|
modulesLoading = loadModules();
|
||||||
presets = prebake();
|
presets = prebake();
|
||||||
drawContext = getDrawContext();
|
drawContext = getDrawContext();
|
||||||
@@ -89,14 +87,11 @@ export function Repl({ embedded = false }) {
|
|||||||
clearHydra();
|
clearHydra();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeEval: () => audioReady,
|
|
||||||
afterEval: (all) => {
|
afterEval: (all) => {
|
||||||
const { code } = all;
|
const { code } = all;
|
||||||
setLatestCode(code);
|
setLatestCode(code);
|
||||||
window.location.hash = '#' + code2hash(code);
|
window.location.hash = '#' + code2hash(code);
|
||||||
setDocumentTitle(code);
|
|
||||||
const viewingPatternData = getViewingPatternData();
|
const viewingPatternData = getViewingPatternData();
|
||||||
setVersionDefaultsFrom(code);
|
|
||||||
const data = { ...viewingPatternData, code };
|
const data = { ...viewingPatternData, code };
|
||||||
let id = data.id;
|
let id = data.id;
|
||||||
const isExamplePattern = viewingPatternData.collection !== userPattern.collection;
|
const isExamplePattern = viewingPatternData.collection !== userPattern.collection;
|
||||||
@@ -117,25 +112,22 @@ export function Repl({ embedded = false }) {
|
|||||||
},
|
},
|
||||||
bgFill: false,
|
bgFill: false,
|
||||||
});
|
});
|
||||||
window.strudelMirror = editor;
|
|
||||||
|
|
||||||
// init settings
|
// init settings
|
||||||
|
|
||||||
initCode().then(async (decoded) => {
|
initCode().then(async (decoded) => {
|
||||||
let code, msg;
|
let msg;
|
||||||
if (decoded) {
|
if (decoded) {
|
||||||
code = decoded;
|
editor.setCode(decoded);
|
||||||
msg = `I have loaded the code from the URL.`;
|
msg = `I have loaded the code from the URL.`;
|
||||||
} else if (latestCode) {
|
} else if (latestCode) {
|
||||||
code = latestCode;
|
editor.setCode(latestCode);
|
||||||
msg = `Your last session has been loaded!`;
|
msg = `Your last session has been loaded!`;
|
||||||
} else {
|
} else {
|
||||||
const { code: randomTune, name } = await getRandomTune();
|
const { code: randomTune, name } = await getRandomTune();
|
||||||
code = randomTune;
|
editor.setCode(randomTune);
|
||||||
msg = `A random code snippet named "${name}" has been loaded!`;
|
msg = `A random code snippet named "${name}" has been loaded!`;
|
||||||
}
|
}
|
||||||
editor.setCode(code);
|
|
||||||
setDocumentTitle(code);
|
|
||||||
logger(`Welcome to Strudel! ${msg} Press play or hit ctrl+enter to run it!`, 'highlight');
|
logger(`Welcome to Strudel! ${msg} Press play or hit ctrl+enter to run it!`, 'highlight');
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -178,11 +170,6 @@ export function Repl({ embedded = false }) {
|
|||||||
// UI Actions
|
// UI Actions
|
||||||
//
|
//
|
||||||
|
|
||||||
const setDocumentTitle = (code) => {
|
|
||||||
const meta = getMetadata(code);
|
|
||||||
document.title = (meta.title ? `${meta.title} - ` : '') + 'Strudel REPL';
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleTogglePlay = async () => {
|
const handleTogglePlay = async () => {
|
||||||
editorRef.current?.toggle();
|
editorRef.current?.toggle();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -40,10 +40,8 @@ export const registerSamplesFromDB = (config = userSamplesDBConfig, onComplete =
|
|||||||
if (!isAudioFile(title)) {
|
if (!isAudioFile(title)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const splitRelativePath = soundFile.id.split('/');
|
const splitRelativePath = soundFile.id?.split('/');
|
||||||
const parentDirectory =
|
const parentDirectory = splitRelativePath[splitRelativePath.length - 2];
|
||||||
//fallback to file name before period and seperator if no parent directory
|
|
||||||
splitRelativePath[splitRelativePath.length - 2] ?? soundFile.id.split(/\W+/)[0] ?? 'user';
|
|
||||||
const soundPath = soundFile.blob;
|
const soundPath = soundFile.blob;
|
||||||
const soundPaths = sounds.get(parentDirectory) ?? new Set();
|
const soundPaths = sounds.get(parentDirectory) ?? new Set();
|
||||||
soundPaths.add(soundPath);
|
soundPaths.add(soundPath);
|
||||||
@@ -116,7 +114,6 @@ const processFilesForIDB = async (files) => {
|
|||||||
Array.from(files)
|
Array.from(files)
|
||||||
.map(async (s) => {
|
.map(async (s) => {
|
||||||
const title = s.name;
|
const title = s.name;
|
||||||
|
|
||||||
if (!isAudioFile(title)) {
|
if (!isAudioFile(title)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -124,14 +121,12 @@ const processFilesForIDB = async (files) => {
|
|||||||
const sUrl = URL.createObjectURL(s);
|
const sUrl = URL.createObjectURL(s);
|
||||||
//fetch the sound and turn it into a buffer array
|
//fetch the sound and turn it into a buffer array
|
||||||
const buf = await fetch(sUrl).then((res) => res.arrayBuffer());
|
const buf = await fetch(sUrl).then((res) => res.arrayBuffer());
|
||||||
//create a url base64 containing all of the buffer data
|
//create a url blob containing all of the buffer data
|
||||||
const base64 = await bufferToDataUrl(buf);
|
const base64 = await bufferToDataUrl(buf);
|
||||||
const path = s.webkitRelativePath;
|
|
||||||
const id = path?.length ? path : title;
|
|
||||||
return {
|
return {
|
||||||
title,
|
title,
|
||||||
blob: base64,
|
blob: base64,
|
||||||
id,
|
id: s.webkitRelativePath,
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
.filter(Boolean),
|
.filter(Boolean),
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ export default function ImportSoundsButton({ onComplete }) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setIsUploading(true);
|
setIsUploading(true);
|
||||||
|
|
||||||
await uploadSamplesToDB(userSamplesDBConfig, fileUploadRef.current.files).then(() => {
|
await uploadSamplesToDB(userSamplesDBConfig, fileUploadRef.current.files).then(() => {
|
||||||
registerSamplesFromDB(userSamplesDBConfig, () => {
|
registerSamplesFromDB(userSamplesDBConfig, () => {
|
||||||
onComplete();
|
onComplete();
|
||||||
@@ -33,7 +32,7 @@ export default function ImportSoundsButton({ onComplete }) {
|
|||||||
directory=""
|
directory=""
|
||||||
webkitdirectory=""
|
webkitdirectory=""
|
||||||
multiple
|
multiple
|
||||||
accept="audio/*, .wav, .mp3, .m4a, .flac"
|
accept="audio/*"
|
||||||
onChange={() => {
|
onChange={() => {
|
||||||
onChange();
|
onChange();
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -13,9 +13,7 @@ export function SoundsTab() {
|
|||||||
const sounds = useStore(soundMap);
|
const sounds = useStore(soundMap);
|
||||||
const { soundsFilter } = useSettings();
|
const { soundsFilter } = useSettings();
|
||||||
const soundEntries = useMemo(() => {
|
const soundEntries = useMemo(() => {
|
||||||
let filtered = Object.entries(sounds)
|
let filtered = Object.entries(sounds).filter(([key]) => !key.startsWith('_'));
|
||||||
.filter(([key]) => !key.startsWith('_'))
|
|
||||||
.sort((a, b) => a[0].localeCompare(b[0]));
|
|
||||||
if (!sounds) {
|
if (!sounds) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
@@ -45,7 +43,7 @@ export function SoundsTab() {
|
|||||||
});
|
});
|
||||||
return (
|
return (
|
||||||
<div id="sounds-tab" className="px-4 flex flex-col w-full h-full dark:text-white text-stone-900">
|
<div id="sounds-tab" className="px-4 flex flex-col w-full h-full dark:text-white text-stone-900">
|
||||||
<div className="pb-2 flex shrink-0 flex-wrap">
|
<div className="pb-2 flex shrink-0 overflow-auto">
|
||||||
<ButtonGroup
|
<ButtonGroup
|
||||||
value={soundsFilter}
|
value={soundsFilter}
|
||||||
onChange={(value) => settingsMap.setKey('soundsFilter', value)}
|
onChange={(value) => settingsMap.setKey('soundsFilter', value)}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { evalScope, hash2code, logger } from '@strudel/core';
|
import { evalScope, hash2code, logger } from '@strudel/core';
|
||||||
import { settingPatterns, defaultAudioDeviceName } from '../settings.mjs';
|
import { settingPatterns, defaultAudioDeviceName } from '../settings.mjs';
|
||||||
import { getAudioContext, initializeAudioOutput, setDefaultAudioContext, setVersionDefaults } from '@strudel/webaudio';
|
import { getAudioContext, initializeAudioOutput, setDefaultAudioContext } from '@strudel/webaudio';
|
||||||
import { getMetadata } from '../metadata_parser';
|
|
||||||
|
|
||||||
import { isTauri } from '../tauri.mjs';
|
import { isTauri } from '../tauri.mjs';
|
||||||
import './Repl.css';
|
import './Repl.css';
|
||||||
@@ -83,7 +82,6 @@ export function loadModules() {
|
|||||||
import('@strudel/serial'),
|
import('@strudel/serial'),
|
||||||
import('@strudel/soundfonts'),
|
import('@strudel/soundfonts'),
|
||||||
import('@strudel/csound'),
|
import('@strudel/csound'),
|
||||||
import('@strudel/tidal'),
|
|
||||||
];
|
];
|
||||||
if (isTauri()) {
|
if (isTauri()) {
|
||||||
modules = modules.concat([
|
modules = modules.concat([
|
||||||
@@ -165,13 +163,3 @@ export const setAudioDevice = async (id) => {
|
|||||||
}
|
}
|
||||||
initializeAudioOutput();
|
initializeAudioOutput();
|
||||||
};
|
};
|
||||||
|
|
||||||
export function setVersionDefaultsFrom(code) {
|
|
||||||
try {
|
|
||||||
const metadata = getMetadata(code);
|
|
||||||
setVersionDefaults(metadata.version);
|
|
||||||
} catch (err) {
|
|
||||||
console.error('Error parsing metadata..');
|
|
||||||
console.error(err);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -21,25 +21,16 @@ export const patternFilterName = {
|
|||||||
user: 'user',
|
user: 'user',
|
||||||
};
|
};
|
||||||
|
|
||||||
const sessionAtom = (name, initial = undefined) => {
|
export let $viewingPatternData = persistentAtom(
|
||||||
const storage = typeof sessionStorage !== 'undefined' ? sessionStorage : {};
|
'viewingPatternData',
|
||||||
const store = atom(typeof storage[name] !== 'undefined' ? storage[name] : initial);
|
{
|
||||||
store.listen((newValue) => {
|
|
||||||
if (typeof newValue === 'undefined') {
|
|
||||||
delete storage[name];
|
|
||||||
} else {
|
|
||||||
storage[name] = newValue;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return store;
|
|
||||||
};
|
|
||||||
|
|
||||||
export let $viewingPatternData = sessionAtom('viewingPatternData', {
|
|
||||||
id: '',
|
id: '',
|
||||||
code: '',
|
code: '',
|
||||||
collection: collectionName.user,
|
collection: collectionName.user,
|
||||||
created_at: Date.now(),
|
created_at: Date.now(),
|
||||||
});
|
},
|
||||||
|
{ listen: false },
|
||||||
|
);
|
||||||
|
|
||||||
export const getViewingPatternData = () => {
|
export const getViewingPatternData = () => {
|
||||||
return parseJSON($viewingPatternData.get());
|
return parseJSON($viewingPatternData.get());
|
||||||
@@ -77,7 +68,7 @@ export async function loadDBPatterns() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// reason: https://github.com/tidalcycles/strudel/issues/857
|
// reason: https://github.com/tidalcycles/strudel/issues/857
|
||||||
const $activePattern = sessionAtom('activePattern', '');
|
const $activePattern = persistentAtom('activePattern', '', { listen: false });
|
||||||
|
|
||||||
export function setActivePattern(key) {
|
export function setActivePattern(key) {
|
||||||
$activePattern.set(key);
|
$activePattern.set(key);
|
||||||
|
|||||||
Reference in New Issue
Block a user