mirror of
https://codeberg.org/uzu/strudel
synced 2026-07-22 13:13:10 -04:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 50f04e8cc8 | |||
| 5e3218a67b |
@@ -1,37 +0,0 @@
|
|||||||
name: Build and Deploy to beta (warm.strudel.cc)
|
|
||||||
|
|
||||||
on: [workflow_dispatch]
|
|
||||||
|
|
||||||
# Allow one concurrent deployment
|
|
||||||
concurrency:
|
|
||||||
group: "pages"
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: docker
|
|
||||||
env:
|
|
||||||
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: pnpm/action-setup@v4
|
|
||||||
with:
|
|
||||||
version: 9.12.2
|
|
||||||
- uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: 20
|
|
||||||
# cache: "pnpm"
|
|
||||||
- name: Install Dependencies
|
|
||||||
run: pnpm install
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: pnpm build
|
|
||||||
|
|
||||||
- name: Deploy
|
|
||||||
run: |
|
|
||||||
eval $(ssh-agent -s)
|
|
||||||
echo "$SSH_PRIVATE_KEY" | ssh-add -
|
|
||||||
apt update && apt install -y rsync
|
|
||||||
mkdir ~/.ssh
|
|
||||||
ssh-keyscan matrix.toplap.org > ~/.ssh/known_hosts
|
|
||||||
rsync -atv --delete --delete-after --progress ./website/dist/ strudel@matrix.toplap.org:/home/strudel/deploy/warm.strudel.cc
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
name: Build and Deploy to live (strudel.cc)
|
name: Build and Deploy
|
||||||
|
|
||||||
on: [workflow_dispatch]
|
on: [workflow_dispatch]
|
||||||
|
|
||||||
@@ -34,4 +34,4 @@ jobs:
|
|||||||
apt update && apt install -y rsync
|
apt update && apt install -y rsync
|
||||||
mkdir ~/.ssh
|
mkdir ~/.ssh
|
||||||
ssh-keyscan matrix.toplap.org > ~/.ssh/known_hosts
|
ssh-keyscan matrix.toplap.org > ~/.ssh/known_hosts
|
||||||
rsync -atv --delete --delete-after --progress ./website/dist/ strudel@matrix.toplap.org:/home/strudel/deploy/strudel.cc
|
rsync -atv --delete --delete-after --progress ./website/dist/ strudel@matrix.toplap.org:/home/strudel/deploy
|
||||||
-14
@@ -45,20 +45,6 @@ tidal-drum-machines
|
|||||||
webaudiofontdata
|
webaudiofontdata
|
||||||
src-tauri/target
|
src-tauri/target
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### BEGIN Visual Studio Code ###
|
|
||||||
# Blanket, recursive exclude for .vscode directory and files
|
|
||||||
.vscode/**/*
|
|
||||||
# Unexclude specific files and directories within .vscode
|
|
||||||
!.vscode/settings.json
|
|
||||||
!.vscode/tasks.json
|
|
||||||
!.vscode/launch.json
|
|
||||||
!.vscode/extensions.json
|
|
||||||
### END Visual Studio Code ###
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# BEGIN JetBrains -> END JetBrains
|
# BEGIN JetBrains -> END JetBrains
|
||||||
|
|
||||||
# for JetBrains IDE users, e.g. WebStorm. Source: https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
# for JetBrains IDE users, e.g. WebStorm. Source: https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
import jsdoc from '../../doc.json';
|
import jsdoc from '../../doc.json';
|
||||||
import { autocompletion } from '@codemirror/autocomplete';
|
import { autocompletion } from '@codemirror/autocomplete';
|
||||||
import { h } from './html';
|
import { h } from './html';
|
||||||
import { Scale } from '@tonaljs/tonal';
|
|
||||||
import { soundMap } from 'superdough';
|
|
||||||
import { complex } from '@strudel/tonal';
|
|
||||||
|
|
||||||
const escapeHtml = (str) => {
|
const escapeHtml = (str) => {
|
||||||
const div = document.createElement('div');
|
const div = document.createElement('div');
|
||||||
@@ -78,51 +75,6 @@ const isValidDoc = (doc) => {
|
|||||||
const hasExcludedTags = (doc) =>
|
const hasExcludedTags = (doc) =>
|
||||||
['superdirtOnly', 'noAutocomplete'].some((tag) => doc.tags?.find((t) => t.originalTitle === tag));
|
['superdirtOnly', 'noAutocomplete'].some((tag) => doc.tags?.find((t) => t.originalTitle === tag));
|
||||||
|
|
||||||
export function bankCompletions() {
|
|
||||||
const soundDict = soundMap.get();
|
|
||||||
const banks = new Set();
|
|
||||||
for (const key of Object.keys(soundDict)) {
|
|
||||||
const [bank, suffix] = key.split('_');
|
|
||||||
if (suffix && bank) banks.add(bank);
|
|
||||||
}
|
|
||||||
return Array.from(banks)
|
|
||||||
.sort()
|
|
||||||
.map((name) => ({ label: name, type: 'bank' }));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Attempt to get all scale names from Tonal
|
|
||||||
let scaleCompletions = [];
|
|
||||||
try {
|
|
||||||
scaleCompletions = (Scale.names ? Scale.names() : []).map((name) => ({ label: name, type: 'scale' }));
|
|
||||||
} catch (e) {
|
|
||||||
console.warn('[autocomplete] Could not load scale names from Tonal:', e);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Valid mode values for voicing
|
|
||||||
const modeCompletions = [
|
|
||||||
{ label: 'below', type: 'mode' },
|
|
||||||
{ label: 'above', type: 'mode' },
|
|
||||||
{ label: 'duck', type: 'mode' },
|
|
||||||
{ label: 'root', type: 'mode' },
|
|
||||||
];
|
|
||||||
|
|
||||||
// Valid chord symbols from ireal dictionary plus empty string for major triads
|
|
||||||
const chordSymbols = ['', ...Object.keys(complex)].sort();
|
|
||||||
const chordSymbolCompletions = chordSymbols.map((symbol) => {
|
|
||||||
if (symbol === '') {
|
|
||||||
return {
|
|
||||||
label: 'major',
|
|
||||||
apply: '',
|
|
||||||
type: 'chord-symbol',
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
label: symbol,
|
|
||||||
apply: symbol,
|
|
||||||
type: 'chord-symbol',
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
export const getSynonymDoc = (doc, synonym) => {
|
export const getSynonymDoc = (doc, synonym) => {
|
||||||
const synonyms = doc.synonyms || [];
|
const synonyms = doc.synonyms || [];
|
||||||
const docLabel = getDocLabel(doc);
|
const docLabel = getDocLabel(doc);
|
||||||
@@ -161,299 +113,19 @@ const jsdocCompletions = (() => {
|
|||||||
return completions;
|
return completions;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
// --- Handler functions for each context ---
|
export const strudelAutocomplete = (context) => {
|
||||||
const pitchNames = [
|
const word = context.matchBefore(/\w*/);
|
||||||
'C',
|
if (word.from === word.to && !context.explicit) return null;
|
||||||
'C#',
|
|
||||||
'Db',
|
|
||||||
'D',
|
|
||||||
'D#',
|
|
||||||
'Eb',
|
|
||||||
'E',
|
|
||||||
'E#',
|
|
||||||
'Fb',
|
|
||||||
'F',
|
|
||||||
'F#',
|
|
||||||
'Gb',
|
|
||||||
'G',
|
|
||||||
'G#',
|
|
||||||
'Ab',
|
|
||||||
'A',
|
|
||||||
'A#',
|
|
||||||
'Bb',
|
|
||||||
'B',
|
|
||||||
'B#',
|
|
||||||
'Cb',
|
|
||||||
];
|
|
||||||
|
|
||||||
// Cached regex patterns for scaleHandler
|
|
||||||
const SCALE_NO_QUOTES_REGEX = /scale\(\s*$/;
|
|
||||||
const SCALE_AFTER_COLON_REGEX = /scale\(\s*['"][^'"]*:[^'"]*$/;
|
|
||||||
const SCALE_PRE_COLON_REGEX = /scale\(\s*['"][^'"]*$/;
|
|
||||||
const SCALE_PITCH_MATCH_REGEX = /([A-Ga-g][#b]*)?$/;
|
|
||||||
const SCALE_SPACES_TO_COLON_REGEX = /\s+/g;
|
|
||||||
|
|
||||||
function scaleHandler(context) {
|
|
||||||
// First check for scale context without quotes - block with empty completions
|
|
||||||
let scaleNoQuotesContext = context.matchBefore(SCALE_NO_QUOTES_REGEX);
|
|
||||||
if (scaleNoQuotesContext) {
|
|
||||||
return {
|
|
||||||
from: scaleNoQuotesContext.to,
|
|
||||||
options: [],
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for after-colon context first (more specific)
|
|
||||||
let scaleAfterColonContext = context.matchBefore(SCALE_AFTER_COLON_REGEX);
|
|
||||||
if (scaleAfterColonContext) {
|
|
||||||
const text = scaleAfterColonContext.text;
|
|
||||||
const colonIdx = text.lastIndexOf(':');
|
|
||||||
if (colonIdx !== -1) {
|
|
||||||
const fragment = text.slice(colonIdx + 1);
|
|
||||||
const filteredScales = scaleCompletions.filter((s) => s.label.startsWith(fragment));
|
|
||||||
const options = filteredScales.map((s) => ({
|
|
||||||
...s,
|
|
||||||
apply: s.label.replace(SCALE_SPACES_TO_COLON_REGEX, ':'),
|
|
||||||
}));
|
|
||||||
const from = scaleAfterColonContext.from + colonIdx + 1;
|
|
||||||
return {
|
|
||||||
from,
|
|
||||||
options,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Then check for pre-colon context
|
|
||||||
let scalePreColonContext = context.matchBefore(SCALE_PRE_COLON_REGEX);
|
|
||||||
if (scalePreColonContext) {
|
|
||||||
if (!scalePreColonContext.text.includes(':')) {
|
|
||||||
if (context.explicit) {
|
|
||||||
const text = scalePreColonContext.text;
|
|
||||||
const match = text.match(SCALE_PITCH_MATCH_REGEX);
|
|
||||||
const fragment = match ? match[0] : '';
|
|
||||||
const filtered = pitchNames.filter((p) => p.toLowerCase().startsWith(fragment.toLowerCase()));
|
|
||||||
const from = scalePreColonContext.to - fragment.length;
|
|
||||||
const options = filtered.map((p) => ({ label: p, type: 'pitch' }));
|
|
||||||
return { from, options };
|
|
||||||
} else {
|
|
||||||
return { from: scalePreColonContext.to, options: [] };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Cached regex patterns for soundHandler
|
|
||||||
const SOUND_NO_QUOTES_REGEX = /(s|sound)\(\s*$/;
|
|
||||||
const SOUND_WITH_QUOTES_REGEX = /(s|sound)\(\s*['"][^'"]*$/;
|
|
||||||
const SOUND_FRAGMENT_MATCH_REGEX = /(?:[\s[{(<])([\w]*)$/;
|
|
||||||
|
|
||||||
function soundHandler(context) {
|
|
||||||
// First check for sound context without quotes - block with empty completions
|
|
||||||
let soundNoQuotesContext = context.matchBefore(SOUND_NO_QUOTES_REGEX);
|
|
||||||
if (soundNoQuotesContext) {
|
|
||||||
return {
|
|
||||||
from: soundNoQuotesContext.to,
|
|
||||||
options: [],
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// Then check for sound context with quotes - provide completions
|
|
||||||
let soundContext = context.matchBefore(SOUND_WITH_QUOTES_REGEX);
|
|
||||||
if (!soundContext) return null;
|
|
||||||
|
|
||||||
const text = soundContext.text;
|
|
||||||
const quoteIdx = Math.max(text.lastIndexOf('"'), text.lastIndexOf("'"));
|
|
||||||
if (quoteIdx === -1) return null;
|
|
||||||
const inside = text.slice(quoteIdx + 1);
|
|
||||||
const fragMatch = inside.match(SOUND_FRAGMENT_MATCH_REGEX);
|
|
||||||
const fragment = fragMatch ? fragMatch[1] : inside;
|
|
||||||
const soundNames = Object.keys(soundMap.get()).sort();
|
|
||||||
const filteredSounds = soundNames.filter((name) => name.includes(fragment));
|
|
||||||
let options = filteredSounds.map((name) => ({ label: name, type: 'sound' }));
|
|
||||||
const from = soundContext.to - fragment.length;
|
|
||||||
return {
|
|
||||||
from,
|
|
||||||
options,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// Cached regex patterns for bankHandler
|
|
||||||
const BANK_NO_QUOTES_REGEX = /bank\(\s*$/;
|
|
||||||
const BANK_WITH_QUOTES_REGEX = /bank\(\s*['"][^'"]*$/;
|
|
||||||
|
|
||||||
function bankHandler(context) {
|
|
||||||
// First check for bank context without quotes - block with empty completions
|
|
||||||
let bankNoQuotesContext = context.matchBefore(BANK_NO_QUOTES_REGEX);
|
|
||||||
if (bankNoQuotesContext) {
|
|
||||||
return {
|
|
||||||
from: bankNoQuotesContext.to,
|
|
||||||
options: [],
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// Then check for bank context with quotes - provide completions
|
|
||||||
let bankMatch = context.matchBefore(BANK_WITH_QUOTES_REGEX);
|
|
||||||
if (!bankMatch) return null;
|
|
||||||
|
|
||||||
const text = bankMatch.text;
|
|
||||||
const quoteIdx = Math.max(text.lastIndexOf('"'), text.lastIndexOf("'"));
|
|
||||||
if (quoteIdx === -1) return null;
|
|
||||||
const inside = text.slice(quoteIdx + 1);
|
|
||||||
const fragment = inside;
|
|
||||||
let banks = bankCompletions();
|
|
||||||
const filteredBanks = banks.filter((b) => b.label.startsWith(fragment));
|
|
||||||
const from = bankMatch.to - fragment.length;
|
|
||||||
return {
|
|
||||||
from,
|
|
||||||
options: filteredBanks,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// Cached regex patterns for modeHandler
|
|
||||||
const MODE_NO_QUOTES_REGEX = /mode\(\s*$/;
|
|
||||||
const MODE_AFTER_COLON_REGEX = /mode\(\s*['"][^'"]*:[^'"]*$/;
|
|
||||||
const MODE_PRE_COLON_REGEX = /mode\(\s*['"][^'"]*$/;
|
|
||||||
const MODE_FRAGMENT_MATCH_REGEX = /(?:[\s[{(<])([\w:]*)$/;
|
|
||||||
|
|
||||||
function modeHandler(context) {
|
|
||||||
// First check for mode context without quotes - block with empty completions
|
|
||||||
let modeNoQuotesContext = context.matchBefore(MODE_NO_QUOTES_REGEX);
|
|
||||||
if (modeNoQuotesContext) {
|
|
||||||
return {
|
|
||||||
from: modeNoQuotesContext.to,
|
|
||||||
options: [],
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for after-colon context first (more specific)
|
|
||||||
let modeAfterColonContext = context.matchBefore(MODE_AFTER_COLON_REGEX);
|
|
||||||
if (modeAfterColonContext) {
|
|
||||||
const text = modeAfterColonContext.text;
|
|
||||||
const colonIdx = text.lastIndexOf(':');
|
|
||||||
if (colonIdx !== -1) {
|
|
||||||
const fragment = text.slice(colonIdx + 1);
|
|
||||||
// For anchor after colon, we can suggest pitch names
|
|
||||||
const filtered = pitchNames.filter((p) => p.toLowerCase().startsWith(fragment.toLowerCase()));
|
|
||||||
const options = filtered.map((p) => ({ label: p, type: 'pitch' }));
|
|
||||||
const from = modeAfterColonContext.from + colonIdx + 1;
|
|
||||||
return {
|
|
||||||
from,
|
|
||||||
options,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Then check for pre-colon context
|
|
||||||
let modeContext = context.matchBefore(MODE_PRE_COLON_REGEX);
|
|
||||||
if (!modeContext) return null;
|
|
||||||
|
|
||||||
const text = modeContext.text;
|
|
||||||
const quoteIdx = Math.max(text.lastIndexOf('"'), text.lastIndexOf("'"));
|
|
||||||
if (quoteIdx === -1) return null;
|
|
||||||
const inside = text.slice(quoteIdx + 1);
|
|
||||||
const fragMatch = inside.match(MODE_FRAGMENT_MATCH_REGEX);
|
|
||||||
const fragment = fragMatch ? fragMatch[1] : inside;
|
|
||||||
const filteredModes = modeCompletions.filter((m) => m.label.startsWith(fragment));
|
|
||||||
const from = modeContext.to - fragment.length;
|
|
||||||
return {
|
|
||||||
from,
|
|
||||||
options: filteredModes,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// Cached regex patterns for chordHandler
|
|
||||||
const CHORD_NO_QUOTES_REGEX = /chord\(\s*$/;
|
|
||||||
const CHORD_WITH_QUOTES_REGEX = /chord\(\s*['"][^'"]*$/;
|
|
||||||
const CHORD_FRAGMENT_MATCH_REGEX = /(?:[\s[{(<])([\w#b+^:-]*)$/;
|
|
||||||
|
|
||||||
function chordHandler(context) {
|
|
||||||
// First check for chord context without quotes - block with empty completions
|
|
||||||
let chordNoQuotesContext = context.matchBefore(CHORD_NO_QUOTES_REGEX);
|
|
||||||
if (chordNoQuotesContext) {
|
|
||||||
return {
|
|
||||||
from: chordNoQuotesContext.to,
|
|
||||||
options: [],
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// Then check for chord context with quotes - provide completions
|
|
||||||
let chordContext = context.matchBefore(CHORD_WITH_QUOTES_REGEX);
|
|
||||||
if (!chordContext) return null;
|
|
||||||
|
|
||||||
const text = chordContext.text;
|
|
||||||
const quoteIdx = Math.max(text.lastIndexOf('"'), text.lastIndexOf("'"));
|
|
||||||
if (quoteIdx === -1) return null;
|
|
||||||
const inside = text.slice(quoteIdx + 1);
|
|
||||||
|
|
||||||
// Use same fragment matching as sound/mode for expressions like "<G Am>"
|
|
||||||
const fragMatch = inside.match(CHORD_FRAGMENT_MATCH_REGEX);
|
|
||||||
const fragment = fragMatch ? fragMatch[1] : inside;
|
|
||||||
|
|
||||||
// Check if fragment contains any pitch name at start (for root + symbol)
|
|
||||||
let rootMatch = null;
|
|
||||||
let symbolFragment = fragment;
|
|
||||||
for (const pitch of pitchNames) {
|
|
||||||
if (fragment.toLowerCase().startsWith(pitch.toLowerCase())) {
|
|
||||||
rootMatch = pitch;
|
|
||||||
symbolFragment = fragment.slice(pitch.length);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rootMatch) {
|
|
||||||
// We have a root, now complete chord symbols
|
|
||||||
const filteredSymbols = chordSymbolCompletions.filter((s) =>
|
|
||||||
s.label.toLowerCase().startsWith(symbolFragment.toLowerCase()),
|
|
||||||
);
|
|
||||||
|
|
||||||
// Create completions that replace the entire chord, not just the symbol part
|
|
||||||
const options = filteredSymbols;
|
|
||||||
|
|
||||||
const from = chordContext.to - symbolFragment.length;
|
|
||||||
return { from, options };
|
|
||||||
} else {
|
|
||||||
// No root yet, complete with pitch names
|
|
||||||
const filteredPitches = pitchNames.filter((p) => p.toLowerCase().startsWith(fragment.toLowerCase()));
|
|
||||||
const options = filteredPitches.map((p) => ({ label: p, type: 'pitch' }));
|
|
||||||
const from = chordContext.to - fragment.length;
|
|
||||||
return { from, options };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Cached regex patterns for fallbackHandler
|
|
||||||
const FALLBACK_WORD_REGEX = /\w*/;
|
|
||||||
|
|
||||||
function fallbackHandler(context) {
|
|
||||||
const word = context.matchBefore(FALLBACK_WORD_REGEX);
|
|
||||||
if (word && word.from === word.to && !context.explicit) return null;
|
|
||||||
if (word) {
|
|
||||||
return {
|
return {
|
||||||
from: word.from,
|
from: word.from,
|
||||||
options: jsdocCompletions,
|
options: jsdocCompletions,
|
||||||
|
/* options: [
|
||||||
|
{ label: 'match', type: 'keyword' },
|
||||||
|
{ label: 'hello', type: 'variable', info: '(World)' },
|
||||||
|
{ label: 'magic', type: 'text', apply: '⠁⭒*.✩.*⭒⠁', detail: 'macro' },
|
||||||
|
], */
|
||||||
};
|
};
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
const handlers = [
|
|
||||||
soundHandler,
|
|
||||||
bankHandler,
|
|
||||||
chordHandler,
|
|
||||||
scaleHandler,
|
|
||||||
modeHandler,
|
|
||||||
// this handler *must* be last
|
|
||||||
fallbackHandler,
|
|
||||||
];
|
|
||||||
|
|
||||||
export const strudelAutocomplete = (context) => {
|
|
||||||
for (const handler of handlers) {
|
|
||||||
const result = handler(context);
|
|
||||||
if (result) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const isAutoCompletionEnabled = (enabled) =>
|
export const isAutoCompletionEnabled = (enabled) =>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@strudel/codemirror",
|
"name": "@strudel/codemirror",
|
||||||
"version": "1.2.6",
|
"version": "1.2.5",
|
||||||
"description": "Codemirror Extensions for Strudel",
|
"description": "Codemirror Extensions for Strudel",
|
||||||
"main": "index.mjs",
|
"main": "index.mjs",
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
@@ -46,11 +46,8 @@
|
|||||||
"@replit/codemirror-vscode-keymap": "^6.0.2",
|
"@replit/codemirror-vscode-keymap": "^6.0.2",
|
||||||
"@strudel/core": "workspace:*",
|
"@strudel/core": "workspace:*",
|
||||||
"@strudel/draw": "workspace:*",
|
"@strudel/draw": "workspace:*",
|
||||||
"@strudel/tonal": "workspace:*",
|
|
||||||
"@strudel/transpiler": "workspace:*",
|
"@strudel/transpiler": "workspace:*",
|
||||||
"@tonaljs/tonal": "^4.10.0",
|
"nanostores": "^0.11.3"
|
||||||
"nanostores": "^0.11.3",
|
|
||||||
"superdough": "workspace:*"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"vite": "^6.0.11"
|
"vite": "^6.0.11"
|
||||||
|
|||||||
+27
-362
@@ -87,239 +87,6 @@ export function registerControl(names, ...aliases) {
|
|||||||
*/
|
*/
|
||||||
export const { s, sound } = registerControl(['s', 'n', 'gain'], 'sound');
|
export const { s, sound } = registerControl(['s', 'n', 'gain'], 'sound');
|
||||||
|
|
||||||
/**
|
|
||||||
* Position in the wavetable of the wavetable oscillator
|
|
||||||
*
|
|
||||||
* @name wt
|
|
||||||
* @param {number | Pattern} position Position in the wavetable from 0 to 1
|
|
||||||
* @synonyms wavetablePosition
|
|
||||||
* @example
|
|
||||||
* s("squelch").bank("wt_digital").seg(8).note("F1").wt("0 0.25 0.5 0.75 1")
|
|
||||||
*/
|
|
||||||
export const { wt, wavetablePosition } = registerControl('wt', 'wavetablePosition');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Amount of envelope applied wavetable oscillator's position envelope
|
|
||||||
*
|
|
||||||
* @name wtenv
|
|
||||||
* @param {number | Pattern} amount between 0 and 1
|
|
||||||
*/
|
|
||||||
export const { wtenv } = registerControl('wtenv');
|
|
||||||
/**
|
|
||||||
* Attack time of the wavetable oscillator's position envelope
|
|
||||||
*
|
|
||||||
* @name wtattack
|
|
||||||
* @synonyms wtatt
|
|
||||||
* @param {number | Pattern} time attack time in seconds
|
|
||||||
*/
|
|
||||||
export const { wtattack, wtatt } = registerControl('wtattack', 'wtatt');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Decay time of the wavetable oscillator's position envelope
|
|
||||||
*
|
|
||||||
* @name wtdecay
|
|
||||||
* @synonyms wtdec
|
|
||||||
* @param {number | Pattern} time decay time in seconds
|
|
||||||
*/
|
|
||||||
export const { wtdecay, wtdec } = registerControl('wtdecay', 'wtdec');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sustain time of the wavetable oscillator's position envelope
|
|
||||||
*
|
|
||||||
* @name wtsustain
|
|
||||||
* @synonyms wtsus
|
|
||||||
* @param {number | Pattern} gain sustain level (0 to 1)
|
|
||||||
*/
|
|
||||||
export const { wtsustain, wtsus } = registerControl('wtsustain', 'wtsus');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Release time of the wavetable oscillator's position envelope
|
|
||||||
*
|
|
||||||
* @name wtrelease
|
|
||||||
* @synonyms wtrel
|
|
||||||
* @param {number | Pattern} time release time in seconds
|
|
||||||
*/
|
|
||||||
export const { wtrelease, wtrel } = registerControl('wtrelease', 'wtrel');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Rate of the LFO for the wavetable oscillator's position
|
|
||||||
*
|
|
||||||
* @name wtrate
|
|
||||||
* @param {number | Pattern} rate rate in hertz
|
|
||||||
*/
|
|
||||||
export const { wtrate } = registerControl('wtrate');
|
|
||||||
/**
|
|
||||||
* cycle synced rate of the LFO for the wavetable oscillator's position
|
|
||||||
*
|
|
||||||
* @name wtsync
|
|
||||||
* @param {number | Pattern} rate rate in cycles
|
|
||||||
*/
|
|
||||||
export const { wtsync } = registerControl('wtsync');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Depth of the LFO for the wavetable oscillator's position
|
|
||||||
*
|
|
||||||
* @name wtdepth
|
|
||||||
* @param {number | Pattern} depth depth of modulation
|
|
||||||
*/
|
|
||||||
export const { wtdepth } = registerControl('wtdepth');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Shape of the LFO for the wavetable oscillator's position
|
|
||||||
*
|
|
||||||
* @name wtshape
|
|
||||||
* @param {number | Pattern} shape Shape of the lfo (0, 1, 2, ..)
|
|
||||||
*/
|
|
||||||
export const { wtshape } = registerControl('wtshape');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* DC offset of the LFO for the wavetable oscillator's position
|
|
||||||
*
|
|
||||||
* @name wtdc
|
|
||||||
* @param {number | Pattern} dcoffset dc offset. set to 0 for unipolar
|
|
||||||
*/
|
|
||||||
export const { wtdc } = registerControl('wtdc');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Skew of the LFO for the wavetable oscillator's position
|
|
||||||
*
|
|
||||||
* @name wtskew
|
|
||||||
* @param {number | Pattern} skew How much to bend the LFO shape
|
|
||||||
*/
|
|
||||||
export const { wtskew } = registerControl('wtskew');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Amount of warp (alteration of the waveform) to apply to the wavetable oscillator
|
|
||||||
*
|
|
||||||
* @name warp
|
|
||||||
* @param {number | Pattern} amount Warp of the wavetable from 0 to 1
|
|
||||||
* @synonyms wavetableWarp
|
|
||||||
* @example
|
|
||||||
* s("basique").bank("wt_digital").seg(8).note("F1").warp("0 0.25 0.5 0.75 1")
|
|
||||||
* .warpmode("spin")
|
|
||||||
*/
|
|
||||||
export const { warp, wavetableWarp } = registerControl('warp', 'wavetableWarp');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Attack time of the wavetable oscillator's warp envelope
|
|
||||||
*
|
|
||||||
* @name warpattack
|
|
||||||
* @synonyms warpatt
|
|
||||||
* @param {number | Pattern} time attack time in seconds
|
|
||||||
*/
|
|
||||||
export const { warpattack, warpatt } = registerControl('warpattack', 'warpatt');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Decay time of the wavetable oscillator's warp envelope
|
|
||||||
*
|
|
||||||
* @name warpdecay
|
|
||||||
* @synonyms warpdec
|
|
||||||
* @param {number | Pattern} time decay time in seconds
|
|
||||||
*/
|
|
||||||
export const { warpdecay, warpdec } = registerControl('warpdecay', 'warpdec');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sustain time of the wavetable oscillator's warp envelope
|
|
||||||
*
|
|
||||||
* @name warpsustain
|
|
||||||
* @synonyms warpsus
|
|
||||||
* @param {number | Pattern} gain sustain level (0 to 1)
|
|
||||||
*/
|
|
||||||
export const { warpsustain, warpsus } = registerControl('warpsustain', 'warpsus');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Release time of the wavetable oscillator's warp envelope
|
|
||||||
*
|
|
||||||
* @name warprelease
|
|
||||||
* @synonyms warprel
|
|
||||||
* @param {number | Pattern} time release time in seconds
|
|
||||||
*/
|
|
||||||
export const { warprelease, warprel } = registerControl('warprelease', 'warprel');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Rate of the LFO for the wavetable oscillator's warp
|
|
||||||
*
|
|
||||||
* @name warprate
|
|
||||||
* @param {number | Pattern} rate rate in hertz
|
|
||||||
*/
|
|
||||||
export const { warprate } = registerControl('warprate');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Depth of the LFO for the wavetable oscillator's warp
|
|
||||||
*
|
|
||||||
* @name warpdepth
|
|
||||||
* @param {number | Pattern} depth depth of modulation
|
|
||||||
*/
|
|
||||||
export const { warpdepth } = registerControl('warpdepth');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Shape of the LFO for the wavetable oscillator's warp
|
|
||||||
*
|
|
||||||
* @name warpshape
|
|
||||||
* @param {number | Pattern} shape Shape of the lfo (0, 1, 2, ..)
|
|
||||||
*/
|
|
||||||
export const { warpshape } = registerControl('warpshape');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* DC offset of the LFO for the wavetable oscillator's warp
|
|
||||||
*
|
|
||||||
* @name warpdc
|
|
||||||
* @param {number | Pattern} dcoffset dc offset. set to 0 for unipolar
|
|
||||||
*/
|
|
||||||
export const { warpdc } = registerControl('warpdc');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Skew of the LFO for the wavetable oscillator's warp
|
|
||||||
*
|
|
||||||
* @name warpskew
|
|
||||||
* @param {number | Pattern} skew How much to bend the LFO shape
|
|
||||||
*/
|
|
||||||
export const { warpskew } = registerControl('warpskew');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Type of warp (alteration of the waveform) to apply to the wavetable oscillator.
|
|
||||||
*
|
|
||||||
* The current options are: none, asym, bendp, bendm, bendmp, sync, quant, fold, pwm, orbit,
|
|
||||||
* spin, chaos, primes, binary, brownian, reciprocal, wormhole, logistic, sigmoid, fractal, flip
|
|
||||||
*
|
|
||||||
* @name warpmode
|
|
||||||
* @param {number | string | Pattern} mode Warp mode
|
|
||||||
* @synonyms wavetableWarpMode
|
|
||||||
* @example
|
|
||||||
* s("morgana").bank("wt_digital").seg(8).note("F1").warp("0 0.25 0.5 0.75 1")
|
|
||||||
* .warpmode("<asym bendp spin logistic sync wormhole brownian>*2")
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
export const { warpmode, wavetableWarpMode } = registerControl('warpmode', 'wavetableWarpMode');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Amount of randomness of the initial phase of the wavetable oscillator.
|
|
||||||
*
|
|
||||||
* @name wtphaserand
|
|
||||||
* @param {number | Pattern} amount Randomness of the initial phase. Between 0 (not random) and 1 (fully random)
|
|
||||||
* @synonyms wavetablePhaseRand
|
|
||||||
* @example
|
|
||||||
* s("basique").bank("wt_digital").seg(16).wtphaserand("<0 1>")
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
export const { wtphaserand, wavetablePhaseRand } = registerControl('wtphaserand', 'wavetablePhaseRand');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Amount of envelope applied wavetable oscillator's position envelope
|
|
||||||
*
|
|
||||||
* @name warpenv
|
|
||||||
* @param {number | Pattern} amount between 0 and 1
|
|
||||||
*/
|
|
||||||
export const { warpenv } = registerControl('warpenv');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* cycle synced rate of the LFO for the wavetable warp position
|
|
||||||
*
|
|
||||||
* @name warpsync
|
|
||||||
* @param {number | Pattern} rate rate in cycles
|
|
||||||
*/
|
|
||||||
export const { warpsync } = registerControl('warpsync');
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define a custom webaudio node to use as a sound source.
|
* Define a custom webaudio node to use as a sound source.
|
||||||
*
|
*
|
||||||
@@ -347,7 +114,7 @@ export const { n } = registerControl('n');
|
|||||||
*
|
*
|
||||||
* - a letter (a-g or A-G)
|
* - a letter (a-g or A-G)
|
||||||
* - optional accidentals (b or #)
|
* - optional accidentals (b or #)
|
||||||
* - optional (possibly negative) octave number (0-9). Defaults to 3
|
* - optional octave number (0-9). Defaults to 3
|
||||||
*
|
*
|
||||||
* Examples of valid note names: `c`, `bb`, `Bb`, `f#`, `c3`, `A4`, `Eb2`, `c#5`
|
* Examples of valid note names: `c`, `bb`, `Bb`, `f#`, `c3`, `A4`, `Eb2`, `c#5`
|
||||||
*
|
*
|
||||||
@@ -360,8 +127,6 @@ export const { n } = registerControl('n');
|
|||||||
* note("c4 a4 f4 e4")
|
* note("c4 a4 f4 e4")
|
||||||
* @example
|
* @example
|
||||||
* note("60 69 65 64")
|
* note("60 69 65 64")
|
||||||
* @example
|
|
||||||
* note("fbb1 a#0 cbbb-1 e##-2").sound("saw")
|
|
||||||
*/
|
*/
|
||||||
export const { note } = registerControl(['note', 'n']);
|
export const { note } = registerControl(['note', 'n']);
|
||||||
|
|
||||||
@@ -377,8 +142,8 @@ export const { note } = registerControl(['note', 'n']);
|
|||||||
*/
|
*/
|
||||||
export const { accelerate } = registerControl('accelerate');
|
export const { accelerate } = registerControl('accelerate');
|
||||||
/**
|
/**
|
||||||
* Sets the velocity from 0 to 1. Is multiplied together with gain.
|
|
||||||
*
|
*
|
||||||
|
* Sets the velocity from 0 to 1. Is multiplied together with gain.
|
||||||
* @name velocity
|
* @name velocity
|
||||||
* @example
|
* @example
|
||||||
* s("hh*8")
|
* s("hh*8")
|
||||||
@@ -490,7 +255,7 @@ export const { fmenv } = registerControl('fmenv');
|
|||||||
export const { fmattack } = registerControl('fmattack');
|
export const { fmattack } = registerControl('fmattack');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Waveform of the fm modulator
|
* waveform of the fm modulator
|
||||||
*
|
*
|
||||||
* @name fmwave
|
* @name fmwave
|
||||||
* @param {number | Pattern} wave waveform
|
* @param {number | Pattern} wave waveform
|
||||||
@@ -624,7 +389,7 @@ export const { bandf, bpf, bp } = registerControl(['bandf', 'bandq', 'bpenv'], '
|
|||||||
// ['bpq'],
|
// ['bpq'],
|
||||||
export const { bandq, bpq } = registerControl('bandq', 'bpq');
|
export const { bandq, bpq } = registerControl('bandq', 'bpq');
|
||||||
/**
|
/**
|
||||||
* A pattern of numbers from 0 to 1. Skips the beginning of each sample, e.g. `0.25` to cut off the first quarter from each sample.
|
* a pattern of numbers from 0 to 1. Skips the beginning of each sample, e.g. `0.25` to cut off the first quarter from each sample.
|
||||||
*
|
*
|
||||||
* @memberof Pattern
|
* @memberof Pattern
|
||||||
* @name begin
|
* @name begin
|
||||||
@@ -685,7 +450,7 @@ export const { loopBegin, loopb } = registerControl('loopBegin', 'loopb');
|
|||||||
*/
|
*/
|
||||||
export const { loopEnd, loope } = registerControl('loopEnd', 'loope');
|
export const { loopEnd, loope } = registerControl('loopEnd', 'loope');
|
||||||
/**
|
/**
|
||||||
* Bit crusher effect.
|
* bit crusher effect.
|
||||||
*
|
*
|
||||||
* @name crush
|
* @name crush
|
||||||
* @param {number | Pattern} depth between 1 (for drastic reduction in bit-depth) to 16 (for barely no reduction).
|
* @param {number | Pattern} depth between 1 (for drastic reduction in bit-depth) to 16 (for barely no reduction).
|
||||||
@@ -696,7 +461,7 @@ export const { loopEnd, loope } = registerControl('loopEnd', 'loope');
|
|||||||
// ['clhatdecay'],
|
// ['clhatdecay'],
|
||||||
export const { crush } = registerControl('crush');
|
export const { crush } = registerControl('crush');
|
||||||
/**
|
/**
|
||||||
* Fake-resampling for lowering the sample rate. Caution: This effect seems to only work in chromium based browsers
|
* fake-resampling for lowering the sample rate. Caution: This effect seems to only work in chromium based browsers
|
||||||
*
|
*
|
||||||
* @name coarse
|
* @name coarse
|
||||||
* @param {number | Pattern} factor 1 for original 2 for half, 3 for a third and so on.
|
* @param {number | Pattern} factor 1 for original 2 for half, 3 for a third and so on.
|
||||||
@@ -707,7 +472,7 @@ export const { crush } = registerControl('crush');
|
|||||||
export const { coarse } = registerControl('coarse');
|
export const { coarse } = registerControl('coarse');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modulate the amplitude of a sound with a continuous waveform
|
* modulate the amplitude of a sound with a continuous waveform
|
||||||
*
|
*
|
||||||
* @name tremolo
|
* @name tremolo
|
||||||
* @synonyms trem
|
* @synonyms trem
|
||||||
@@ -719,7 +484,7 @@ export const { coarse } = registerControl('coarse');
|
|||||||
export const { tremolo } = registerControl(['tremolo', 'tremolodepth', 'tremoloskew', 'tremolophase'], 'trem');
|
export const { tremolo } = registerControl(['tremolo', 'tremolodepth', 'tremoloskew', 'tremolophase'], 'trem');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modulate the amplitude of a sound with a continuous waveform
|
* modulate the amplitude of a sound with a continuous waveform
|
||||||
*
|
*
|
||||||
* @name tremolosync
|
* @name tremolosync
|
||||||
* @synonyms tremsync
|
* @synonyms tremsync
|
||||||
@@ -734,7 +499,7 @@ export const { tremolosync } = registerControl(
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Depth of amplitude modulation
|
* depth of amplitude modulation
|
||||||
*
|
*
|
||||||
* @name tremolodepth
|
* @name tremolodepth
|
||||||
* @synonyms tremdepth
|
* @synonyms tremdepth
|
||||||
@@ -745,7 +510,7 @@ export const { tremolosync } = registerControl(
|
|||||||
*/
|
*/
|
||||||
export const { tremolodepth } = registerControl('tremolodepth', 'tremdepth');
|
export const { tremolodepth } = registerControl('tremolodepth', 'tremdepth');
|
||||||
/**
|
/**
|
||||||
* Alter the shape of the modulation waveform
|
* alter the shape of the modulation waveform
|
||||||
*
|
*
|
||||||
* @name tremoloskew
|
* @name tremoloskew
|
||||||
* @synonyms tremskew
|
* @synonyms tremskew
|
||||||
@@ -757,7 +522,7 @@ export const { tremolodepth } = registerControl('tremolodepth', 'tremdepth');
|
|||||||
export const { tremoloskew } = registerControl('tremoloskew', 'tremskew');
|
export const { tremoloskew } = registerControl('tremoloskew', 'tremskew');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Alter the phase of the modulation waveform
|
* alter the phase of the modulation waveform
|
||||||
*
|
*
|
||||||
* @name tremolophase
|
* @name tremolophase
|
||||||
* @synonyms tremphase
|
* @synonyms tremphase
|
||||||
@@ -769,7 +534,7 @@ export const { tremoloskew } = registerControl('tremoloskew', 'tremskew');
|
|||||||
export const { tremolophase } = registerControl('tremolophase', 'tremphase');
|
export const { tremolophase } = registerControl('tremolophase', 'tremphase');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shape of amplitude modulation
|
* shape of amplitude modulation
|
||||||
*
|
*
|
||||||
* @name tremoloshape
|
* @name tremoloshape
|
||||||
* @synonyms tremshape
|
* @synonyms tremshape
|
||||||
@@ -780,7 +545,7 @@ export const { tremolophase } = registerControl('tremolophase', 'tremphase');
|
|||||||
*/
|
*/
|
||||||
export const { tremoloshape } = registerControl('tremoloshape', 'tremshape');
|
export const { tremoloshape } = registerControl('tremoloshape', 'tremshape');
|
||||||
/**
|
/**
|
||||||
* Filter overdrive for supported filter types
|
* filter overdrive for supported filter types
|
||||||
*
|
*
|
||||||
* @name drive
|
* @name drive
|
||||||
* @param {number | Pattern} amount
|
* @param {number | Pattern} amount
|
||||||
@@ -791,9 +556,7 @@ export const { tremoloshape } = registerControl('tremoloshape', 'tremshape');
|
|||||||
export const { drive } = registerControl('drive');
|
export const { drive } = registerControl('drive');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modulate the amplitude of an orbit to create a "sidechain" like effect.
|
* modulate the amplitude of an orbit to create a "sidechain" like effect
|
||||||
*
|
|
||||||
* Can be applied to multiple orbits with the ':' mininotation, e.g. `duckorbit("2:3")`
|
|
||||||
*
|
*
|
||||||
* @name duckorbit
|
* @name duckorbit
|
||||||
* @synonyms duck
|
* @synonyms duck
|
||||||
@@ -801,77 +564,30 @@ export const { drive } = registerControl('drive');
|
|||||||
* @example
|
* @example
|
||||||
* $: n(run(16)).scale("c:minor:pentatonic").s("sawtooth").delay(.7).orbit(2)
|
* $: n(run(16)).scale("c:minor:pentatonic").s("sawtooth").delay(.7).orbit(2)
|
||||||
* $: s("bd:4!4").beat("0,4,8,11,14",16).duckorbit(2).duckattack(0.2).duckdepth(1)
|
* $: s("bd:4!4").beat("0,4,8,11,14",16).duckorbit(2).duckattack(0.2).duckdepth(1)
|
||||||
* @example
|
|
||||||
* $: n(run(16)).scale("c:minor:pentatonic").s("sawtooth").delay(.7).orbit(2)
|
|
||||||
* $: s("hh*16").orbit(3)
|
|
||||||
* $: s("bd:4!4").beat("0,4,8,11,14",16).duckorbit("2:3").duckattack(0.2).duckdepth(1)
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
export const { duck } = registerControl('duckorbit', 'duck');
|
export const { duck } = registerControl('duckorbit', 'duck');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The amount of ducking applied to target orbit
|
* the amount of ducking applied to target orbit
|
||||||
*
|
|
||||||
* Can vary across orbits with the ':' mininotation, e.g. `duckdepth("0.3:0.1")`.
|
|
||||||
* Note: this requires first applying the effect to multiple orbits with e.g. `duckorbit("2:3")`.
|
|
||||||
*
|
*
|
||||||
* @name duckdepth
|
* @name duckdepth
|
||||||
* @param {number | Pattern} depth depth of modulation from 0 to 1
|
* @param {number | Pattern} depth depth of modulation from 0 to 1
|
||||||
* @example
|
* @example
|
||||||
* stack( n(run(8)).scale("c:minor").s("sawtooth").delay(.7).orbit(2), s("bd:4!4").beat("0,4,8,11,14",16).duckorbit(2).duckattack(0.2).duckdepth("<1 .9 .6 0>"))
|
* stack( n(run(8)).scale("c:minor").s("sawtooth").delay(.7).orbit(2), s("bd:4!4").beat("0,4,8,11,14",16).duckorbit(2).duckattack(0.2).duckdepth("<1 .9 .6 0>"))
|
||||||
* @example
|
|
||||||
* $: n(run(16)).scale("c:minor:pentatonic").s("sawtooth").delay(.7).orbit(2)
|
|
||||||
* $: s("hh*16").orbit(3)
|
|
||||||
* $: s("bd:4!4").beat("0,4,8,11,14",16).duckorbit("2:3").duckattack(0.2).duckdepth("1:0.5")
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export const { duckdepth } = registerControl('duckdepth');
|
export const { duckdepth } = registerControl('duckdepth');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The time required for the ducked signal(s) to reach their lowest volume.
|
* the attack time of the duck effect
|
||||||
* Can be used to prevent clicking or for creative rhythmic effects.
|
|
||||||
*
|
|
||||||
* Can vary across orbits with the ':' mininotation, e.g. `duckonset("0:0.003")`.
|
|
||||||
* Note: this requires first applying the effect to multiple orbits with e.g. `duckorbit("2:3")`.
|
|
||||||
*
|
|
||||||
* @name duckonset
|
|
||||||
* @synonyms duckons
|
|
||||||
*
|
|
||||||
* @param {number | Pattern} time The onset time in seconds
|
|
||||||
* @example
|
|
||||||
* // Clicks
|
|
||||||
* sound: freq("63.2388").s("sine").orbit(2).gain(4)
|
|
||||||
* duckerWithClick: s("bd*4").duckorbit(2).duckattack(0.3).duckonset(0).postgain(0)
|
|
||||||
* @example
|
|
||||||
* // No clicks
|
|
||||||
* sound: freq("63.2388").s("sine").orbit(2).gain(4)
|
|
||||||
* duckerWithoutClick: s("bd*4").duckorbit(2).duckattack(0.3).duckonset(0.01).postgain(0)
|
|
||||||
* @example
|
|
||||||
* // Rhythmic
|
|
||||||
* noise: s("pink").distort("2:1").orbit(4) // used rhythmically with 0.3 onset below
|
|
||||||
* hhat: s("hh*16").orbit(7)
|
|
||||||
* ducker: s("bd*4").bank("tr909").duckorbit("4:7").duckonset("0.3:0.003").duckattack(0.25)
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
export const { duckonset } = registerControl('duckonset', 'duckons');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The time required for the ducked signal(s) to return to their normal volume.
|
|
||||||
*
|
|
||||||
* Can vary across orbits with the ':' mininotation, e.g. `duckonset("0:0.003")`.
|
|
||||||
* Note: this requires first applying the effect to multiple orbits with e.g. `duckorbit("2:3")`.
|
|
||||||
*
|
*
|
||||||
* @name duckattack
|
* @name duckattack
|
||||||
* @synonyms duckatt
|
* @synonyms duckatt
|
||||||
*
|
* @param {number | Pattern} time
|
||||||
* @param {number | Pattern} time The attack time in seconds
|
|
||||||
* @example
|
* @example
|
||||||
* sound: n(run(8)).scale("c:minor").s("sawtooth").delay(.7).orbit(2)
|
* stack( n(run(8)).scale("c:minor").s("sawtooth").delay(.7).orbit(2), s("bd:4!4").beat("0,4,8,11,14",16).duckorbit(2).duckattack("<0.2 0 0.4>").duckdepth(1))
|
||||||
* ducker: s("bd:4!4").beat("0,4,8,11,14",16).duckorbit(2).duckattack("<0.2 0 0.4>").duckdepth(1)
|
|
||||||
* @example
|
|
||||||
* moreduck: n(run(8)).scale("c:minor").s("sawtooth").delay(.7).orbit(2)
|
|
||||||
* lessduck: s("hh*16").orbit(5)
|
|
||||||
* ducker: s("bd:4!4").beat("0,4,8,11,14",16).duckorbit("2:5").duckattack("0.4:0.1")
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
export const { duckattack } = registerControl('duckattack', 'duckatt');
|
export const { duckattack } = registerControl('duckattack', 'duckatt');
|
||||||
@@ -916,7 +632,7 @@ export const { byteBeatStartTime, bbst } = registerControl('byteBeatStartTime',
|
|||||||
export const { channels, ch } = registerControl('channels', 'ch');
|
export const { channels, ch } = registerControl('channels', 'ch');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controls the pulsewidth of the pulse oscillator
|
* controls the pulsewidth of the pulse oscillator
|
||||||
*
|
*
|
||||||
* @name pw
|
* @name pw
|
||||||
* @param {number | Pattern} pulsewidth
|
* @param {number | Pattern} pulsewidth
|
||||||
@@ -928,7 +644,7 @@ export const { channels, ch } = registerControl('channels', 'ch');
|
|||||||
export const { pw } = registerControl(['pw', 'pwrate', 'pwsweep']);
|
export const { pw } = registerControl(['pw', 'pwrate', 'pwsweep']);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controls the lfo rate for the pulsewidth of the pulse oscillator
|
* controls the lfo rate for the pulsewidth of the pulse oscillator
|
||||||
*
|
*
|
||||||
* @name pwrate
|
* @name pwrate
|
||||||
* @param {number | Pattern} rate
|
* @param {number | Pattern} rate
|
||||||
@@ -940,7 +656,7 @@ export const { pw } = registerControl(['pw', 'pwrate', 'pwsweep']);
|
|||||||
export const { pwrate } = registerControl('pwrate');
|
export const { pwrate } = registerControl('pwrate');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controls the lfo sweep for the pulsewidth of the pulse oscillator
|
* controls the lfo sweep for the pulsewidth of the pulse oscillator
|
||||||
*
|
*
|
||||||
* @name pwsweep
|
* @name pwsweep
|
||||||
* @param {number | Pattern} sweep
|
* @param {number | Pattern} sweep
|
||||||
@@ -1009,7 +725,7 @@ export const { phasercenter, phc } = registerControl('phasercenter', 'phc');
|
|||||||
export const { phaserdepth, phd, phasdp } = registerControl('phaserdepth', 'phd', 'phasdp');
|
export const { phaserdepth, phd, phasdp } = registerControl('phaserdepth', 'phd', 'phasdp');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Choose the channel the pattern is sent to in superdirt
|
* choose the channel the pattern is sent to in superdirt
|
||||||
*
|
*
|
||||||
* @name channel
|
* @name channel
|
||||||
* @param {number | Pattern} channel channel number
|
* @param {number | Pattern} channel channel number
|
||||||
@@ -1361,7 +1077,7 @@ export const { resonance, lpq } = registerControl('resonance', 'lpq');
|
|||||||
* @name djf
|
* @name djf
|
||||||
* @param {number | Pattern} cutoff below 0.5 is low pass filter, above is high pass filter
|
* @param {number | Pattern} cutoff below 0.5 is low pass filter, above is high pass filter
|
||||||
* @example
|
* @example
|
||||||
* n(irand(16).seg(8)).scale("d:phrygian").s("supersaw").djf("<.5 .3 .2 .75>")
|
* n("0 3 7 [10,24]").s('superzow').octave(3).djf("<.5 .25 .5 .75>").osc()
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
export const { djf } = registerControl('djf');
|
export const { djf } = registerControl('djf');
|
||||||
@@ -1887,52 +1603,19 @@ export const { roomsize, size, sz, rsize } = registerControl('roomsize', 'size',
|
|||||||
export const { shape } = registerControl(['shape', 'shapevol']);
|
export const { shape } = registerControl(['shape', 'shapevol']);
|
||||||
/**
|
/**
|
||||||
* Wave shaping distortion. CAUTION: it can get loud.
|
* Wave shaping distortion. CAUTION: it can get loud.
|
||||||
* Second option in optional array syntax (ex: ".9:.5") applies a postgain to the output. Third option sets the waveshaping type.
|
* Second option in optional array syntax (ex: ".9:.5") applies a postgain to the output.
|
||||||
* Most useful values are usually between 0 and 10 (depending on source gain). If you are feeling adventurous, you can turn it up to 11 and beyond ;)
|
* Most useful values are usually between 0 and 10 (depending on source gain). If you are feeling adventurous, you can turn it up to 11 and beyond ;)
|
||||||
*
|
*
|
||||||
* @name distort
|
* @name distort
|
||||||
* @synonyms dist
|
* @synonyms dist
|
||||||
* @param {number | Pattern} distortion amount of distortion to apply
|
* @param {number | Pattern} distortion
|
||||||
* @param {number | Pattern} volume linear postgain of the distortion
|
|
||||||
* @param {number | string | Pattern} type type of distortion to apply
|
|
||||||
* @example
|
* @example
|
||||||
* s("bd sd [~ bd] sd,hh*8").distort("<0 2 3 10:.5>")
|
* s("bd sd [~ bd] sd,hh*8").distort("<0 2 3 10:.5>")
|
||||||
* @example
|
* @example
|
||||||
* note("d1!8").s("sine").penv(36).pdecay(.12).decay(.23).distort("8:.4")
|
* note("d1!8").s("sine").penv(36).pdecay(.12).decay(.23).distort("8:.4")
|
||||||
* @example
|
|
||||||
* s("bd:4*4").bank("tr808").distort("3:0.5:diode")
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
export const { distort, dist } = registerControl(['distort', 'distortvol', 'distorttype'], 'dist');
|
export const { distort, dist } = registerControl(['distort', 'distortvol'], 'dist');
|
||||||
|
|
||||||
/**
|
|
||||||
* Postgain for waveshaping distortion.
|
|
||||||
*
|
|
||||||
* @name distortvol
|
|
||||||
* @synonyms distvol
|
|
||||||
* @param {number | Pattern} volume linear postgain of the distortion
|
|
||||||
* @example
|
|
||||||
* s("bd*4").bank("tr909").distort(2).distortvol(0.8)
|
|
||||||
*/
|
|
||||||
export const { distortvol } = registerControl('distortvol', 'distvol');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Type of waveshaping distortion to apply.
|
|
||||||
*
|
|
||||||
* @name distorttype
|
|
||||||
* @synonyms disttype
|
|
||||||
* @param {number | string | Pattern} type type of distortion to apply
|
|
||||||
* @example
|
|
||||||
* s("bd*4").bank("tr909").distort(2).distorttype("<0 1 2>")
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* s("sine").note("F1*2").release(1)
|
|
||||||
* .penv(24).pdecay(0.05)
|
|
||||||
* .distort(rand.range(1, 8))
|
|
||||||
* .distorttype("<fold chebyshev scurve diode asym sinefold>")
|
|
||||||
*/
|
|
||||||
export const { distorttype } = registerControl('distorttype', 'disttype');
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dynamics Compressor. The params are `compressor("threshold:ratio:knee:attack:release")`
|
* Dynamics Compressor. The params are `compressor("threshold:ratio:knee:attack:release")`
|
||||||
* More info [here](https://developer.mozilla.org/en-US/docs/Web/API/DynamicsCompressorNode?retiredLocale=de#instance_properties)
|
* More info [here](https://developer.mozilla.org/en-US/docs/Web/API/DynamicsCompressorNode?retiredLocale=de#instance_properties)
|
||||||
@@ -2320,24 +2003,6 @@ export const { miditouch } = registerControl('miditouch');
|
|||||||
// TODO: what is this?
|
// TODO: what is this?
|
||||||
export const { polyTouch } = registerControl('polyTouch');
|
export const { polyTouch } = registerControl('polyTouch');
|
||||||
|
|
||||||
/**
|
|
||||||
* The host to send open sound control messages to. Requires running the OSC bridge.
|
|
||||||
* @name oschost
|
|
||||||
* @param {string | Pattern} oschost e.g. 'localhost'
|
|
||||||
* @example
|
|
||||||
* note("c4").oschost('127.0.0.1').oscport(57120).osc();
|
|
||||||
*/
|
|
||||||
export const { oschost } = registerControl('oschost');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The port to send open sound control messages to. Requires running the OSC bridge.
|
|
||||||
* @name oscport
|
|
||||||
* @param {number | Pattern} oscport e.g. 57120
|
|
||||||
* @example
|
|
||||||
* note("c4").oschost('127.0.0.1').oscport(57120).osc();
|
|
||||||
*/
|
|
||||||
export const { oscport } = registerControl('oscport');
|
|
||||||
|
|
||||||
export const getControlName = (alias) => {
|
export const getControlName = (alias) => {
|
||||||
if (controlAlias.has(alias)) {
|
if (controlAlias.has(alias)) {
|
||||||
return controlAlias.get(alias);
|
return controlAlias.get(alias);
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ export class Cyclist {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// query the pattern for events
|
// query the pattern for events
|
||||||
const haps = this.pattern.queryArc(begin, end, { _cps: this.cps, cyclist: 'cyclist' });
|
const haps = this.pattern.queryArc(begin, end, { _cps: this.cps });
|
||||||
|
|
||||||
haps.forEach((hap) => {
|
haps.forEach((hap) => {
|
||||||
if (hap.hasOnset()) {
|
if (hap.hasOnset()) {
|
||||||
|
|||||||
@@ -126,8 +126,6 @@ export const lcm = (...fractions) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const isFraction = (x) => x instanceof Fraction;
|
|
||||||
|
|
||||||
fraction._original = Fraction;
|
fraction._original = Fraction;
|
||||||
|
|
||||||
export default fraction;
|
export default fraction;
|
||||||
|
|||||||
@@ -5,9 +5,8 @@ let debounce = 1000,
|
|||||||
lastTime;
|
lastTime;
|
||||||
|
|
||||||
export function errorLogger(e, origin = 'cyclist') {
|
export function errorLogger(e, origin = 'cyclist') {
|
||||||
if (process.env.NODE_ENV === 'development') {
|
//TODO: add some kind of debug flag that enables this while in dev mode
|
||||||
console.error(e);
|
// console.error(e);
|
||||||
}
|
|
||||||
logger(`[${origin}] error: ${e.message}`);
|
logger(`[${origin}] error: ${e.message}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,8 @@ export class NeoCyclist {
|
|||||||
if (this.started === false) {
|
if (this.started === false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const haps = this.pattern.queryArc(begin, end, { _cps: this.cps, cyclist: 'neocyclist' });
|
|
||||||
|
const haps = this.pattern.queryArc(begin, end, { _cps: this.cps });
|
||||||
haps.forEach((hap) => {
|
haps.forEach((hap) => {
|
||||||
if (hap.hasOnset()) {
|
if (hap.hasOnset()) {
|
||||||
const timeUntilTrigger = cycleToSeconds(hap.whole.begin - this.cycle, this.cps);
|
const timeUntilTrigger = cycleToSeconds(hap.whole.begin - this.cycle, this.cps);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@strudel/core",
|
"name": "@strudel/core",
|
||||||
"version": "1.2.5",
|
"version": "1.2.4",
|
||||||
"description": "Port of Tidal Cycles to JavaScript",
|
"description": "Port of Tidal Cycles to JavaScript",
|
||||||
"main": "index.mjs",
|
"main": "index.mjs",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
+34
-100
@@ -5,7 +5,7 @@ This program is free software: you can redistribute it and/or modify it under th
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import TimeSpan from './timespan.mjs';
|
import TimeSpan from './timespan.mjs';
|
||||||
import Fraction, { isFraction, lcm } from './fraction.mjs';
|
import Fraction, { lcm } from './fraction.mjs';
|
||||||
import Hap from './hap.mjs';
|
import Hap from './hap.mjs';
|
||||||
import State from './state.mjs';
|
import State from './state.mjs';
|
||||||
import { unionWithObj } from './value.mjs';
|
import { unionWithObj } from './value.mjs';
|
||||||
@@ -98,7 +98,10 @@ export class Pattern {
|
|||||||
|
|
||||||
// runs func on query state
|
// runs func on query state
|
||||||
withState(func) {
|
withState(func) {
|
||||||
return new Pattern((state) => this.query(func(state)));
|
return this.withHaps((haps, state) => {
|
||||||
|
func(state);
|
||||||
|
return haps;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -996,7 +999,7 @@ addToPrototype('weaveWith', function (t, ...funcs) {
|
|||||||
// compose matrix functions
|
// compose matrix functions
|
||||||
|
|
||||||
function _nonArrayObject(x) {
|
function _nonArrayObject(x) {
|
||||||
return !Array.isArray(x) && typeof x === 'object' && !isFraction(x);
|
return !Array.isArray(x) && typeof x === 'object';
|
||||||
}
|
}
|
||||||
function _composeOp(a, b, func) {
|
function _composeOp(a, b, func) {
|
||||||
if (_nonArrayObject(a) || _nonArrayObject(b)) {
|
if (_nonArrayObject(a) || _nonArrayObject(b)) {
|
||||||
@@ -2351,20 +2354,42 @@ export const jux = register('jux', function (func, pat) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Superimpose and offset multiple times, applying the given function each time.
|
* Superimpose and offset multiple times, applying the given function each time.
|
||||||
* @name echoWith
|
* @name echoForEach
|
||||||
* @synonyms echowith, stutWith, stutwith
|
|
||||||
* @param {number} times how many times to repeat
|
* @param {number} times how many times to repeat
|
||||||
* @param {number} time cycle offset between iterations
|
* @param {number} time cycle offset between iterations
|
||||||
* @param {function} func function to apply, given the pattern and the iteration index
|
* @param {function} func function to apply, given the pattern and the iteration index
|
||||||
* @example
|
* @example
|
||||||
* "<0 [2 4]>"
|
* "<0 [2 4]>"
|
||||||
* .echoWith(4, 1/8, (p,n) => p.add(n*2))
|
* .echoWith(4, 1/8, (p,n) => p.add(n*2))
|
||||||
* .scale("C:minor").note()
|
* .n().scale("C:minor")
|
||||||
|
*/
|
||||||
|
export const { echoForEach } = register(['echoForEach'], function (times, time, func, pat) {
|
||||||
|
return stack(...listRange(0, times - 1).map((i) => func(pat.late(Fraction(time).mul(i)), i)));
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Superimpose and offset multiple times, applying the given function each time.
|
||||||
|
* @name echoWith
|
||||||
|
* @synonyms echowith, stutWith, stutwith
|
||||||
|
* @param {number} times how many times to repeat
|
||||||
|
* @param {number} time cycle offset between iterations
|
||||||
|
* @param {function} func function to apply, given the pattern and the iteration index
|
||||||
|
* @example
|
||||||
|
* "<0 [2 4]>".echoWith(4, 1/8, add(2))
|
||||||
|
* .n().scale("C:minor")
|
||||||
*/
|
*/
|
||||||
export const { echoWith, echowith, stutWith, stutwith } = register(
|
export const { echoWith, echowith, stutWith, stutwith } = register(
|
||||||
['echoWith', 'echowith', 'stutWith', 'stutwith'],
|
['echoWith', 'echowith', 'stutWith', 'stutwith'],
|
||||||
function (times, time, func, pat) {
|
function (times, time, func, pat) {
|
||||||
return stack(...listRange(0, times - 1).map((i) => func(pat.late(Fraction(time).mul(i)), i)));
|
if (times < 1) {
|
||||||
|
return silence;
|
||||||
|
}
|
||||||
|
let pats = pat;
|
||||||
|
for (let i = 1; i < times; i++) {
|
||||||
|
pat = func(pat.late(time));
|
||||||
|
pats = pats.stack(pat);
|
||||||
|
}
|
||||||
|
return pats;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -2380,7 +2405,7 @@ export const { echoWith, echowith, stutWith, stutwith } = register(
|
|||||||
* s("bd sd").echo(3, 1/6, .8)
|
* s("bd sd").echo(3, 1/6, .8)
|
||||||
*/
|
*/
|
||||||
export const echo = register('echo', function (times, time, feedback, pat) {
|
export const echo = register('echo', function (times, time, feedback, pat) {
|
||||||
return pat._echoWith(times, time, (pat, i) => pat.gain(Math.pow(feedback, i)));
|
return pat._echoForEach(times, time, (pat, i) => pat.gain(Math.pow(feedback, i)));
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2393,7 +2418,7 @@ export const echo = register('echo', function (times, time, feedback, pat) {
|
|||||||
* s("bd sd").stut(3, .8, 1/6)
|
* s("bd sd").stut(3, .8, 1/6)
|
||||||
*/
|
*/
|
||||||
export const stut = register('stut', function (times, feedback, time, pat) {
|
export const stut = register('stut', function (times, feedback, time, pat) {
|
||||||
return pat._echoWith(times, time, (pat, i) => pat.gain(Math.pow(feedback, i)));
|
return pat._echoForEach(times, time, (pat, i) => pat.gain(Math.pow(feedback, i)));
|
||||||
});
|
});
|
||||||
|
|
||||||
export const applyN = register('applyN', function (n, func, p) {
|
export const applyN = register('applyN', function (n, func, p) {
|
||||||
@@ -2998,24 +3023,6 @@ export const extend = stepRegister('extend', function (factor, pat) {
|
|||||||
return pat.fast(factor).expand(factor);
|
return pat.fast(factor).expand(factor);
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
|
||||||
* *Experimental*
|
|
||||||
*
|
|
||||||
* `replicate` is similar to `fast` in that it increases its density, but it also increases the step count
|
|
||||||
* accordingly. So `stepcat("a b".replicate(2), "c d")` would be the same as `"a b a b c d"`, whereas
|
|
||||||
* `stepcat("a b".fast(2), "c d")` would be the same as `"[a b] [a b] c d"`.
|
|
||||||
*
|
|
||||||
* TODO: find out how this function differs from extend
|
|
||||||
* @example
|
|
||||||
* stepcat(
|
|
||||||
* sound("bd bd - cp").replicate(2),
|
|
||||||
* sound("bd - sd -")
|
|
||||||
* ).pace(8)
|
|
||||||
*/
|
|
||||||
export const replicate = stepRegister('replicate', function (factor, pat) {
|
|
||||||
return pat.repeatCycles(factor).fast(factor).expand(factor);
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* *Experimental*
|
* *Experimental*
|
||||||
*
|
*
|
||||||
@@ -3551,76 +3558,3 @@ export const morph = (frompat, topat, bypat) => {
|
|||||||
bypat = reify(bypat);
|
bypat = reify(bypat);
|
||||||
return frompat.innerBind((from) => topat.innerBind((to) => bypat.innerBind((by) => _morph(from, to, by))));
|
return frompat.innerBind((from) => topat.innerBind((to) => bypat.innerBind((by) => _morph(from, to, by))));
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Soft-clipping distortion
|
|
||||||
*
|
|
||||||
* @name soft
|
|
||||||
* @param {number | Pattern} distortion amount of distortion to apply
|
|
||||||
* @param {number | Pattern} volume linear postgain of the distortion
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* Hard-clipping distortion
|
|
||||||
*
|
|
||||||
* @name hard
|
|
||||||
* @param {number | Pattern} distortion amount of distortion to apply
|
|
||||||
* @param {number | Pattern} volume linear postgain of the distortion
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* Cubic polynomial distortion
|
|
||||||
*
|
|
||||||
* @name cubic
|
|
||||||
* @param {number | Pattern} distortion amount of distortion to apply
|
|
||||||
* @param {number | Pattern} volume linear postgain of the distortion
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* Diode-emulating distortion
|
|
||||||
*
|
|
||||||
* @name diode
|
|
||||||
* @param {number | Pattern} distortion amount of distortion to apply
|
|
||||||
* @param {number | Pattern} volume linear postgain of the distortion
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* Asymmetrical diode distortion
|
|
||||||
*
|
|
||||||
* @name asym
|
|
||||||
* @param {number | Pattern} distortion amount of distortion to apply
|
|
||||||
* @param {number | Pattern} volume linear postgain of the distortion
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* Wavefolding distortion
|
|
||||||
*
|
|
||||||
* @name fold
|
|
||||||
* @param {number | Pattern} distortion amount of distortion to apply
|
|
||||||
* @param {number | Pattern} volume linear postgain of the distortion
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* Wavefolding distortion composed with sinusoid
|
|
||||||
*
|
|
||||||
* @name sinefold
|
|
||||||
* @param {number | Pattern} distortion amount of distortion to apply
|
|
||||||
* @param {number | Pattern} volume linear postgain of the distortion
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* Distortion via Chebyshev polynomials
|
|
||||||
*
|
|
||||||
* @name chebyshev
|
|
||||||
* @param {number | Pattern} distortion amount of distortion to apply
|
|
||||||
* @param {number | Pattern} volume linear postgain of the distortion
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
const distAlgoNames = ['scurve', 'soft', 'hard', 'cubic', 'diode', 'asym', 'fold', 'sinefold', 'chebyshev'];
|
|
||||||
for (const name of distAlgoNames) {
|
|
||||||
// Add aliases for distortion algorithms
|
|
||||||
Pattern.prototype[name] = function (args) {
|
|
||||||
const argsPat = reify(args).fmap((v) => (Array.isArray(v) ? [...v, name] : [v, 1, name]));
|
|
||||||
return this.distort(argsPat);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|||||||
+3
-21
@@ -74,14 +74,6 @@ export function repl({
|
|||||||
return silence;
|
return silence;
|
||||||
};
|
};
|
||||||
|
|
||||||
// helper to get a patternified pure value out
|
|
||||||
function unpure(pat) {
|
|
||||||
if (pat._Pattern) {
|
|
||||||
return pat.__pure;
|
|
||||||
}
|
|
||||||
return pat;
|
|
||||||
}
|
|
||||||
|
|
||||||
const setPattern = async (pattern, autostart = true) => {
|
const setPattern = async (pattern, autostart = true) => {
|
||||||
pattern = editPattern?.(pattern) || pattern;
|
pattern = editPattern?.(pattern) || pattern;
|
||||||
await scheduler.setPattern(pattern, autostart);
|
await scheduler.setPattern(pattern, autostart);
|
||||||
@@ -93,10 +85,7 @@ export function repl({
|
|||||||
const start = () => scheduler.start();
|
const start = () => scheduler.start();
|
||||||
const pause = () => scheduler.pause();
|
const pause = () => scheduler.pause();
|
||||||
const toggle = () => scheduler.toggle();
|
const toggle = () => scheduler.toggle();
|
||||||
const setCps = (cps) => {
|
const setCps = (cps) => scheduler.setCps(cps);
|
||||||
scheduler.setCps(unpure(cps));
|
|
||||||
return silence;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Changes the global tempo to the given cycles per minute
|
* Changes the global tempo to the given cycles per minute
|
||||||
@@ -108,10 +97,7 @@ export function repl({
|
|||||||
* setcpm(140/4) // =140 bpm in 4/4
|
* setcpm(140/4) // =140 bpm in 4/4
|
||||||
* $: s("bd*4,[- sd]*2").bank('tr707')
|
* $: s("bd*4,[- sd]*2").bank('tr707')
|
||||||
*/
|
*/
|
||||||
const setCpm = (cpm) => {
|
const setCpm = (cpm) => scheduler.setCps(cpm / 60);
|
||||||
scheduler.setCps(unpure(cpm) / 60);
|
|
||||||
return silence;
|
|
||||||
};
|
|
||||||
|
|
||||||
// TODO - not documented as jsdoc examples as the test framework doesn't simulate enough context for `each` and `all`..
|
// TODO - not documented as jsdoc examples as the test framework doesn't simulate enough context for `each` and `all`..
|
||||||
|
|
||||||
@@ -214,10 +200,7 @@ export function repl({
|
|||||||
}
|
}
|
||||||
let { pattern, meta } = await _evaluate(code, transpiler, transpilerOptions);
|
let { pattern, meta } = await _evaluate(code, transpiler, transpilerOptions);
|
||||||
if (Object.keys(pPatterns).length) {
|
if (Object.keys(pPatterns).length) {
|
||||||
let patterns = [];
|
let patterns = Object.values(pPatterns);
|
||||||
for (const [key, value] of Object.entries(pPatterns)) {
|
|
||||||
patterns.push(value.withState((state) => state.setControls({ id: key })));
|
|
||||||
}
|
|
||||||
if (eachTransform) {
|
if (eachTransform) {
|
||||||
// Explicit lambda so only element (not index and array) are passed
|
// Explicit lambda so only element (not index and array) are passed
|
||||||
patterns = patterns.map((x) => eachTransform(x));
|
patterns = patterns.map((x) => eachTransform(x));
|
||||||
@@ -231,7 +214,6 @@ export function repl({
|
|||||||
pattern = allTransforms[i](pattern);
|
pattern = allTransforms[i](pattern);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isPattern(pattern)) {
|
if (!isPattern(pattern)) {
|
||||||
const message = `got "${typeof evaluated}" instead of pattern`;
|
const message = `got "${typeof evaluated}" instead of pattern`;
|
||||||
throw new Error(message + (typeof evaluated === 'function' ? ', did you forget to call a function?' : '.'));
|
throw new Error(message + (typeof evaluated === 'function' ? ', did you forget to call a function?' : '.'));
|
||||||
|
|||||||
@@ -19,9 +19,9 @@ export class State {
|
|||||||
return this.setSpan(func(this.span));
|
return this.setSpan(func(this.span));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns new State with added controls.
|
// Returns new State with different controls
|
||||||
setControls(controls) {
|
setControls(controls) {
|
||||||
return new State(this.span, { ...this.controls, ...controls });
|
return new State(this.span, controls);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,12 +8,12 @@ import { logger } from './logger.mjs';
|
|||||||
|
|
||||||
// returns true if the given string is a note
|
// returns true if the given string is a note
|
||||||
export const isNoteWithOctave = (name) => /^[a-gA-G][#bs]*[0-9]$/.test(name);
|
export const isNoteWithOctave = (name) => /^[a-gA-G][#bs]*[0-9]$/.test(name);
|
||||||
export const isNote = (name) => /^[a-gA-G][#bsf]*-?[0-9]?$/.test(name);
|
export const isNote = (name) => /^[a-gA-G][#bsf]*[0-9]?$/.test(name);
|
||||||
export const tokenizeNote = (note) => {
|
export const tokenizeNote = (note) => {
|
||||||
if (typeof note !== 'string') {
|
if (typeof note !== 'string') {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
const [pc, acc = '', oct] = note.match(/^([a-gA-G])([#bsf]*)(-?[0-9]*)$/)?.slice(1) || [];
|
const [pc, acc = '', oct] = note.match(/^([a-gA-G])([#bsf]*)([0-9]*)$/)?.slice(1) || [];
|
||||||
if (!pc) {
|
if (!pc) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@strudel/csound",
|
"name": "@strudel/csound",
|
||||||
"version": "1.2.6",
|
"version": "1.2.5",
|
||||||
"description": "csound bindings for strudel",
|
"description": "csound bindings for strudel",
|
||||||
"main": "index.mjs",
|
"main": "index.mjs",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
@@ -84,18 +84,9 @@ Pattern.prototype.onPaint = function (painter) {
|
|||||||
state.controls.painters = [];
|
state.controls.painters = [];
|
||||||
}
|
}
|
||||||
state.controls.painters.push(painter);
|
state.controls.painters.push(painter);
|
||||||
return state;
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO - Why isn't this pure deep copy not working?
|
|
||||||
// Pattern.prototype.onPaint = function (painter) {
|
|
||||||
// return this.withState((state) => {
|
|
||||||
// const painters = state.controls.painters ? [...state.controls.painters, painter] : [painter];
|
|
||||||
// return new State(state.span, { ...state.controls, painters });
|
|
||||||
// });
|
|
||||||
// };
|
|
||||||
|
|
||||||
Pattern.prototype.getPainters = function () {
|
Pattern.prototype.getPainters = function () {
|
||||||
let painters = [];
|
let painters = [];
|
||||||
this.queryArc(0, 0, { painters });
|
this.queryArc(0, 0, { painters });
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@strudel/draw",
|
"name": "@strudel/draw",
|
||||||
"version": "1.2.5",
|
"version": "1.2.4",
|
||||||
"description": "Helpers for drawing with Strudel",
|
"description": "Helpers for drawing with Strudel",
|
||||||
"main": "index.mjs",
|
"main": "index.mjs",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@strudel/gamepad",
|
"name": "@strudel/gamepad",
|
||||||
"version": "1.2.5",
|
"version": "1.2.4",
|
||||||
"description": "Gamepad Inputs for strudel",
|
"description": "Gamepad Inputs for strudel",
|
||||||
"main": "index.mjs",
|
"main": "index.mjs",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@strudel/hydra",
|
"name": "@strudel/hydra",
|
||||||
"version": "1.2.5",
|
"version": "1.2.4",
|
||||||
"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.2.6",
|
"version": "1.2.5",
|
||||||
"description": "Midi API for strudel",
|
"description": "Midi API for strudel",
|
||||||
"main": "index.mjs",
|
"main": "index.mjs",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@strudel/mini",
|
"name": "@strudel/mini",
|
||||||
"version": "1.2.5",
|
"version": "1.2.4",
|
||||||
"description": "Mini notation for strudel",
|
"description": "Mini notation for strudel",
|
||||||
"main": "index.mjs",
|
"main": "index.mjs",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import {
|
|||||||
slow,
|
slow,
|
||||||
seq,
|
seq,
|
||||||
stepcat,
|
stepcat,
|
||||||
replicate,
|
extend,
|
||||||
expand,
|
expand,
|
||||||
pace,
|
pace,
|
||||||
chooseIn,
|
chooseIn,
|
||||||
@@ -36,7 +36,7 @@ lib.square = (...args) => stepcat(...args).setSteps(1);
|
|||||||
lib.angle = (...args) => stepcat(...args).pace(1);
|
lib.angle = (...args) => stepcat(...args).pace(1);
|
||||||
lib['*'] = fast;
|
lib['*'] = fast;
|
||||||
lib['/'] = slow;
|
lib['/'] = slow;
|
||||||
lib['!'] = replicate;
|
lib['!'] = extend;
|
||||||
lib['@'] = expand;
|
lib['@'] = expand;
|
||||||
lib['%'] = pace;
|
lib['%'] = pace;
|
||||||
lib['?'] = degradeBy; // todo: default 0.5 not working..
|
lib['?'] = degradeBy; // todo: default 0.5 not working..
|
||||||
@@ -85,7 +85,7 @@ function evaluator(node, scope) {
|
|||||||
let pat;
|
let pat;
|
||||||
if (type === 'plain' && typeof variable !== 'undefined') {
|
if (type === 'plain' && typeof variable !== 'undefined') {
|
||||||
// some function names are not patternable, so we skip reification here
|
// some function names are not patternable, so we skip reification here
|
||||||
if (['!', 'extend', '@', 'expand', 'square', 'angle', 'all', 'setcpm', 'setcps'].includes(value)) {
|
if (['!', 'extend', '@', 'expand', 'square', 'angle'].includes(value)) {
|
||||||
return variable;
|
return variable;
|
||||||
}
|
}
|
||||||
pat = reify(variable);
|
pat = reify(variable);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@strudel/mondo",
|
"name": "@strudel/mondo",
|
||||||
"version": "1.1.5",
|
"version": "1.1.4",
|
||||||
"description": "mondo notation for strudel",
|
"description": "mondo notation for strudel",
|
||||||
"main": "mondough.mjs",
|
"main": "mondough.mjs",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@strudel/motion",
|
"name": "@strudel/motion",
|
||||||
"version": "1.2.5",
|
"version": "1.2.4",
|
||||||
"description": "DeviceMotion API for strudel",
|
"description": "DeviceMotion API for strudel",
|
||||||
"main": "index.mjs",
|
"main": "index.mjs",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ Pattern.prototype.mqtt = function (
|
|||||||
cx.connect(props);
|
cx.connect(props);
|
||||||
}
|
}
|
||||||
return this.withHap((hap) => {
|
return this.withHap((hap) => {
|
||||||
const onTrigger = (hap, currentTime, cps, targetTime) => {
|
const onTrigger = (t_deprecate, hap, currentTime, cps, targetTime) => {
|
||||||
let msg_topic = topic;
|
let msg_topic = topic;
|
||||||
if (!cx || !cx.isConnected()) {
|
if (!cx || !cx.isConnected()) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@strudel/mqtt",
|
"name": "@strudel/mqtt",
|
||||||
"version": "1.2.5",
|
"version": "1.2.4",
|
||||||
"description": "MQTT API for strudel",
|
"description": "MQTT API for strudel",
|
||||||
"main": "mqtt.mjs",
|
"main": "mqtt.mjs",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
+16
-26
@@ -4,13 +4,21 @@ OSC output for strudel patterns! Currently only tested with super collider / sup
|
|||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
Assuming you have [node.js](https://nodejs.org/) installed, you can run the osc bridge server via:
|
OSC will only work if you run the REPL locally + the OSC server besides it:
|
||||||
|
|
||||||
```sh
|
From the project root:
|
||||||
npx @strudel/osc
|
|
||||||
|
```js
|
||||||
|
npm run repl
|
||||||
```
|
```
|
||||||
|
|
||||||
You should see something like:
|
and in a seperate shell:
|
||||||
|
|
||||||
|
```js
|
||||||
|
npm run osc
|
||||||
|
```
|
||||||
|
|
||||||
|
This should give you
|
||||||
|
|
||||||
```log
|
```log
|
||||||
osc client running on port 57120
|
osc client running on port 57120
|
||||||
@@ -18,32 +26,14 @@ osc server running on port 57121
|
|||||||
websocket server running on port 8080
|
websocket server running on port 8080
|
||||||
```
|
```
|
||||||
|
|
||||||
### --port
|
Now open Supercollider (with the super dirt startup file)
|
||||||
|
|
||||||
By default it will use port 57120 for the osc client, which is what [superdirt](https://github.com/musikinformatik/SuperDirt) uses. You can change it via the `--port` option:
|
Now open the REPL and type:
|
||||||
|
|
||||||
```sh
|
|
||||||
npx @strudel/osc --port 7771 # classic dirt
|
|
||||||
```
|
|
||||||
|
|
||||||
### --debug
|
|
||||||
|
|
||||||
To log all incoming osc messages, add the `--debug` flag:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
npx @strudel/osc --debug
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage in Strudel
|
|
||||||
|
|
||||||
To test it in strudel, you have can use `all(osc)` to send all events through osc:
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
$: s("bd*4")
|
s("<bd sd> hh").osc()
|
||||||
|
|
||||||
all(osc)
|
|
||||||
```
|
```
|
||||||
|
|
||||||
[open in repl](https://strudel.cc/#JDogcygiYmQqNCIpCgphbGwob3NjKQ%3D%3D)
|
or just [click here](https://strudel.cc/#cygiPGJkIHNkPiBoaCIpLm9zYygp)...
|
||||||
|
|
||||||
You can read more about [how to use Superdirt with Strudel the Tutorial](https://strudel.cc/learn/input-output/#superdirt-api)
|
You can read more about [how to use Superdirt with Strudel the Tutorial](https://strudel.cc/learn/input-output/#superdirt-api)
|
||||||
|
|||||||
+20
-19
@@ -4,25 +4,28 @@ Copyright (C) 2022 Strudel contributors - see <https://codeberg.org/uzu/strudel/
|
|||||||
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { logger, parseNumeral, register, isNote, noteToMidi, ClockCollator } from '@strudel/core';
|
import OSC from 'osc-js';
|
||||||
|
|
||||||
|
import { logger, parseNumeral, Pattern, isNote, noteToMidi, ClockCollator } from '@strudel/core';
|
||||||
|
|
||||||
let connection; // Promise<OSC>
|
let connection; // Promise<OSC>
|
||||||
function connect() {
|
function connect() {
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
// make sure this runs only once
|
// make sure this runs only once
|
||||||
connection = new Promise((resolve, reject) => {
|
connection = new Promise((resolve, reject) => {
|
||||||
const ws = new WebSocket('ws://localhost:8080');
|
const osc = new OSC();
|
||||||
ws.addEventListener('open', (event) => {
|
osc.open();
|
||||||
logger(`[osc] websocket connected`);
|
osc.on('open', () => {
|
||||||
resolve(ws);
|
const url = osc.options?.plugin?.socket?.url;
|
||||||
|
logger(`[osc] connected${url ? ` to ${url}` : ''}`);
|
||||||
|
resolve(osc);
|
||||||
});
|
});
|
||||||
ws.addEventListener('close', (event) => {
|
osc.on('close', () => {
|
||||||
logger(`[osc] websocket closed`);
|
|
||||||
connection = undefined; // allows new connection afterwards
|
connection = undefined; // allows new connection afterwards
|
||||||
console.log('[osc] disconnected');
|
console.log('[osc] disconnected');
|
||||||
reject('OSC connection closed');
|
reject('OSC connection closed');
|
||||||
});
|
});
|
||||||
ws.addEventListener('error', (err) => reject(err));
|
osc.on('error', (err) => reject(err));
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
connection = undefined;
|
connection = undefined;
|
||||||
throw new Error('Could not connect to OSC server. Is it running?');
|
throw new Error('Could not connect to OSC server. Is it running?');
|
||||||
@@ -58,19 +61,15 @@ export function parseControlsFromHap(hap, cps) {
|
|||||||
const collator = new ClockCollator({});
|
const collator = new ClockCollator({});
|
||||||
|
|
||||||
export async function oscTrigger(hap, currentTime, cps = 1, targetTime) {
|
export async function oscTrigger(hap, currentTime, cps = 1, targetTime) {
|
||||||
const ws = await connect();
|
const osc = await connect();
|
||||||
const controls = parseControlsFromHap(hap, cps);
|
const controls = parseControlsFromHap(hap, cps);
|
||||||
const keyvals = Object.entries(controls).flat();
|
const keyvals = Object.entries(controls).flat();
|
||||||
const ts = collator.calculateTimestamp(currentTime, targetTime) * 1000;
|
|
||||||
const msg = { address: '/dirt/play', args: keyvals, timestamp: ts };
|
|
||||||
|
|
||||||
if ('oschost' in hap.value) {
|
const ts = Math.round(collator.calculateTimestamp(currentTime, targetTime) * 1000);
|
||||||
msg['host'] = hap.value['oschost'];
|
const message = new OSC.Message('/dirt/play', ...keyvals);
|
||||||
}
|
const bundle = new OSC.Bundle([message], ts);
|
||||||
if ('oscport' in hap.value) {
|
bundle.timestamp(ts); // workaround for https://github.com/adzialocha/osc-js/issues/60
|
||||||
msg['port'] = hap.value['oscport'];
|
osc.send(bundle);
|
||||||
}
|
|
||||||
ws.send(JSON.stringify(msg));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -82,4 +81,6 @@ export async function oscTrigger(hap, currentTime, cps = 1, targetTime) {
|
|||||||
* @memberof Pattern
|
* @memberof Pattern
|
||||||
* @returns Pattern
|
* @returns Pattern
|
||||||
*/
|
*/
|
||||||
export const osc = register('osc', (pat) => pat.onTrigger(oscTrigger));
|
Pattern.prototype.osc = function () {
|
||||||
|
return this.onTrigger(oscTrigger);
|
||||||
|
};
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name": "@strudel/osc",
|
"name": "@strudel/osc",
|
||||||
"version": "1.3.0",
|
"version": "1.2.4",
|
||||||
"description": "OSC messaging for strudel",
|
"description": "OSC messaging for strudel",
|
||||||
"main": "osc.mjs",
|
"main": "osc.mjs",
|
||||||
"bin": "./server.js",
|
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"main": "dist/index.mjs"
|
"main": "dist/index.mjs"
|
||||||
@@ -38,8 +37,7 @@
|
|||||||
"homepage": "https://codeberg.org/uzu/strudel#readme",
|
"homepage": "https://codeberg.org/uzu/strudel#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@strudel/core": "workspace:*",
|
"@strudel/core": "workspace:*",
|
||||||
"osc": "^2.4.5",
|
"osc-js": "^2.4.1"
|
||||||
"ws": "^8.18.3"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"pkg": "^5.8.1",
|
"pkg": "^5.8.1",
|
||||||
|
|||||||
Executable → Regular
+24
-54
@@ -1,64 +1,34 @@
|
|||||||
#!/usr/bin/env node
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
server.js - <short description TODO>
|
server.js - <short description TODO>
|
||||||
Copyright (C) 2022 Strudel contributors - see <https://codeberg.org/uzu/strudel/src/branch/main/packages/osc/server.js>
|
Copyright (C) 2022 Strudel contributors - see <https://codeberg.org/uzu/strudel/src/branch/main/packages/osc/server.js>
|
||||||
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';
|
import OSC from 'osc-js';
|
||||||
|
|
||||||
import { WebSocketServer } from 'ws';
|
const config = {
|
||||||
import osc from 'osc';
|
receiver: 'ws', // @param {string} Where messages sent via 'send' method will be delivered to, 'ws' for Websocket clients, 'udp' for udp client
|
||||||
|
udpServer: {
|
||||||
|
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
|
||||||
|
},
|
||||||
|
udpClient: {
|
||||||
|
host: 'localhost', // @param {string} Hostname of udp client for messaging
|
||||||
|
port: 57120, // @param {number} Port of udp client for messaging
|
||||||
|
},
|
||||||
|
wsServer: {
|
||||||
|
host: 'localhost', // @param {string} Hostname of WebSocket server
|
||||||
|
port: 8080, // @param {number} Port of WebSocket server
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
const WS_PORT = 8080; // WebSocket server port
|
const osc = new OSC({ plugin: new OSC.BridgePlugin(config) });
|
||||||
const OSC_REMOTE_IP = '127.0.0.1';
|
|
||||||
const OSC_REMOTE_PORT = 57120;
|
|
||||||
|
|
||||||
const udpPort = new osc.UDPPort({
|
osc.open(); // start a WebSocket server on port 8080
|
||||||
localAddress: '0.0.0.0',
|
|
||||||
localPort: 0,
|
|
||||||
remoteAddress: OSC_REMOTE_IP,
|
|
||||||
remotePort: OSC_REMOTE_PORT,
|
|
||||||
});
|
|
||||||
|
|
||||||
udpPort.open();
|
console.log('osc client running on port', config.udpClient.port);
|
||||||
console.log(`[Sending OSC] ${OSC_REMOTE_IP}:${OSC_REMOTE_PORT}`);
|
console.log('osc server running on port', config.udpServer.port);
|
||||||
|
console.log('websocket server running on port', config.wsServer.port);
|
||||||
udpPort.on('error', (e) => {
|
|
||||||
console.log('Error: ', e);
|
|
||||||
});
|
|
||||||
|
|
||||||
const wss = new WebSocketServer({ port: WS_PORT });
|
|
||||||
console.log(`[Listening WS] ws://localhost:${WS_PORT}`);
|
|
||||||
|
|
||||||
wss.on('connection', (ws) => {
|
|
||||||
console.log('New WebSocket connection');
|
|
||||||
|
|
||||||
ws.on('message', (message) => {
|
|
||||||
let osc_host = '127.0.0.1';
|
|
||||||
let osc_port = 57120;
|
|
||||||
|
|
||||||
try {
|
|
||||||
const data = JSON.parse(message);
|
|
||||||
if ('host' in data) {
|
|
||||||
osc_host = data['host'];
|
|
||||||
}
|
|
||||||
if ('port' in data) {
|
|
||||||
osc_port = data['port'];
|
|
||||||
}
|
|
||||||
let msg = { address: data['address'], args: data['args'] };
|
|
||||||
if ('timestamp' in data) {
|
|
||||||
msg = { timeTag: osc.timeTag(0, data['timestamp']), packets: [msg] };
|
|
||||||
}
|
|
||||||
|
|
||||||
udpPort.send(msg, osc_host, osc_port);
|
|
||||||
} catch (err) {
|
|
||||||
console.error('Error parsing message:', err);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
ws.on('close', () => {
|
|
||||||
console.log('WebSocket connection closed');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@strudel/repl",
|
"name": "@strudel/repl",
|
||||||
"version": "1.2.7",
|
"version": "1.2.6",
|
||||||
"description": "Strudel REPL as a Web Component",
|
"description": "Strudel REPL as a Web Component",
|
||||||
"module": "index.mjs",
|
"module": "index.mjs",
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
|
|||||||
@@ -20,13 +20,10 @@ export async function prebake() {
|
|||||||
// import('@strudel/osc'),
|
// import('@strudel/osc'),
|
||||||
);
|
);
|
||||||
// load samples
|
// load samples
|
||||||
const ds = 'https://raw.githubusercontent.com/felixroos/dough-samples/main';
|
const ds = 'https://raw.githubusercontent.com/felixroos/dough-samples/main/';
|
||||||
|
|
||||||
// TODO: move this onto the strudel repo
|
// TODO: move this onto the strudel repo
|
||||||
const ts = 'https://raw.githubusercontent.com/todepond/samples/main';
|
const ts = 'https://raw.githubusercontent.com/todepond/samples/main/';
|
||||||
|
|
||||||
const tc = 'https://raw.githubusercontent.com/tidalcycles/uzu-drumkit/main';
|
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
modulesLoading,
|
modulesLoading,
|
||||||
registerSynthSounds(),
|
registerSynthSounds(),
|
||||||
@@ -39,9 +36,9 @@ export async function prebake() {
|
|||||||
samples(`${ds}/tidal-drum-machines.json`),
|
samples(`${ds}/tidal-drum-machines.json`),
|
||||||
samples(`${ds}/piano.json`),
|
samples(`${ds}/piano.json`),
|
||||||
samples(`${ds}/Dirt-Samples.json`),
|
samples(`${ds}/Dirt-Samples.json`),
|
||||||
|
samples(`${ds}/uzu-drumkit.json`),
|
||||||
samples(`${ds}/vcsl.json`),
|
samples(`${ds}/vcsl.json`),
|
||||||
samples(`${ds}/mridangam.json`),
|
samples(`${ds}/mridangam.json`),
|
||||||
samples(`${tc}/strudel.json`),
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
aliasBank(`${ts}/tidal-drum-machines-alias.json`);
|
aliasBank(`${ts}/tidal-drum-machines-alias.json`);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@strudel/serial",
|
"name": "@strudel/serial",
|
||||||
"version": "1.2.5",
|
"version": "1.2.4",
|
||||||
"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.2.6",
|
"version": "1.2.5",
|
||||||
"description": "Soundsfont support for strudel",
|
"description": "Soundsfont support for strudel",
|
||||||
"main": "index.mjs",
|
"main": "index.mjs",
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
|
|||||||
@@ -153,7 +153,6 @@ samples('github:tidalcycles/dirt-samples')
|
|||||||
|
|
||||||
The format is `github:<user>/<repo>/<branch>`.
|
The format is `github:<user>/<repo>/<branch>`.
|
||||||
|
|
||||||
If `<repo>` and `<branch>` are not specified, they will default to `samples` and `main` respectively.
|
|
||||||
It expects a `strudel.json` file to be present at the root of the given repository, which declares the sample paths in the repo.
|
It expects a `strudel.json` file to be present at the root of the given repository, which declares the sample paths in the repo.
|
||||||
|
|
||||||
The format is also expected to be the same as explained above.
|
The format is also expected to be the same as explained above.
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
let audioContext;
|
|
||||||
|
|
||||||
export const setDefaultAudioContext = () => {
|
|
||||||
audioContext = new AudioContext();
|
|
||||||
return audioContext;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getAudioContext = () => {
|
|
||||||
if (!audioContext) {
|
|
||||||
return setDefaultAudioContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
return audioContext;
|
|
||||||
};
|
|
||||||
|
|
||||||
export function getAudioContextCurrentTime() {
|
|
||||||
return getAudioContext().currentTime;
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { getAudioContext } from './audioContext.mjs';
|
import { getAudioContext } from './superdough.mjs';
|
||||||
|
|
||||||
let worklet;
|
let worklet;
|
||||||
export async function dspWorklet(ac, code) {
|
export async function dspWorklet(ac, code) {
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { getAudioContext } from './audioContext.mjs';
|
import { getAudioContext } from './superdough.mjs';
|
||||||
import { clamp, nanFallback, midiToFreq, noteToMidi } from './util.mjs';
|
import { clamp, nanFallback } from './util.mjs';
|
||||||
import { getNoiseBuffer } from './noise.mjs';
|
import { getNoiseBuffer } from './noise.mjs';
|
||||||
import { logger } from './logger.mjs';
|
|
||||||
|
|
||||||
export const noises = ['pink', 'white', 'brown', 'crackle'];
|
export const noises = ['pink', 'white', 'brown', 'crackle'];
|
||||||
|
|
||||||
@@ -11,13 +10,6 @@ export function gainNode(value) {
|
|||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function effectSend(input, effect, wet) {
|
|
||||||
const send = gainNode(wet);
|
|
||||||
input.connect(send);
|
|
||||||
send.connect(effect);
|
|
||||||
return send;
|
|
||||||
}
|
|
||||||
|
|
||||||
const getSlope = (y1, y2, x1, x2) => {
|
const getSlope = (y1, y2, x1, x2) => {
|
||||||
const denom = x2 - x1;
|
const denom = x2 - x1;
|
||||||
if (denom === 0) {
|
if (denom === 0) {
|
||||||
@@ -29,9 +21,7 @@ const getSlope = (y1, y2, x1, x2) => {
|
|||||||
export function getWorklet(ac, processor, params, config) {
|
export function getWorklet(ac, processor, params, config) {
|
||||||
const node = new AudioWorkletNode(ac, processor, config);
|
const node = new AudioWorkletNode(ac, processor, config);
|
||||||
Object.entries(params).forEach(([key, value]) => {
|
Object.entries(params).forEach(([key, value]) => {
|
||||||
if (value !== undefined) {
|
|
||||||
node.parameters.get(key).value = value;
|
node.parameters.get(key).value = value;
|
||||||
}
|
|
||||||
});
|
});
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
@@ -98,35 +88,6 @@ export const getParamADSR = (
|
|||||||
param[ramp](min, end + release);
|
param[ramp](min, end + release);
|
||||||
};
|
};
|
||||||
|
|
||||||
function getModulationShapeInput(val) {
|
|
||||||
if (typeof val === 'number') {
|
|
||||||
return val % 5;
|
|
||||||
}
|
|
||||||
return { tri: 0, triangle: 0, sine: 1, ramp: 2, saw: 3, square: 4 }[val] ?? 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getLfo(audioContext, begin, end, properties = {}) {
|
|
||||||
const { shape = 0, ...props } = properties;
|
|
||||||
const { dcoffset = -0.5, depth = 1 } = properties;
|
|
||||||
const lfoprops = {
|
|
||||||
frequency: 1,
|
|
||||||
depth,
|
|
||||||
skew: 0.5,
|
|
||||||
phaseoffset: 0,
|
|
||||||
time: begin,
|
|
||||||
begin,
|
|
||||||
end,
|
|
||||||
shape: getModulationShapeInput(shape),
|
|
||||||
dcoffset,
|
|
||||||
min: dcoffset * depth,
|
|
||||||
max: dcoffset * depth + depth,
|
|
||||||
curve: 1,
|
|
||||||
...props,
|
|
||||||
};
|
|
||||||
|
|
||||||
return getWorklet(audioContext, 'lfo-processor', lfoprops);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getCompressor(ac, threshold, ratio, knee, attack, release) {
|
export function getCompressor(ac, threshold, ratio, knee, attack, release) {
|
||||||
const options = {
|
const options = {
|
||||||
threshold: threshold ?? -3,
|
threshold: threshold ?? -3,
|
||||||
@@ -154,41 +115,6 @@ 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)];
|
||||||
};
|
};
|
||||||
|
|
||||||
// helper utility for applying standard modulators to a parameter
|
|
||||||
export function applyParameterModulators(audioContext, param, start, end, envelopeValues, lfoValues) {
|
|
||||||
let { amount, offset, defaultAmount = 1, curve = 'linear', values, holdEnd, defaultValues } = envelopeValues;
|
|
||||||
|
|
||||||
if (amount == null) {
|
|
||||||
const hasADSRParams = values.some((p) => p != null);
|
|
||||||
amount = hasADSRParams ? defaultAmount : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
const min = offset ?? 0;
|
|
||||||
const max = amount + min;
|
|
||||||
const diff = Math.abs(max - min);
|
|
||||||
if (diff) {
|
|
||||||
const [attack, decay, sustain, release] = getADSRValues(values, curve, defaultValues);
|
|
||||||
getParamADSR(param, attack, decay, sustain, release, min, max, start, holdEnd, curve);
|
|
||||||
}
|
|
||||||
let lfo;
|
|
||||||
let { defaultDepth = 1, depth, dcoffset, ...getLfoInputs } = lfoValues;
|
|
||||||
|
|
||||||
if (depth == null) {
|
|
||||||
const hasLFOParams = Object.values(getLfoInputs).some((v) => v != null);
|
|
||||||
depth = hasLFOParams ? defaultDepth : 0;
|
|
||||||
}
|
|
||||||
if (depth) {
|
|
||||||
lfo = getLfo(audioContext, start, end, {
|
|
||||||
depth,
|
|
||||||
dcoffset,
|
|
||||||
...getLfoInputs,
|
|
||||||
});
|
|
||||||
lfo.connect(param);
|
|
||||||
}
|
|
||||||
|
|
||||||
return { lfo, disconnect: () => lfo?.disconnect() };
|
|
||||||
}
|
|
||||||
|
|
||||||
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, model, drive) {
|
||||||
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]);
|
||||||
@@ -381,121 +307,3 @@ export function applyFM(param, value, begin) {
|
|||||||
}
|
}
|
||||||
return { stop };
|
return { stop };
|
||||||
}
|
}
|
||||||
|
|
||||||
// Saturation curves
|
|
||||||
|
|
||||||
const __squash = (x) => x / (1 + x); // [0, inf) to [0, 1)
|
|
||||||
const _mod = (n, m) => ((n % m) + m) % m;
|
|
||||||
|
|
||||||
const _scurve = (x, k) => ((1 + k) * x) / (1 + k * Math.abs(x));
|
|
||||||
const _soft = (x, k) => Math.tanh(x * (1 + k));
|
|
||||||
const _hard = (x, k) => clamp((1 + k) * x, -1, 1);
|
|
||||||
|
|
||||||
const _fold = (x, k) => {
|
|
||||||
// Closed form folding for audio rate
|
|
||||||
let y = (1 + 0.5 * k) * x;
|
|
||||||
const window = _mod(y + 1, 4);
|
|
||||||
return 1 - Math.abs(window - 2);
|
|
||||||
};
|
|
||||||
|
|
||||||
const _sineFold = (x, k) => Math.sin((Math.PI / 2) * _fold(x, k));
|
|
||||||
|
|
||||||
const _cubic = (x, k) => {
|
|
||||||
const t = __squash(Math.log1p(k));
|
|
||||||
const cubic = (x - (t / 3) * x * x * x) / (1 - t / 3); // normalized to go from (-1, 1)
|
|
||||||
return _soft(cubic, k);
|
|
||||||
};
|
|
||||||
|
|
||||||
const _diode = (x, k, asym = false) => {
|
|
||||||
const g = 1 + 2 * k; // gain
|
|
||||||
const t = __squash(Math.log1p(k));
|
|
||||||
const bias = 0.07 * t;
|
|
||||||
const pos = _soft(x + bias, 2 * k);
|
|
||||||
const neg = _soft(asym ? bias : -x + bias, 2 * k);
|
|
||||||
const y = pos - neg;
|
|
||||||
// We divide by the derivative at 0 so that the distortion is roughly
|
|
||||||
// the identity map near 0 => small values are preserved and undistorted
|
|
||||||
const sech = 1 / Math.cosh(g * bias);
|
|
||||||
const sech2 = sech * sech; // derivative of soft (i.e. tanh) is sech^2
|
|
||||||
const denom = Math.max(1e-8, (asym ? 1 : 2) * g * sech2); // g from chain rule; 2 if both pos/neg have x
|
|
||||||
return _soft(y / denom, k);
|
|
||||||
};
|
|
||||||
|
|
||||||
const _asym = (x, k) => _diode(x, k, true);
|
|
||||||
|
|
||||||
const _chebyshev = (x, k) => {
|
|
||||||
const kl = 10 * Math.log1p(k);
|
|
||||||
let tnm1 = 1;
|
|
||||||
let tnm2 = x;
|
|
||||||
let tn;
|
|
||||||
let y = 0;
|
|
||||||
for (let i = 1; i < 64; i++) {
|
|
||||||
if (i < 2) {
|
|
||||||
// Already set inital conditions
|
|
||||||
y += i == 0 ? tnm1 : tnm2;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
tn = 2 * x * tnm1 - tnm2; // https://en.wikipedia.org/wiki/Chebyshev_polynomials#Recurrence_definition
|
|
||||||
tnm2 = tnm1;
|
|
||||||
tnm1 = tn;
|
|
||||||
if (i % 2 === 0) {
|
|
||||||
y += Math.min((1.3 * kl) / i, 2) * tn;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Soft clip
|
|
||||||
return _soft(y, kl / 20);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const distortionAlgorithms = {
|
|
||||||
scurve: _scurve,
|
|
||||||
soft: _soft,
|
|
||||||
hard: _hard,
|
|
||||||
cubic: _cubic,
|
|
||||||
diode: _diode,
|
|
||||||
asym: _asym,
|
|
||||||
fold: _fold,
|
|
||||||
sinefold: _sineFold,
|
|
||||||
chebyshev: _chebyshev,
|
|
||||||
};
|
|
||||||
const _algoNames = Object.freeze(Object.keys(distortionAlgorithms));
|
|
||||||
|
|
||||||
export const getDistortionAlgorithm = (algo) => {
|
|
||||||
let index = algo;
|
|
||||||
if (typeof algo === 'string') {
|
|
||||||
index = _algoNames.indexOf(algo);
|
|
||||||
if (index === -1) {
|
|
||||||
logger(`[superdough] Could not find waveshaping algorithm ${algo}.
|
|
||||||
Available options are ${_algoNames.join(', ')}.
|
|
||||||
Defaulting to ${_algoNames[0]}.`);
|
|
||||||
index = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const name = _algoNames[index % _algoNames.length]; // allow for wrapping if algo was a number
|
|
||||||
return distortionAlgorithms[name];
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getDistortion = (distort, postgain, algorithm) => {
|
|
||||||
return getWorklet(getAudioContext(), 'distort-processor', { distort, postgain }, { processorOptions: { algorithm } });
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getFrequencyFromValue = (value, defaultNote = 36) => {
|
|
||||||
let { note, freq } = value;
|
|
||||||
note = note || defaultNote;
|
|
||||||
if (typeof note === 'string') {
|
|
||||||
note = noteToMidi(note); // e.g. c3 => 48
|
|
||||||
}
|
|
||||||
// get frequency
|
|
||||||
if (!freq && typeof note === 'number') {
|
|
||||||
freq = midiToFreq(note); // + 48);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Number(freq);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const destroyAudioWorkletNode = (node) => {
|
|
||||||
if (node == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
node.disconnect();
|
|
||||||
node.parameters.get('end')?.setValueAtTime(0, 0);
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -11,5 +11,3 @@ export * from './synth.mjs';
|
|||||||
export * from './zzfx.mjs';
|
export * from './zzfx.mjs';
|
||||||
export * from './logger.mjs';
|
export * from './logger.mjs';
|
||||||
export * from './dspworklet.mjs';
|
export * from './dspworklet.mjs';
|
||||||
export * from './audioContext.mjs';
|
|
||||||
export * from './wavetable.mjs';
|
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
let log = (msg) => console.log(msg);
|
let log = (msg) => console.log(msg);
|
||||||
|
|
||||||
export function errorLogger(e, origin = 'superdough') {
|
export function errorLogger(e, origin = 'cyclist') {
|
||||||
if (process.env.NODE_ENV === 'development') {
|
//TODO: add some kind of debug flag that enables this while in dev mode
|
||||||
console.error(e);
|
// console.error(e);
|
||||||
}
|
|
||||||
logger(`[${origin}] error: ${e.message}`);
|
logger(`[${origin}] error: ${e.message}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { drywet } from './helpers.mjs';
|
import { drywet } from './helpers.mjs';
|
||||||
import { getAudioContext } from './audioContext.mjs';
|
import { getAudioContext } from './superdough.mjs';
|
||||||
|
|
||||||
let noiseCache = {};
|
let noiseCache = {};
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "superdough",
|
"name": "superdough",
|
||||||
"version": "1.2.6",
|
"version": "1.2.5",
|
||||||
"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",
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { getCommonSampleInfo } from './util.mjs';
|
import { noteToMidi, valueToMidi, getSoundIndex } from './util.mjs';
|
||||||
import { registerSound, registerWaveTable } from './index.mjs';
|
import { getAudioContext, registerSound } from './index.mjs';
|
||||||
import { getAudioContext } from './audioContext.mjs';
|
|
||||||
import { getADSRValues, getParamADSR, getPitchEnvelope, getVibratoOscillator } from './helpers.mjs';
|
import { getADSRValues, getParamADSR, getPitchEnvelope, getVibratoOscillator } from './helpers.mjs';
|
||||||
import { logger } from './logger.mjs';
|
import { logger } from './logger.mjs';
|
||||||
|
|
||||||
@@ -23,16 +22,39 @@ function humanFileSize(bytes, si) {
|
|||||||
return bytes.toFixed(1) + ' ' + units[u];
|
return bytes.toFixed(1) + ' ' + units[u];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// deduces relevant info for sample loading from hap.value and sample definition
|
||||||
|
// it encapsulates the core sampler logic into a pure and synchronous function
|
||||||
|
// hapValue: Hap.value, bank: sample bank definition for sound "s" (values in strudel.json format)
|
||||||
export function getSampleInfo(hapValue, bank) {
|
export function getSampleInfo(hapValue, bank) {
|
||||||
const { speed = 1.0 } = hapValue;
|
const { s, n = 0, speed = 1.0 } = hapValue;
|
||||||
const { transpose, url, index, midi, label } = getCommonSampleInfo(hapValue, bank);
|
let midi = valueToMidi(hapValue, 36);
|
||||||
|
let transpose = midi - 36; // C3 is middle C;
|
||||||
|
let sampleUrl;
|
||||||
|
let index = 0;
|
||||||
|
if (Array.isArray(bank)) {
|
||||||
|
index = getSoundIndex(n, bank.length);
|
||||||
|
sampleUrl = bank[index];
|
||||||
|
} else {
|
||||||
|
const midiDiff = (noteA) => noteToMidi(noteA) - midi;
|
||||||
|
// object format will expect keys as notes
|
||||||
|
const closest = Object.keys(bank)
|
||||||
|
.filter((k) => !k.startsWith('_'))
|
||||||
|
.reduce(
|
||||||
|
(closest, key, j) => (!closest || Math.abs(midiDiff(key)) < Math.abs(midiDiff(closest)) ? key : closest),
|
||||||
|
null,
|
||||||
|
);
|
||||||
|
transpose = -midiDiff(closest); // semitones to repitch
|
||||||
|
index = getSoundIndex(n, bank[closest].length);
|
||||||
|
sampleUrl = bank[closest][index];
|
||||||
|
}
|
||||||
|
const label = `${s}:${index}`;
|
||||||
let playbackRate = Math.abs(speed) * Math.pow(2, transpose / 12);
|
let playbackRate = Math.abs(speed) * Math.pow(2, transpose / 12);
|
||||||
return { transpose, url, index, midi, label, playbackRate };
|
return { transpose, sampleUrl, index, midi, label, playbackRate };
|
||||||
}
|
}
|
||||||
|
|
||||||
// takes hapValue and returns buffer + playbackRate.
|
// takes hapValue and returns buffer + playbackRate.
|
||||||
export const getSampleBuffer = async (hapValue, bank, resolveUrl) => {
|
export const getSampleBuffer = async (hapValue, bank, resolveUrl) => {
|
||||||
let { url: sampleUrl, label, playbackRate } = getSampleInfo(hapValue, bank);
|
let { sampleUrl, label, playbackRate } = getSampleInfo(hapValue, bank);
|
||||||
if (resolveUrl) {
|
if (resolveUrl) {
|
||||||
sampleUrl = await resolveUrl(sampleUrl);
|
sampleUrl = await resolveUrl(sampleUrl);
|
||||||
}
|
}
|
||||||
@@ -57,14 +79,14 @@ export const getSampleBufferSource = async (hapValue, bank, resolveUrl) => {
|
|||||||
bufferSource.buffer = buffer;
|
bufferSource.buffer = buffer;
|
||||||
bufferSource.playbackRate.value = playbackRate;
|
bufferSource.playbackRate.value = playbackRate;
|
||||||
|
|
||||||
const { loopBegin = 0, loopEnd = 1, begin = 0, end = 1 } = hapValue;
|
const { s, loopBegin = 0, loopEnd = 1, begin = 0, end = 1 } = hapValue;
|
||||||
|
|
||||||
// "The computation of the offset into the sound is performed using the sound buffer's natural sample rate,
|
// "The computation of the offset into the sound is performed using the sound buffer's natural sample rate,
|
||||||
// rather than the current playback rate, so even if the sound is playing at twice its normal speed,
|
// rather than the current playback rate, so even if the sound is playing at twice its normal speed,
|
||||||
// the midway point through a 10-second audio buffer is still 5."
|
// the midway point through a 10-second audio buffer is still 5."
|
||||||
const offset = begin * bufferSource.buffer.duration;
|
const offset = begin * bufferSource.buffer.duration;
|
||||||
|
|
||||||
const loop = hapValue.loop;
|
const loop = s.startsWith('wt_') ? 1 : hapValue.loop;
|
||||||
if (loop) {
|
if (loop) {
|
||||||
bufferSource.loop = true;
|
bufferSource.loop = true;
|
||||||
bufferSource.loopStart = loopBegin * bufferSource.buffer.duration - offset;
|
bufferSource.loopStart = loopBegin * bufferSource.buffer.duration - offset;
|
||||||
@@ -121,18 +143,13 @@ function githubPath(base, subpath = '') {
|
|||||||
if (!base.startsWith('github:')) {
|
if (!base.startsWith('github:')) {
|
||||||
throw new Error('expected "github:" at the start of pseudoUrl');
|
throw new Error('expected "github:" at the start of pseudoUrl');
|
||||||
}
|
}
|
||||||
let path = base.slice('github:'.length);
|
let [_, path] = base.split('github:');
|
||||||
path = path.endsWith('/') ? path.slice(0, -1) : path;
|
path = path.endsWith('/') ? path.slice(0, -1) : path;
|
||||||
|
if (path.split('/').length === 2) {
|
||||||
let components = path.split('/');
|
// assume main as default branch if none set
|
||||||
let user = components[0];
|
path += '/main';
|
||||||
let repo = components.length >= 2 ? components[1] : 'samples';
|
}
|
||||||
let branch = components.length >= 3 ? components[2] : 'main';
|
return `https://raw.githubusercontent.com/${path}/${subpath}`;
|
||||||
let other = components.slice(3);
|
|
||||||
other.push(subpath ? subpath : '');
|
|
||||||
other = other.join('/');
|
|
||||||
|
|
||||||
return `https://raw.githubusercontent.com/${user}/${repo}/${branch}/${other}`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const processSampleMap = (sampleMap, fn, baseUrl = sampleMap._base || '') => {
|
export const processSampleMap = (sampleMap, fn, baseUrl = sampleMap._base || '') => {
|
||||||
@@ -250,12 +267,16 @@ export const samples = async (sampleMap, baseUrl = sampleMap._base || '', option
|
|||||||
return samples(json, baseUrl || base, options);
|
return samples(json, baseUrl || base, options);
|
||||||
}
|
}
|
||||||
const { prebake, tag } = options;
|
const { prebake, tag } = options;
|
||||||
|
|
||||||
processSampleMap(
|
processSampleMap(
|
||||||
sampleMap,
|
sampleMap,
|
||||||
(key, bank) => {
|
(key, bank) =>
|
||||||
registerSampleSource(key, bank, { baseUrl, prebake, tag });
|
registerSound(key, (t, hapValue, onended) => onTriggerSample(t, hapValue, onended, bank), {
|
||||||
},
|
type: 'sample',
|
||||||
|
samples: bank,
|
||||||
|
baseUrl,
|
||||||
|
prebake,
|
||||||
|
tag,
|
||||||
|
}),
|
||||||
baseUrl,
|
baseUrl,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -345,20 +366,3 @@ export async function onTriggerSample(t, value, onended, bank, resolveUrl) {
|
|||||||
|
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
function registerSample(key, bank, params) {
|
|
||||||
registerSound(key, (t, hapValue, onended) => onTriggerSample(t, hapValue, onended, bank), {
|
|
||||||
type: 'sample',
|
|
||||||
samples: bank,
|
|
||||||
...params,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
export function registerSampleSource(key, bank, params) {
|
|
||||||
const isWavetable = key.startsWith('wt_');
|
|
||||||
if (isWavetable) {
|
|
||||||
registerWaveTable(key, bank, params);
|
|
||||||
} else {
|
|
||||||
registerSample(key, bank, params);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -7,14 +7,12 @@ 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 { nanFallback, _mod, cycleToSeconds } from './util.mjs';
|
import { clamp, nanFallback, _mod, cycleToSeconds, secondsToCycle } from './util.mjs';
|
||||||
import workletsUrl from './worklets.mjs?audioworklet';
|
import workletsUrl from './worklets.mjs?audioworklet';
|
||||||
import { createFilter, gainNode, getCompressor, getDistortion, getLfo, getWorklet, effectSend } from './helpers.mjs';
|
import { createFilter, gainNode, getCompressor, getWorklet, webAudioTimeout } from './helpers.mjs';
|
||||||
import { map } from 'nanostores';
|
import { map } from 'nanostores';
|
||||||
import { logger } from './logger.mjs';
|
import { logger, errorLogger } from './logger.mjs';
|
||||||
import { loadBuffer } from './sampler.mjs';
|
import { loadBuffer } from './sampler.mjs';
|
||||||
import { getAudioContext } from './audioContext.mjs';
|
|
||||||
import { SuperdoughAudioController } from './superdoughoutput.mjs';
|
|
||||||
|
|
||||||
export const DEFAULT_MAX_POLYPHONY = 128;
|
export const DEFAULT_MAX_POLYPHONY = 128;
|
||||||
const DEFAULT_AUDIO_DEVICE_NAME = 'System Standard';
|
const DEFAULT_AUDIO_DEVICE_NAME = 'System Standard';
|
||||||
@@ -30,6 +28,13 @@ export function setMultiChannelOrbits(bool) {
|
|||||||
multiChannelOrbits = bool == true;
|
multiChannelOrbits = bool == true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getModulationShapeInput(val) {
|
||||||
|
if (typeof val === 'number') {
|
||||||
|
return val % 5;
|
||||||
|
}
|
||||||
|
return { tri: 0, triangle: 0, sine: 1, ramp: 2, saw: 3, square: 4 }[val] ?? 0;
|
||||||
|
}
|
||||||
|
|
||||||
export const soundMap = map();
|
export const soundMap = map();
|
||||||
|
|
||||||
export function registerSound(key, onTrigger, data = {}) {
|
export function registerSound(key, onTrigger, data = {}) {
|
||||||
@@ -155,7 +160,6 @@ let defaultDefaultValues = {
|
|||||||
phaserdepth: 0.75,
|
phaserdepth: 0.75,
|
||||||
shapevol: 1,
|
shapevol: 1,
|
||||||
distortvol: 1,
|
distortvol: 1,
|
||||||
distorttype: 0,
|
|
||||||
delay: 0,
|
delay: 0,
|
||||||
byteBeatExpression: '0',
|
byteBeatExpression: '0',
|
||||||
delayfeedback: 0.5,
|
delayfeedback: 0.5,
|
||||||
@@ -202,6 +206,25 @@ export function setVersionDefaults(version) {
|
|||||||
|
|
||||||
export const resetLoadedSounds = () => soundMap.set({});
|
export const resetLoadedSounds = () => soundMap.set({});
|
||||||
|
|
||||||
|
let audioContext;
|
||||||
|
|
||||||
|
export const setDefaultAudioContext = () => {
|
||||||
|
audioContext = new AudioContext({ latencyHint: 'playback' });
|
||||||
|
return audioContext;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getAudioContext = () => {
|
||||||
|
if (!audioContext) {
|
||||||
|
return setDefaultAudioContext();
|
||||||
|
}
|
||||||
|
|
||||||
|
return audioContext;
|
||||||
|
};
|
||||||
|
|
||||||
|
export function getAudioContextCurrentTime() {
|
||||||
|
return getAudioContext().currentTime;
|
||||||
|
}
|
||||||
|
|
||||||
let externalWorklets = [];
|
let externalWorklets = [];
|
||||||
export function registerWorklet(url) {
|
export function registerWorklet(url) {
|
||||||
externalWorklets.push(url);
|
externalWorklets.push(url);
|
||||||
@@ -278,16 +301,88 @@ export async function initAudioOnFirstClick(options) {
|
|||||||
return audioReady;
|
return audioReady;
|
||||||
}
|
}
|
||||||
|
|
||||||
let controller;
|
const maxfeedback = 0.98;
|
||||||
function getSuperdoughAudioController() {
|
|
||||||
if (controller == null) {
|
let channelMerger, destinationGain;
|
||||||
controller = new SuperdoughAudioController(getAudioContext());
|
//update the output channel configuration to match user's audio device
|
||||||
}
|
export function initializeAudioOutput() {
|
||||||
return controller;
|
const audioContext = getAudioContext();
|
||||||
|
const maxChannelCount = audioContext.destination.maxChannelCount;
|
||||||
|
audioContext.destination.channelCount = maxChannelCount;
|
||||||
|
channelMerger = new ChannelMergerNode(audioContext, { numberOfInputs: audioContext.destination.channelCount });
|
||||||
|
destinationGain = new GainNode(audioContext);
|
||||||
|
channelMerger.connect(destinationGain);
|
||||||
|
destinationGain.connect(audioContext.destination);
|
||||||
}
|
}
|
||||||
export function connectToDestination(input, channels) {
|
|
||||||
const controller = getSuperdoughAudioController();
|
// input: AudioNode, channels: ?Array<int>
|
||||||
controller.output.connectToDestination(input, channels);
|
export const connectToDestination = (input, channels = [0, 1]) => {
|
||||||
|
const ctx = getAudioContext();
|
||||||
|
if (channelMerger == null) {
|
||||||
|
initializeAudioOutput();
|
||||||
|
}
|
||||||
|
//This upmix can be removed if correct channel counts are set throughout the app,
|
||||||
|
// and then strudel could theoretically support surround sound audio files
|
||||||
|
const stereoMix = new StereoPannerNode(ctx);
|
||||||
|
input.connect(stereoMix);
|
||||||
|
|
||||||
|
const splitter = new ChannelSplitterNode(ctx, {
|
||||||
|
numberOfOutputs: stereoMix.channelCount,
|
||||||
|
});
|
||||||
|
stereoMix.connect(splitter);
|
||||||
|
channels.forEach((ch, i) => {
|
||||||
|
splitter.connect(channelMerger, i % stereoMix.channelCount, ch % ctx.destination.channelCount);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const panic = () => {
|
||||||
|
if (destinationGain == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
destinationGain.gain.linearRampToValueAtTime(0, getAudioContext().currentTime + 0.01);
|
||||||
|
destinationGain = null;
|
||||||
|
channelMerger == null;
|
||||||
|
};
|
||||||
|
|
||||||
|
function getDelay(orbit, delaytime, delayfeedback, t) {
|
||||||
|
if (delayfeedback > maxfeedback) {
|
||||||
|
//logger(`delayfeedback was clamped to ${maxfeedback} to save your ears`);
|
||||||
|
}
|
||||||
|
delayfeedback = clamp(delayfeedback, 0, 0.98);
|
||||||
|
if (!orbits[orbit].delayNode) {
|
||||||
|
const ac = getAudioContext();
|
||||||
|
const dly = ac.createFeedbackDelay(1, delaytime, delayfeedback);
|
||||||
|
dly.start?.(t); // for some reason, this throws when audion extension is installed..
|
||||||
|
connectToOrbit(dly, orbit);
|
||||||
|
orbits[orbit].delayNode = dly;
|
||||||
|
}
|
||||||
|
orbits[orbit].delayNode.delayTime.value !== delaytime &&
|
||||||
|
orbits[orbit].delayNode.delayTime.setValueAtTime(delaytime, t);
|
||||||
|
orbits[orbit].delayNode.feedback.value !== delayfeedback &&
|
||||||
|
orbits[orbit].delayNode.feedback.setValueAtTime(delayfeedback, t);
|
||||||
|
return orbits[orbit].delayNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getLfo(audioContext, begin, end, properties = {}) {
|
||||||
|
const { shape = 0, ...props } = properties;
|
||||||
|
const { dcoffset = -0.5, depth = 1 } = properties;
|
||||||
|
const lfoprops = {
|
||||||
|
frequency: 1,
|
||||||
|
depth,
|
||||||
|
skew: 0.5,
|
||||||
|
phaseoffset: 0,
|
||||||
|
time: begin,
|
||||||
|
begin,
|
||||||
|
end,
|
||||||
|
shape: getModulationShapeInput(shape),
|
||||||
|
dcoffset,
|
||||||
|
min: dcoffset * depth,
|
||||||
|
max: dcoffset * depth + depth,
|
||||||
|
curve: 1,
|
||||||
|
...props,
|
||||||
|
};
|
||||||
|
|
||||||
|
return getWorklet(audioContext, 'lfo-processor', lfoprops);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPhaser(time, end, frequency = 1, depth = 0.5, centerFrequency = 1000, sweep = 2000) {
|
function getPhaser(time, end, frequency = 1, depth = 0.5, centerFrequency = 1000, sweep = 2000) {
|
||||||
@@ -321,6 +416,78 @@ function getFilterType(ftype) {
|
|||||||
return typeof ftype === 'number' ? filterTypes[Math.floor(_mod(ftype, filterTypes.length))] : ftype;
|
return typeof ftype === 'number' ? filterTypes[Math.floor(_mod(ftype, filterTypes.length))] : ftype;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//type orbit {
|
||||||
|
// gain: number,
|
||||||
|
// reverbNode: reverbNode
|
||||||
|
// delayNode: delayNode
|
||||||
|
//}
|
||||||
|
let orbits = {};
|
||||||
|
function connectToOrbit(node, orbit) {
|
||||||
|
if (orbits[orbit] == null) {
|
||||||
|
errorLogger(new Error('target orbit does not exist'), 'superdough');
|
||||||
|
}
|
||||||
|
node.connect(orbits[orbit].gain);
|
||||||
|
}
|
||||||
|
|
||||||
|
function setOrbit(audioContext, orbit, channels) {
|
||||||
|
if (orbits[orbit] == null) {
|
||||||
|
orbits[orbit] = {
|
||||||
|
gain: new GainNode(audioContext, { gain: 1, channelCount: 2, channelCountMode: 'explicit' }),
|
||||||
|
};
|
||||||
|
connectToDestination(orbits[orbit].gain, channels);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function duckOrbit(audioContext, targetOrbit, t, attacktime = 0.1, duckdepth = 1) {
|
||||||
|
const targetArr = [targetOrbit].flat();
|
||||||
|
|
||||||
|
targetArr.forEach((target) => {
|
||||||
|
if (orbits[target] == null) {
|
||||||
|
errorLogger(new Error(`duck target orbit ${target} does not exist`), 'superdough');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
webAudioTimeout(
|
||||||
|
audioContext,
|
||||||
|
() => {
|
||||||
|
orbits[target].gain.gain.cancelScheduledValues(t);
|
||||||
|
const currVal = orbits[target].gain.gain.value;
|
||||||
|
orbits[target].gain.gain.linearRampToValueAtTime(clamp(1 - Math.pow(duckdepth, 0.5), 0.01, currVal), t);
|
||||||
|
orbits[target].gain.gain.exponentialRampToValueAtTime(1, t + Math.max(0.002, attacktime));
|
||||||
|
},
|
||||||
|
0,
|
||||||
|
t - 0.01,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
let hasChanged = (now, before) => now !== undefined && now !== before;
|
||||||
|
function getReverb(orbit, duration, fade, lp, dim, ir, irspeed, irbegin) {
|
||||||
|
// If no reverb has been created for a given orbit, create one
|
||||||
|
if (!orbits[orbit].reverbNode) {
|
||||||
|
const ac = getAudioContext();
|
||||||
|
const reverb = ac.createReverb(duration, fade, lp, dim, ir, irspeed, irbegin);
|
||||||
|
connectToOrbit(reverb, orbit);
|
||||||
|
orbits[orbit].reverbNode = reverb;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
hasChanged(duration, orbits[orbit].reverbNode.duration) ||
|
||||||
|
hasChanged(fade, orbits[orbit].reverbNode.fade) ||
|
||||||
|
hasChanged(lp, orbits[orbit].reverbNode.lp) ||
|
||||||
|
hasChanged(dim, orbits[orbit].reverbNode.dim) ||
|
||||||
|
hasChanged(irspeed, orbits[orbit].reverbNode.irspeed) ||
|
||||||
|
hasChanged(irbegin, orbits[orbit].reverbNode.irbegin) ||
|
||||||
|
orbits[orbit].reverbNode.ir !== ir
|
||||||
|
) {
|
||||||
|
// only regenerate when something has changed
|
||||||
|
// avoids endless regeneration on things like
|
||||||
|
// stack(s("a"), s("b").rsize(8)).room(.5)
|
||||||
|
// this only works when args may stay undefined until here
|
||||||
|
// setting default values breaks this
|
||||||
|
orbits[orbit].reverbNode.generate(duration, fade, lp, dim, ir, irspeed, irbegin);
|
||||||
|
}
|
||||||
|
return orbits[orbit].reverbNode;
|
||||||
|
}
|
||||||
|
|
||||||
export let analysers = {},
|
export let analysers = {},
|
||||||
analysersData = {};
|
analysersData = {};
|
||||||
|
|
||||||
@@ -353,8 +520,15 @@ export function getAnalyzerData(type = 'time', id = 1) {
|
|||||||
return analysersData[id];
|
return analysersData[id];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function effectSend(input, effect, wet) {
|
||||||
|
const send = gainNode(wet);
|
||||||
|
input.connect(send);
|
||||||
|
send.connect(effect);
|
||||||
|
return send;
|
||||||
|
}
|
||||||
|
|
||||||
export function resetGlobalEffects() {
|
export function resetGlobalEffects() {
|
||||||
controller?.reset();
|
orbits = {};
|
||||||
analysers = {};
|
analysers = {};
|
||||||
analysersData = {};
|
analysersData = {};
|
||||||
}
|
}
|
||||||
@@ -369,7 +543,6 @@ function mapChannelNumbers(channels) {
|
|||||||
export const superdough = async (value, t, hapDuration, cps = 0.5, cycle = 0.5) => {
|
export const superdough = async (value, t, hapDuration, cps = 0.5, cycle = 0.5) => {
|
||||||
// new: t is always expected to be the absolute target onset time
|
// new: t is always expected to be the absolute target onset time
|
||||||
const ac = getAudioContext();
|
const ac = getAudioContext();
|
||||||
const audioController = getSuperdoughAudioController();
|
|
||||||
|
|
||||||
let { stretch } = value;
|
let { stretch } = value;
|
||||||
if (stretch != null) {
|
if (stretch != null) {
|
||||||
@@ -409,10 +582,8 @@ export const superdough = async (value, t, hapDuration, cps = 0.5, cycle = 0.5)
|
|||||||
postgain = getDefaultValue('postgain'),
|
postgain = getDefaultValue('postgain'),
|
||||||
density = getDefaultValue('density'),
|
density = getDefaultValue('density'),
|
||||||
duckorbit,
|
duckorbit,
|
||||||
duckonset,
|
|
||||||
duckattack,
|
duckattack,
|
||||||
duckdepth,
|
duckdepth,
|
||||||
djf,
|
|
||||||
// filters
|
// filters
|
||||||
fanchor = getDefaultValue('fanchor'),
|
fanchor = getDefaultValue('fanchor'),
|
||||||
drive = 0.69,
|
drive = 0.69,
|
||||||
@@ -456,7 +627,6 @@ export const superdough = async (value, t, hapDuration, cps = 0.5, cycle = 0.5)
|
|||||||
shapevol = getDefaultValue('shapevol'),
|
shapevol = getDefaultValue('shapevol'),
|
||||||
distort,
|
distort,
|
||||||
distortvol = getDefaultValue('distortvol'),
|
distortvol = getDefaultValue('distortvol'),
|
||||||
distorttype = getDefaultValue('distorttype'),
|
|
||||||
pan,
|
pan,
|
||||||
vowel,
|
vowel,
|
||||||
delay = getDefaultValue('delay'),
|
delay = getDefaultValue('delay'),
|
||||||
@@ -490,9 +660,10 @@ export const superdough = async (value, t, hapDuration, cps = 0.5, cycle = 0.5)
|
|||||||
);
|
);
|
||||||
|
|
||||||
const channels = value.channels != null ? mapChannelNumbers(value.channels) : orbitChannels;
|
const channels = value.channels != null ? mapChannelNumbers(value.channels) : orbitChannels;
|
||||||
const orbitBus = audioController.getOrbit(orbit, channels);
|
setOrbit(ac, orbit, channels, t, cycle, cps);
|
||||||
|
|
||||||
if (duckorbit != null) {
|
if (duckorbit != null) {
|
||||||
audioController.duck(duckorbit, t, duckonset, duckattack, duckdepth);
|
duckOrbit(ac, duckorbit, t, duckattack, duckdepth);
|
||||||
}
|
}
|
||||||
|
|
||||||
gain = applyGainCurve(nanFallback(gain, 1));
|
gain = applyGainCurve(nanFallback(gain, 1));
|
||||||
@@ -539,7 +710,7 @@ export const superdough = async (value, t, hapDuration, cps = 0.5, cycle = 0.5)
|
|||||||
audioNodes.forEach((n) => n?.disconnect());
|
audioNodes.forEach((n) => n?.disconnect());
|
||||||
activeSoundSources.delete(chainID);
|
activeSoundSources.delete(chainID);
|
||||||
};
|
};
|
||||||
const soundHandle = await onTrigger(t, value, onEnded, cps);
|
const soundHandle = await onTrigger(t, value, onEnded);
|
||||||
|
|
||||||
if (soundHandle) {
|
if (soundHandle) {
|
||||||
sourceNode = soundHandle.node;
|
sourceNode = soundHandle.node;
|
||||||
@@ -631,20 +802,12 @@ export const superdough = async (value, t, hapDuration, cps = 0.5, cycle = 0.5)
|
|||||||
coarse !== undefined && chain.push(getWorklet(ac, 'coarse-processor', { coarse }));
|
coarse !== undefined && chain.push(getWorklet(ac, 'coarse-processor', { coarse }));
|
||||||
crush !== undefined && chain.push(getWorklet(ac, 'crush-processor', { crush }));
|
crush !== undefined && chain.push(getWorklet(ac, 'crush-processor', { crush }));
|
||||||
shape !== undefined && chain.push(getWorklet(ac, 'shape-processor', { shape, postgain: shapevol }));
|
shape !== undefined && chain.push(getWorklet(ac, 'shape-processor', { shape, postgain: shapevol }));
|
||||||
distort !== undefined && chain.push(getDistortion(distort, distortvol, distorttype));
|
distort !== undefined && chain.push(getWorklet(ac, 'distort-processor', { distort, postgain: distortvol }));
|
||||||
|
|
||||||
if (tremolosync != null) {
|
if (tremolosync != null) {
|
||||||
tremolo = cps * tremolosync;
|
tremolo = cps * tremolosync;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value.wtPosSynced != null) {
|
|
||||||
value.wtPosRate /= cps;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (value.wtWarpSynced != null) {
|
|
||||||
value.wtWarpRate /= cps;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tremolo !== undefined) {
|
if (tremolo !== undefined) {
|
||||||
// Allow clipping of modulator for more dynamic possiblities, and to prevent speaker overload
|
// Allow clipping of modulator for more dynamic possiblities, and to prevent speaker overload
|
||||||
// EX: a triangle waveform will clip like this /-\ when the depth is above 1
|
// EX: a triangle waveform will clip like this /-\ when the depth is above 1
|
||||||
@@ -690,11 +853,14 @@ export const superdough = async (value, t, hapDuration, cps = 0.5, cycle = 0.5)
|
|||||||
chain.push(post);
|
chain.push(post);
|
||||||
|
|
||||||
// delay
|
// delay
|
||||||
|
let delaySend;
|
||||||
if (delay > 0 && delaytime > 0 && delayfeedback > 0) {
|
if (delay > 0 && delaytime > 0 && delayfeedback > 0) {
|
||||||
orbitBus.getDelay(delaytime, delayfeedback, t);
|
const delayNode = getDelay(orbit, delaytime, delayfeedback, t);
|
||||||
orbitBus.sendDelay(post, delay);
|
delaySend = effectSend(post, delayNode, delay);
|
||||||
|
audioNodes.push(delaySend);
|
||||||
}
|
}
|
||||||
// reverb
|
// reverb
|
||||||
|
let reverbSend;
|
||||||
if (room > 0) {
|
if (room > 0) {
|
||||||
let roomIR;
|
let roomIR;
|
||||||
if (ir !== undefined) {
|
if (ir !== undefined) {
|
||||||
@@ -707,27 +873,25 @@ export const superdough = async (value, t, hapDuration, cps = 0.5, cycle = 0.5)
|
|||||||
}
|
}
|
||||||
roomIR = await loadBuffer(url, ac, ir, 0);
|
roomIR = await loadBuffer(url, ac, ir, 0);
|
||||||
}
|
}
|
||||||
orbitBus.getReverb(roomsize, roomfade, roomlp, roomdim, roomIR, irspeed, irbegin);
|
const reverbNode = getReverb(orbit, roomsize, roomfade, roomlp, roomdim, roomIR, irspeed, irbegin);
|
||||||
orbitBus.sendReverb(post, room);
|
reverbSend = effectSend(post, reverbNode, room);
|
||||||
}
|
audioNodes.push(reverbSend);
|
||||||
|
|
||||||
if (djf != null) {
|
|
||||||
orbitBus.getDjf(djf, t);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// analyser
|
// analyser
|
||||||
|
let analyserSend;
|
||||||
if (analyze) {
|
if (analyze) {
|
||||||
const analyserNode = getAnalyserById(analyze, 2 ** (fft + 5));
|
const analyserNode = getAnalyserById(analyze, 2 ** (fft + 5));
|
||||||
const analyserSend = effectSend(post, analyserNode, 1);
|
analyserSend = effectSend(post, analyserNode, 1);
|
||||||
audioNodes.push(analyserSend);
|
audioNodes.push(analyserSend);
|
||||||
}
|
}
|
||||||
if (dry != null) {
|
if (dry != null) {
|
||||||
dry = applyGainCurve(dry);
|
dry = applyGainCurve(dry);
|
||||||
const dryGain = new GainNode(ac, { gain: dry });
|
const dryGain = new GainNode(ac, { gain: dry });
|
||||||
chain.push(dryGain);
|
chain.push(dryGain);
|
||||||
orbitBus.connectToOutput(dryGain);
|
connectToOrbit(dryGain, orbit);
|
||||||
} else {
|
} else {
|
||||||
orbitBus.connectToOutput(post);
|
connectToOrbit(post, orbit);
|
||||||
}
|
}
|
||||||
|
|
||||||
// connect chain elements together
|
// connect chain elements together
|
||||||
|
|||||||
@@ -1,209 +0,0 @@
|
|||||||
import { effectSend, getWorklet, webAudioTimeout } from './helpers.mjs';
|
|
||||||
import { errorLogger } from './logger.mjs';
|
|
||||||
import { clamp } from './util.mjs';
|
|
||||||
|
|
||||||
let hasChanged = (now, before) => now !== undefined && now !== before;
|
|
||||||
|
|
||||||
export class Orbit {
|
|
||||||
reverbNode;
|
|
||||||
delayNode;
|
|
||||||
output;
|
|
||||||
summingNode;
|
|
||||||
djfNode;
|
|
||||||
audioContext;
|
|
||||||
constructor(audioContext) {
|
|
||||||
this.audioContext = audioContext;
|
|
||||||
this.output = new GainNode(audioContext, { gain: 1, channelCount: 2, channelCountMode: 'explicit' });
|
|
||||||
this.summingNode = new GainNode(audioContext, { gain: 1, channelCount: 2, channelCountMode: 'explicit' });
|
|
||||||
this.summingNode.connect(this.output);
|
|
||||||
}
|
|
||||||
|
|
||||||
disconnect() {
|
|
||||||
this.output.disconnect();
|
|
||||||
this.summingNode.disconnect();
|
|
||||||
this.delayNode?.disconnect();
|
|
||||||
this.reverbNode?.disconnect();
|
|
||||||
}
|
|
||||||
|
|
||||||
getDjf(value, t = 0) {
|
|
||||||
if (this.djfNode == null) {
|
|
||||||
this.djfNode = getWorklet(this.audioContext, 'djf-processor', { value });
|
|
||||||
this.summingNode.disconnect();
|
|
||||||
this.summingNode.connect(this.djfNode);
|
|
||||||
this.djfNode.connect(this.output);
|
|
||||||
}
|
|
||||||
const val = this.djfNode.parameters.get('value');
|
|
||||||
val.setValueAtTime(value, t);
|
|
||||||
}
|
|
||||||
|
|
||||||
getDelay(delaytime = 0, feedback = 0.5, t) {
|
|
||||||
const maxfeedback = 0.98;
|
|
||||||
if (feedback > maxfeedback) {
|
|
||||||
//logger(`feedback was clamped to ${maxfeedback} to save your ears`);
|
|
||||||
}
|
|
||||||
feedback = clamp(feedback, 0, 0.98);
|
|
||||||
if (this.delayNode == null) {
|
|
||||||
this.delayNode = this.audioContext.createFeedbackDelay(1, delaytime, feedback);
|
|
||||||
this.delayNode.connect(this.summingNode);
|
|
||||||
this.delayNode.start?.(t); // for some reason, this throws when audion extension is installed..
|
|
||||||
}
|
|
||||||
this.delayNode.delayTime.value !== delaytime && this.delayNode.delayTime.setValueAtTime(delaytime, t);
|
|
||||||
this.delayNode.feedback.value !== feedback && this.delayNode.feedback.setValueAtTime(feedback, t);
|
|
||||||
return this.delayNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
getReverb(duration, fade, lp, dim, ir, irspeed, irbegin) {
|
|
||||||
// If no reverb has been created for a given orbit, create one
|
|
||||||
if (this.reverbNode == null) {
|
|
||||||
this.reverbNode = this.audioContext.createReverb(duration, fade, lp, dim, ir, irspeed, irbegin);
|
|
||||||
this.reverbNode.connect(this.summingNode);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
|
||||||
hasChanged(duration, this.reverbNode.duration) ||
|
|
||||||
hasChanged(fade, this.reverbNode.fade) ||
|
|
||||||
hasChanged(lp, this.reverbNode.lp) ||
|
|
||||||
hasChanged(dim, this.reverbNode.dim) ||
|
|
||||||
hasChanged(irspeed, this.reverbNode.irspeed) ||
|
|
||||||
hasChanged(irbegin, this.reverbNode.irbegin) ||
|
|
||||||
this.reverbNode.ir !== ir
|
|
||||||
) {
|
|
||||||
// only regenerate when something has changed
|
|
||||||
// avoids endless regeneration on things like
|
|
||||||
// stack(s("a"), s("b").rsize(8)).room(.5)
|
|
||||||
// this only works when args may stay undefined until here
|
|
||||||
// setting default values breaks this
|
|
||||||
this.reverbNode.generate(duration, fade, lp, dim, ir, irspeed, irbegin);
|
|
||||||
}
|
|
||||||
return this.reverbNode;
|
|
||||||
}
|
|
||||||
sendReverb(node, amount) {
|
|
||||||
effectSend(node, this.reverbNode, amount);
|
|
||||||
}
|
|
||||||
|
|
||||||
sendDelay(node, amount) {
|
|
||||||
effectSend(node, this.delayNode, amount);
|
|
||||||
}
|
|
||||||
|
|
||||||
duck(t, onsettime = 0, attacktime = 0.1, depth = 1) {
|
|
||||||
const onset = onsettime;
|
|
||||||
const attack = Math.max(attacktime, 0.002);
|
|
||||||
const gainParam = this.output.gain;
|
|
||||||
webAudioTimeout(
|
|
||||||
this.audioContext,
|
|
||||||
() => {
|
|
||||||
const now = this.audioContext.currentTime;
|
|
||||||
|
|
||||||
// cancelScheduledValues and setValueAtTime together emulate cancelAndHoldAtTime
|
|
||||||
// on browsers which lack that method
|
|
||||||
const currVal = gainParam.value;
|
|
||||||
gainParam.cancelScheduledValues(now);
|
|
||||||
gainParam.setValueAtTime(currVal, now);
|
|
||||||
|
|
||||||
const t0 = Math.max(t, now); // guard against now > t
|
|
||||||
const duckedVal = clamp(1 - Math.sqrt(depth), 0.01, currVal);
|
|
||||||
gainParam.exponentialRampToValueAtTime(duckedVal, t0 + onset);
|
|
||||||
gainParam.exponentialRampToValueAtTime(1, t0 + onset + attack);
|
|
||||||
},
|
|
||||||
0,
|
|
||||||
t - 0.01,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
connectToOutput(node) {
|
|
||||||
node.connect(this.summingNode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class SuperdoughOutput {
|
|
||||||
channelMerger;
|
|
||||||
destinationGain;
|
|
||||||
|
|
||||||
constructor(audioContext) {
|
|
||||||
this.audioContext = audioContext;
|
|
||||||
this.initializeAudio();
|
|
||||||
}
|
|
||||||
|
|
||||||
initializeAudio() {
|
|
||||||
const audioContext = this.audioContext;
|
|
||||||
const maxChannelCount = audioContext.destination.maxChannelCount;
|
|
||||||
this.audioContext.destination.channelCount = maxChannelCount;
|
|
||||||
this.channelMerger = new ChannelMergerNode(audioContext, { numberOfInputs: audioContext.destination.channelCount });
|
|
||||||
this.destinationGain = new GainNode(audioContext);
|
|
||||||
this.channelMerger.connect(this.destinationGain);
|
|
||||||
this.destinationGain.connect(audioContext.destination);
|
|
||||||
}
|
|
||||||
|
|
||||||
reset() {
|
|
||||||
this.disconnect();
|
|
||||||
this.initializeAudio();
|
|
||||||
}
|
|
||||||
disconnect() {
|
|
||||||
this.channelMerger.disconnect();
|
|
||||||
this.destinationGain.disconnect();
|
|
||||||
this.destinationGain = null;
|
|
||||||
this.channelMerger = null;
|
|
||||||
}
|
|
||||||
connectToDestination = (input, channels = [0, 1]) => {
|
|
||||||
//This upmix can be removed if correct channel counts are set throughout the app,
|
|
||||||
// and then strudel could theoretically support surround sound audio files
|
|
||||||
const stereoMix = new StereoPannerNode(this.audioContext);
|
|
||||||
input.connect(stereoMix);
|
|
||||||
|
|
||||||
const splitter = new ChannelSplitterNode(this.audioContext, {
|
|
||||||
numberOfOutputs: stereoMix.channelCount,
|
|
||||||
});
|
|
||||||
stereoMix.connect(splitter);
|
|
||||||
channels.forEach((ch, i) => {
|
|
||||||
splitter.connect(this.channelMerger, i % stereoMix.channelCount, ch % this.audioContext.destination.channelCount);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export class SuperdoughAudioController {
|
|
||||||
audioContext;
|
|
||||||
output;
|
|
||||||
nodes = {};
|
|
||||||
|
|
||||||
constructor(audioContext) {
|
|
||||||
this.audioContext = audioContext;
|
|
||||||
this.output = new SuperdoughOutput(audioContext);
|
|
||||||
}
|
|
||||||
|
|
||||||
reset() {
|
|
||||||
Array.from(this.nodes).forEach((node) => {
|
|
||||||
node.disconnect();
|
|
||||||
});
|
|
||||||
this.nodes = {};
|
|
||||||
this.output.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
duck(targetOrbits, t, onsettime = 0, attacktime = 0.1, depth = 1) {
|
|
||||||
const targetArr = [targetOrbits].flat();
|
|
||||||
const onsetArr = [onsettime].flat();
|
|
||||||
const attackArr = [attacktime].flat();
|
|
||||||
const depthArr = [depth].flat();
|
|
||||||
|
|
||||||
targetArr.forEach((target, idx) => {
|
|
||||||
const orbit = this.nodes[target];
|
|
||||||
|
|
||||||
if (orbit == null) {
|
|
||||||
errorLogger(new Error(`duck target orbit ${target} does not exist`), 'superdough');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const onset = onsetArr[idx] ?? onsetArr[0];
|
|
||||||
const attack = Math.max(attackArr[idx] ?? attackArr[0], 0.002);
|
|
||||||
const depth = depthArr[idx] ?? depthArr[0];
|
|
||||||
|
|
||||||
orbit.duck(t, onset, attack, depth);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
getOrbit(orbitNum, channels) {
|
|
||||||
if (this.nodes[orbitNum] == null) {
|
|
||||||
this.nodes[orbitNum] = new Orbit(this.audioContext);
|
|
||||||
this.output.connectToDestination(this.nodes[orbitNum].output, channels);
|
|
||||||
}
|
|
||||||
return this.nodes[orbitNum];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,22 +1,39 @@
|
|||||||
import { clamp } from './util.mjs';
|
import { clamp, midiToFreq, noteToMidi } from './util.mjs';
|
||||||
import { registerSound, soundMap } from './superdough.mjs';
|
import { registerSound, getAudioContext, soundMap, getLfo } from './superdough.mjs';
|
||||||
import { getAudioContext } from './audioContext.mjs';
|
|
||||||
import {
|
import {
|
||||||
applyFM,
|
applyFM,
|
||||||
destroyAudioWorkletNode,
|
|
||||||
gainNode,
|
gainNode,
|
||||||
getADSRValues,
|
getADSRValues,
|
||||||
getFrequencyFromValue,
|
|
||||||
getLfo,
|
|
||||||
getParamADSR,
|
getParamADSR,
|
||||||
getPitchEnvelope,
|
getPitchEnvelope,
|
||||||
getVibratoOscillator,
|
getVibratoOscillator,
|
||||||
|
webAudioTimeout,
|
||||||
getWorklet,
|
getWorklet,
|
||||||
noises,
|
noises,
|
||||||
webAudioTimeout,
|
|
||||||
} from './helpers.mjs';
|
} from './helpers.mjs';
|
||||||
import { getNoiseMix, getNoiseOscillator } from './noise.mjs';
|
import { getNoiseMix, getNoiseOscillator } from './noise.mjs';
|
||||||
|
|
||||||
|
const getFrequencyFromValue = (value, defaultNote = 36) => {
|
||||||
|
let { note, freq } = value;
|
||||||
|
note = note || defaultNote;
|
||||||
|
if (typeof note === 'string') {
|
||||||
|
note = noteToMidi(note); // e.g. c3 => 48
|
||||||
|
}
|
||||||
|
// get frequency
|
||||||
|
if (!freq && typeof note === 'number') {
|
||||||
|
freq = midiToFreq(note); // + 48);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Number(freq);
|
||||||
|
};
|
||||||
|
function destroyAudioWorkletNode(node) {
|
||||||
|
if (node == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
node.disconnect();
|
||||||
|
node.parameters.get('end')?.setValueAtTime(0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
const waveforms = ['triangle', 'square', 'sawtooth', 'sine'];
|
const waveforms = ['triangle', 'square', 'sawtooth', 'sine'];
|
||||||
const waveformAliases = [
|
const waveformAliases = [
|
||||||
['tri', 'triangle'],
|
['tri', 'triangle'],
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ export const tokenizeNote = (note) => {
|
|||||||
if (typeof note !== 'string') {
|
if (typeof note !== 'string') {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
const [pc, acc = '', oct] = note.match(/^([a-gA-G])([#bsf]*)(-?[0-9]*)$/)?.slice(1) || [];
|
const [pc, acc = '', oct] = note.match(/^([a-gA-G])([#bsf]*)([0-9]*)$/)?.slice(1) || [];
|
||||||
if (!pc) {
|
if (!pc) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
@@ -76,32 +76,3 @@ export function cycleToSeconds(cycle, cps) {
|
|||||||
export function secondsToCycle(t, cps) {
|
export function secondsToCycle(t, cps) {
|
||||||
return t * cps;
|
return t * cps;
|
||||||
}
|
}
|
||||||
|
|
||||||
// deduces relevant info for sample loading from hap.value and sample definition
|
|
||||||
// it encapsulates the core sampler logic into a pure and synchronous function
|
|
||||||
// hapValue: Hap.value, bank: sample bank definition for sound "s" (values in strudel.json format)
|
|
||||||
export function getCommonSampleInfo(hapValue, bank) {
|
|
||||||
const { s, n = 0 } = hapValue;
|
|
||||||
let midi = valueToMidi(hapValue, 36);
|
|
||||||
let transpose = midi - 36; // C3 is middle C;
|
|
||||||
let url;
|
|
||||||
let index = 0;
|
|
||||||
if (Array.isArray(bank)) {
|
|
||||||
index = getSoundIndex(n, bank.length);
|
|
||||||
url = bank[index];
|
|
||||||
} else {
|
|
||||||
const midiDiff = (noteA) => noteToMidi(noteA) - midi;
|
|
||||||
// object format will expect keys as notes
|
|
||||||
const closest = Object.keys(bank)
|
|
||||||
.filter((k) => !k.startsWith('_'))
|
|
||||||
.reduce(
|
|
||||||
(closest, key, j) => (!closest || Math.abs(midiDiff(key)) < Math.abs(midiDiff(closest)) ? key : closest),
|
|
||||||
null,
|
|
||||||
);
|
|
||||||
transpose = -midiDiff(closest); // semitones to repitch
|
|
||||||
index = getSoundIndex(n, bank[closest].length);
|
|
||||||
url = bank[closest][index];
|
|
||||||
}
|
|
||||||
const label = `${s}:${index}`;
|
|
||||||
return { transpose, url, index, midi, label };
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,336 +0,0 @@
|
|||||||
import { getAudioContext, registerSound } from './index.mjs';
|
|
||||||
import { getCommonSampleInfo } from './util.mjs';
|
|
||||||
import {
|
|
||||||
applyFM,
|
|
||||||
applyParameterModulators,
|
|
||||||
destroyAudioWorkletNode,
|
|
||||||
getADSRValues,
|
|
||||||
getFrequencyFromValue,
|
|
||||||
getParamADSR,
|
|
||||||
getPitchEnvelope,
|
|
||||||
getVibratoOscillator,
|
|
||||||
getWorklet,
|
|
||||||
webAudioTimeout,
|
|
||||||
} from './helpers.mjs';
|
|
||||||
import { logger } from './logger.mjs';
|
|
||||||
|
|
||||||
export const Warpmode = Object.freeze({
|
|
||||||
NONE: 0,
|
|
||||||
ASYM: 1,
|
|
||||||
MIRROR: 2,
|
|
||||||
BENDP: 3,
|
|
||||||
BENDM: 4,
|
|
||||||
BENDMP: 5,
|
|
||||||
SYNC: 6,
|
|
||||||
QUANT: 7,
|
|
||||||
FOLD: 8,
|
|
||||||
PWM: 9,
|
|
||||||
ORBIT: 10,
|
|
||||||
SPIN: 11,
|
|
||||||
CHAOS: 12,
|
|
||||||
PRIMES: 13,
|
|
||||||
BINARY: 14,
|
|
||||||
BROWNIAN: 15,
|
|
||||||
RECIPROCAL: 16,
|
|
||||||
WORMHOLE: 17,
|
|
||||||
LOGISTIC: 18,
|
|
||||||
SIGMOID: 19,
|
|
||||||
FRACTAL: 20,
|
|
||||||
FLIP: 21,
|
|
||||||
});
|
|
||||||
|
|
||||||
const seenKeys = new Set();
|
|
||||||
async function getPayload(url, label, frameLen = 2048) {
|
|
||||||
const key = `${url},${frameLen}`;
|
|
||||||
if (!seenKeys.has(key)) {
|
|
||||||
const buf = await loadBuffer(url, label);
|
|
||||||
const ch0 = buf.getChannelData(0);
|
|
||||||
const total = ch0.length;
|
|
||||||
const numFrames = Math.max(1, Math.floor(total / frameLen));
|
|
||||||
const frames = new Array(numFrames);
|
|
||||||
for (let i = 0; i < numFrames; i++) {
|
|
||||||
const start = i * frameLen;
|
|
||||||
frames[i] = ch0.subarray(start, start + frameLen);
|
|
||||||
}
|
|
||||||
seenKeys.add(key);
|
|
||||||
return { frames, frameLen, numFrames, key };
|
|
||||||
}
|
|
||||||
return { frameLen, key }; // worklet will use the cached version
|
|
||||||
}
|
|
||||||
|
|
||||||
function humanFileSize(bytes, si) {
|
|
||||||
var thresh = si ? 1000 : 1024;
|
|
||||||
if (bytes < thresh) return bytes + ' B';
|
|
||||||
var units = si
|
|
||||||
? ['kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
|
|
||||||
: ['KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'];
|
|
||||||
var u = -1;
|
|
||||||
do {
|
|
||||||
bytes /= thresh;
|
|
||||||
++u;
|
|
||||||
} while (bytes >= thresh);
|
|
||||||
return bytes.toFixed(1) + ' ' + units[u];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Extract the sample rate of a .wav file
|
|
||||||
function parseWavSampleRate(arrBuf) {
|
|
||||||
const dv = new DataView(arrBuf);
|
|
||||||
// Header is "RIFF<chunk size (4 bytes)>WAVE", so 12 bytes
|
|
||||||
let p = 12;
|
|
||||||
// Look through chunks for the format header
|
|
||||||
// (they will always have an 8 byte header (id and size) followed by a payload)
|
|
||||||
while (p + 8 <= dv.byteLength) {
|
|
||||||
// Parse id
|
|
||||||
const id = String.fromCharCode(dv.getUint8(p), dv.getUint8(p + 1), dv.getUint8(p + 2), dv.getUint8(p + 3));
|
|
||||||
// Parse chunk size
|
|
||||||
const size = dv.getUint32(p + 4, true);
|
|
||||||
if (id === 'fmt ') {
|
|
||||||
// The format chunk contains the sample rate after
|
|
||||||
// 8 bytes of header, 2 bytes of format tag, 2 bytes of num channels
|
|
||||||
// (for a total of 12)
|
|
||||||
return dv.getUint32(p + 12, true);
|
|
||||||
}
|
|
||||||
// Advance to next chunk
|
|
||||||
p += 8 + size + (size & 1);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
async function decodeAtNativeRate(arr) {
|
|
||||||
const sr = parseWavSampleRate(arr) || 44100;
|
|
||||||
const tempAC = new OfflineAudioContext(1, 1, sr);
|
|
||||||
return await tempAC.decodeAudioData(arr);
|
|
||||||
}
|
|
||||||
|
|
||||||
const loadCache = {};
|
|
||||||
const loadBuffer = (url, label) => {
|
|
||||||
url = url.replace('#', '%23');
|
|
||||||
if (!loadCache[url]) {
|
|
||||||
logger(`[wavetable] load table ${label}..`, 'load-table', { url });
|
|
||||||
const timestamp = Date.now();
|
|
||||||
loadCache[url] = fetch(url)
|
|
||||||
.then((res) => res.arrayBuffer())
|
|
||||||
.then(async (res) => {
|
|
||||||
const took = Date.now() - timestamp;
|
|
||||||
const size = humanFileSize(res.byteLength);
|
|
||||||
logger(`[wavetable] load table ${label}... done! loaded ${size} in ${took}ms`, 'loaded-table', { url });
|
|
||||||
const decoded = await decodeAtNativeRate(res);
|
|
||||||
return decoded;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return loadCache[url];
|
|
||||||
};
|
|
||||||
|
|
||||||
function githubPath(base, subpath = '') {
|
|
||||||
if (!base.startsWith('github:')) {
|
|
||||||
throw new Error('expected "github:" at the start of pseudoUrl');
|
|
||||||
}
|
|
||||||
let [_, path] = base.split('github:');
|
|
||||||
path = path.endsWith('/') ? path.slice(0, -1) : path;
|
|
||||||
if (path.split('/').length === 2) {
|
|
||||||
// assume main as default branch if none set
|
|
||||||
path += '/main';
|
|
||||||
}
|
|
||||||
return `https://raw.githubusercontent.com/${path}/${subpath}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
const _processTables = (json, baseUrl, frameLen, options = {}) => {
|
|
||||||
baseUrl = json._base || baseUrl;
|
|
||||||
return Object.entries(json).forEach(([key, tables]) => {
|
|
||||||
if (key === '_base') return false;
|
|
||||||
if (typeof tables === 'string') {
|
|
||||||
tables = [tables];
|
|
||||||
}
|
|
||||||
if (typeof tables !== 'object') {
|
|
||||||
throw new Error('wrong json format for ' + key);
|
|
||||||
}
|
|
||||||
let resolvedUrl = baseUrl;
|
|
||||||
if (resolvedUrl.startsWith('github:')) {
|
|
||||||
resolvedUrl = githubPath(resolvedUrl, '');
|
|
||||||
}
|
|
||||||
tables = tables
|
|
||||||
.map((t) => resolvedUrl + t)
|
|
||||||
.filter((t) => {
|
|
||||||
if (!t.toLowerCase().endsWith('.wav')) {
|
|
||||||
logger(`[wavetable] skipping ${t} -- wavetables must be ".wav" format`);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
if (tables.length) {
|
|
||||||
registerWaveTable(key, tables, { baseUrl, frameLen });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
export function registerWaveTable(key, tables, params) {
|
|
||||||
registerSound(
|
|
||||||
key,
|
|
||||||
(t, hapValue, onended, cps) => {
|
|
||||||
return onTriggerSynth(t, hapValue, onended, tables, cps, params?.frameLen ?? 2048);
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'wavetable',
|
|
||||||
tables,
|
|
||||||
...params,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Loads a collection of wavetables to use with `s`
|
|
||||||
*
|
|
||||||
* @name tables
|
|
||||||
*/
|
|
||||||
export const tables = async (url, frameLen, json, options = {}) => {
|
|
||||||
if (json !== undefined) return _processTables(json, url, frameLen);
|
|
||||||
if (url.startsWith('github:')) {
|
|
||||||
url = githubPath(url, 'strudel.json');
|
|
||||||
}
|
|
||||||
if (url.startsWith('local:')) {
|
|
||||||
url = `http://localhost:5432`;
|
|
||||||
}
|
|
||||||
if (typeof fetch !== 'function') {
|
|
||||||
// not a browser
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (typeof fetch === 'undefined') {
|
|
||||||
// skip fetch when in node / testing
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
return fetch(url)
|
|
||||||
.then((res) => res.json())
|
|
||||||
.then((json) => _processTables(json, url, frameLen, options))
|
|
||||||
.catch((error) => {
|
|
||||||
console.error(error);
|
|
||||||
throw new Error(`error loading "${url}"`);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
export async function onTriggerSynth(t, value, onended, tables, cps, frameLen) {
|
|
||||||
const { s, n = 0, duration, clip } = value;
|
|
||||||
const ac = getAudioContext();
|
|
||||||
const [attack, decay, sustain, release] = getADSRValues([value.attack, value.decay, value.sustain, value.release]);
|
|
||||||
let { warpmode } = value;
|
|
||||||
if (typeof warpmode === 'string') {
|
|
||||||
warpmode = Warpmode[warpmode.toUpperCase()] ?? Warpmode.NONE;
|
|
||||||
}
|
|
||||||
const frequency = getFrequencyFromValue(value);
|
|
||||||
const { url, label } = getCommonSampleInfo(value, tables);
|
|
||||||
const payload = await getPayload(url, label, frameLen);
|
|
||||||
let holdEnd = t + duration;
|
|
||||||
if (clip !== undefined) {
|
|
||||||
holdEnd = Math.min(t + clip * duration, holdEnd);
|
|
||||||
}
|
|
||||||
const endWithRelease = holdEnd + release;
|
|
||||||
const envEnd = endWithRelease + 0.01;
|
|
||||||
const source = getWorklet(
|
|
||||||
ac,
|
|
||||||
'wavetable-oscillator-processor',
|
|
||||||
{
|
|
||||||
begin: t,
|
|
||||||
end: envEnd,
|
|
||||||
frequency,
|
|
||||||
freqspread: value.detune,
|
|
||||||
position: value.wt,
|
|
||||||
warp: value.warp,
|
|
||||||
warpMode: warpmode,
|
|
||||||
voices: Math.max(value.unison ?? 1, 1),
|
|
||||||
panspread: value.spread,
|
|
||||||
phaserand: (value.wtphaserand ?? value.unison > 1) ? 1 : 0,
|
|
||||||
},
|
|
||||||
{ outputChannelCount: [2] },
|
|
||||||
);
|
|
||||||
source.port.postMessage({ type: 'table', payload });
|
|
||||||
if (ac.currentTime > t) {
|
|
||||||
logger(`[wavetable] still loading sound "${s}:${n}"`, 'highlight');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const posADSRParams = [value.wtattack, value.wtdecay, value.wtsustain, value.wtrelease];
|
|
||||||
const warpADSRParams = [value.warpattack, value.warpdecay, value.warpsustain, value.warprelease];
|
|
||||||
const wtParams = source.parameters;
|
|
||||||
const positionParam = wtParams.get('position');
|
|
||||||
const warpParam = wtParams.get('warp');
|
|
||||||
|
|
||||||
let wtrate = value.wtrate;
|
|
||||||
if (value.wtsync != null) {
|
|
||||||
wtrate = cps * value.wtsync;
|
|
||||||
}
|
|
||||||
|
|
||||||
const wtPosModulators = applyParameterModulators(
|
|
||||||
ac,
|
|
||||||
positionParam,
|
|
||||||
t,
|
|
||||||
endWithRelease,
|
|
||||||
{
|
|
||||||
offset: value.wt,
|
|
||||||
amount: value.wtenv,
|
|
||||||
defaultAmount: 0.5,
|
|
||||||
shape: 'linear',
|
|
||||||
values: posADSRParams,
|
|
||||||
holdEnd,
|
|
||||||
defaultValues: [0, 0.5, 0, 0.1],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
frequency: wtrate,
|
|
||||||
depth: value.wtdepth,
|
|
||||||
defaultDepth: 0.5,
|
|
||||||
shape: value.wtshape,
|
|
||||||
skew: value.wtskew,
|
|
||||||
dcoffset: value.wtdc ?? 0,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
let warprate = value.warprate;
|
|
||||||
if (value.warpsync != null) {
|
|
||||||
warprate = warprate = cps * value.warpsync;
|
|
||||||
}
|
|
||||||
const wtWarpModulators = applyParameterModulators(
|
|
||||||
ac,
|
|
||||||
warpParam,
|
|
||||||
t,
|
|
||||||
endWithRelease,
|
|
||||||
{
|
|
||||||
offset: value.warp,
|
|
||||||
amount: value.warpenv,
|
|
||||||
defaultAmount: 0.5,
|
|
||||||
shape: 'linear',
|
|
||||||
values: warpADSRParams,
|
|
||||||
holdEnd,
|
|
||||||
defaultValues: [0, 0.5, 0, 0.1],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
frequency: warprate,
|
|
||||||
depth: value.warpdepth,
|
|
||||||
defaultDepth: 0.5,
|
|
||||||
shape: value.warpshape,
|
|
||||||
skew: value.warpskew,
|
|
||||||
dcoffset: value.warpdc ?? 0,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
const vibratoOscillator = getVibratoOscillator(source.parameters.get('detune'), value, t);
|
|
||||||
const fm = applyFM(source.parameters.get('frequency'), value, t);
|
|
||||||
const envGain = ac.createGain();
|
|
||||||
const node = source.connect(envGain);
|
|
||||||
getParamADSR(node.gain, attack, decay, sustain, release, 0, 0.3, t, holdEnd, 'linear');
|
|
||||||
getPitchEnvelope(source.parameters.get('detune'), value, t, holdEnd);
|
|
||||||
const handle = { node, source };
|
|
||||||
const timeoutNode = webAudioTimeout(
|
|
||||||
ac,
|
|
||||||
() => {
|
|
||||||
destroyAudioWorkletNode(source);
|
|
||||||
vibratoOscillator?.stop();
|
|
||||||
fm?.stop();
|
|
||||||
node.disconnect();
|
|
||||||
wtPosModulators?.disconnect();
|
|
||||||
wtWarpModulators?.disconnect();
|
|
||||||
onended();
|
|
||||||
},
|
|
||||||
t,
|
|
||||||
envEnd,
|
|
||||||
);
|
|
||||||
handle.stop = (time) => {
|
|
||||||
timeoutNode.stop(time);
|
|
||||||
};
|
|
||||||
return handle;
|
|
||||||
}
|
|
||||||
@@ -4,24 +4,9 @@
|
|||||||
|
|
||||||
import OLAProcessor from './ola-processor';
|
import OLAProcessor from './ola-processor';
|
||||||
import FFT from './fft.js';
|
import FFT from './fft.js';
|
||||||
import { getDistortionAlgorithm } from './helpers.mjs';
|
|
||||||
|
|
||||||
const clamp = (num, min, max) => Math.min(Math.max(num, min), max);
|
const clamp = (num, min, max) => Math.min(Math.max(num, min), max);
|
||||||
const mod = (n, m) => ((n % m) + m) % m;
|
const _mod = (n, m) => ((n % m) + m) % m;
|
||||||
const lerp = (a, b, n) => n * (b - a) + a;
|
|
||||||
const pv = (arr, n) => arr[n] ?? arr[0];
|
|
||||||
const frac = (x) => x - Math.floor(x);
|
|
||||||
const ffloor = (x) => x | 0; // fast floor for non-negative
|
|
||||||
|
|
||||||
const getUnisonDetune = (unison, detune, voiceIndex) => {
|
|
||||||
if (unison < 2) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return lerp(-detune * 0.5, detune * 0.5, voiceIndex / (unison - 1));
|
|
||||||
};
|
|
||||||
const applySemitoneDetuneToFrequency = (frequency, detune) => {
|
|
||||||
return frequency * Math.pow(2, detune / 12);
|
|
||||||
};
|
|
||||||
|
|
||||||
// Restrict phase to the range [0, maxPhase) via wrapping
|
// Restrict phase to the range [0, maxPhase) via wrapping
|
||||||
function wrapPhase(phase, maxPhase = 1) {
|
function wrapPhase(phase, maxPhase = 1) {
|
||||||
@@ -138,7 +123,7 @@ class LFOProcessor extends AudioWorkletProcessor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
process(_inputs, outputs, parameters) {
|
process(inputs, outputs, parameters) {
|
||||||
const begin = parameters['begin'][0];
|
const begin = parameters['begin'][0];
|
||||||
if (currentTime >= parameters.end[0]) {
|
if (currentTime >= parameters.end[0]) {
|
||||||
return false;
|
return false;
|
||||||
@@ -165,7 +150,7 @@ class LFOProcessor extends AudioWorkletProcessor {
|
|||||||
const blockSize = output[0].length ?? 0;
|
const blockSize = output[0].length ?? 0;
|
||||||
|
|
||||||
if (this.phase == null) {
|
if (this.phase == null) {
|
||||||
this.phase = mod(time * frequency + phaseoffset, 1);
|
this.phase = _mod(time * frequency + phaseoffset, 1);
|
||||||
}
|
}
|
||||||
const dt = frequency / sampleRate;
|
const dt = frequency / sampleRate;
|
||||||
for (let n = 0; n < blockSize; n++) {
|
for (let n = 0; n < blockSize; n++) {
|
||||||
@@ -286,73 +271,6 @@ class ShapeProcessor extends AudioWorkletProcessor {
|
|||||||
}
|
}
|
||||||
registerProcessor('shape-processor', ShapeProcessor);
|
registerProcessor('shape-processor', ShapeProcessor);
|
||||||
|
|
||||||
class TwoPoleFilter {
|
|
||||||
s0 = 0;
|
|
||||||
s1 = 0;
|
|
||||||
update(s, cutoff, resonance = 0) {
|
|
||||||
// Out of bound values can produce NaNs
|
|
||||||
resonance = clamp(resonance, 0, 1);
|
|
||||||
cutoff = clamp(cutoff, 0, sampleRate / 2 - 1);
|
|
||||||
const c = clamp(2 * Math.sin(cutoff * (_PI / sampleRate)), 0, 1.14);
|
|
||||||
const r = Math.pow(0.5, (resonance + 0.125) / 0.125);
|
|
||||||
const mrc = 1 - r * c;
|
|
||||||
this.s0 = mrc * this.s0 - c * this.s1 + c * s; // bpf
|
|
||||||
this.s1 = mrc * this.s1 + c * this.s0; // lpf
|
|
||||||
return this.s1; // return lpf by default
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class DJFProcessor extends AudioWorkletProcessor {
|
|
||||||
static get parameterDescriptors() {
|
|
||||||
return [{ name: 'value', defaultValue: 0.5 }];
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor() {
|
|
||||||
super();
|
|
||||||
this.filters = [new TwoPoleFilter(), new TwoPoleFilter()];
|
|
||||||
}
|
|
||||||
|
|
||||||
process(inputs, outputs, parameters) {
|
|
||||||
const input = inputs[0];
|
|
||||||
const output = outputs[0];
|
|
||||||
|
|
||||||
const hasInput = !(input[0] === undefined);
|
|
||||||
this.started = hasInput;
|
|
||||||
|
|
||||||
const value = clamp(parameters.value[0], 0, 1);
|
|
||||||
let filterType = 'none';
|
|
||||||
let cutoff;
|
|
||||||
let v = 1;
|
|
||||||
if (value > 0.51) {
|
|
||||||
filterType = 'hipass';
|
|
||||||
v = (value - 0.5) * 2;
|
|
||||||
} else if (value < 0.49) {
|
|
||||||
filterType = 'lopass';
|
|
||||||
v = value * 2;
|
|
||||||
}
|
|
||||||
cutoff = Math.pow(v * 11, 4);
|
|
||||||
|
|
||||||
for (let i = 0; i < input.length; i++) {
|
|
||||||
for (let n = 0; n < blockSize; n++) {
|
|
||||||
if (filterType == 'none') {
|
|
||||||
output[i][n] = input[i][n];
|
|
||||||
} else {
|
|
||||||
this.filters[i].update(input[i][n], cutoff, 0.1);
|
|
||||||
if (filterType === 'lopass') {
|
|
||||||
output[i][n] = this.filters[i].s1;
|
|
||||||
} else if (filterType === 'hipass') {
|
|
||||||
output[i][n] = input[i][n] - this.filters[i].s1;
|
|
||||||
} else {
|
|
||||||
output[i][n] = input[i][n];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
registerProcessor('djf-processor', DJFProcessor);
|
|
||||||
|
|
||||||
function fast_tanh(x) {
|
function fast_tanh(x) {
|
||||||
const x2 = x * x;
|
const x2 = x * x;
|
||||||
return (x * (27.0 + x2)) / (27.0 + 9.0 * x2);
|
return (x * (27.0 + x2)) / (27.0 + 9.0 * x2);
|
||||||
@@ -431,10 +349,9 @@ class DistortProcessor extends AudioWorkletProcessor {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor({ processorOptions }) {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
this.started = false;
|
this.started = false;
|
||||||
this.algorithm = getDistortionAlgorithm(processorOptions.algorithm);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
process(inputs, outputs, parameters) {
|
process(inputs, outputs, parameters) {
|
||||||
@@ -446,12 +363,13 @@ class DistortProcessor extends AudioWorkletProcessor {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
this.started = hasInput;
|
this.started = hasInput;
|
||||||
|
|
||||||
|
const shape = Math.expm1(parameters.distort[0]);
|
||||||
|
const postgain = Math.max(0.001, Math.min(1, parameters.postgain[0]));
|
||||||
|
|
||||||
for (let n = 0; n < blockSize; n++) {
|
for (let n = 0; n < blockSize; n++) {
|
||||||
const postgain = clamp(pv(parameters.postgain, n), 0.001, 1);
|
for (let i = 0; i < input.length; i++) {
|
||||||
const shape = Math.expm1(pv(parameters.distort, n));
|
output[i][n] = (((1 + shape) * input[i][n]) / (1 + shape * Math.abs(input[i][n]))) * postgain;
|
||||||
for (let ch = 0; ch < input.length; ch++) {
|
|
||||||
const x = input[ch][n];
|
|
||||||
output[ch][n] = postgain * this.algorithm(x, shape);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -460,6 +378,21 @@ class DistortProcessor extends AudioWorkletProcessor {
|
|||||||
registerProcessor('distort-processor', DistortProcessor);
|
registerProcessor('distort-processor', DistortProcessor);
|
||||||
|
|
||||||
// SUPERSAW
|
// SUPERSAW
|
||||||
|
function lerp(a, b, n) {
|
||||||
|
return n * (b - a) + a;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getUnisonDetune(unison, detune, voiceIndex) {
|
||||||
|
if (unison < 2) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return lerp(-detune * 0.5, detune * 0.5, voiceIndex / (unison - 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
function applySemitoneDetuneToFrequency(frequency, detune) {
|
||||||
|
return frequency * Math.pow(2, detune / 12);
|
||||||
|
}
|
||||||
|
|
||||||
class SuperSawOscillatorProcessor extends AudioWorkletProcessor {
|
class SuperSawOscillatorProcessor extends AudioWorkletProcessor {
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
@@ -511,7 +444,7 @@ class SuperSawOscillatorProcessor extends AudioWorkletProcessor {
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
process(_input, outputs, params) {
|
process(input, outputs, params) {
|
||||||
if (currentTime <= params.begin[0]) {
|
if (currentTime <= params.begin[0]) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -521,17 +454,12 @@ class SuperSawOscillatorProcessor extends AudioWorkletProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const output = outputs[0];
|
const output = outputs[0];
|
||||||
|
const voices = params.voices[0];
|
||||||
for (let i = 0; i < output[0].length; i++) {
|
const freqspread = params.freqspread[0];
|
||||||
const detune = pv(params.detune, i);
|
const panspread = params.panspread[0] * 0.5 + 0.5;
|
||||||
const voices = pv(params.voices, i);
|
|
||||||
const freqspread = pv(params.freqspread, i);
|
|
||||||
const panspread = pv(params.panspread, i) * 0.5 + 0.5;
|
|
||||||
const gain1 = Math.sqrt(1 - panspread);
|
const gain1 = Math.sqrt(1 - panspread);
|
||||||
const gain2 = Math.sqrt(panspread);
|
const gain2 = Math.sqrt(panspread);
|
||||||
let freq = pv(params.frequency, i);
|
|
||||||
// Main detuning
|
|
||||||
freq = applySemitoneDetuneToFrequency(freq, detune / 100);
|
|
||||||
for (let n = 0; n < voices; n++) {
|
for (let n = 0; n < voices; n++) {
|
||||||
const isOdd = (n & 1) == 1;
|
const isOdd = (n & 1) == 1;
|
||||||
let gainL = gain1;
|
let gainL = gain1;
|
||||||
@@ -541,11 +469,14 @@ class SuperSawOscillatorProcessor extends AudioWorkletProcessor {
|
|||||||
gainL = gain2;
|
gainL = gain2;
|
||||||
gainR = gain1;
|
gainR = gain1;
|
||||||
}
|
}
|
||||||
|
for (let i = 0; i < output[0].length; i++) {
|
||||||
|
// Main detuning
|
||||||
|
let freq = applySemitoneDetuneToFrequency(params.frequency[i] ?? params.frequency[0], params.detune[0] / 100);
|
||||||
// Individual voice detuning
|
// Individual voice detuning
|
||||||
const freqVoice = applySemitoneDetuneToFrequency(freq, getUnisonDetune(voices, freqspread, n));
|
freq = applySemitoneDetuneToFrequency(freq, getUnisonDetune(voices, freqspread, n));
|
||||||
// We must wrap this here because it is passed into sawblep below which
|
// We must wrap this here because it is passed into sawblep below which
|
||||||
// has domain [0, 1]
|
// has domain [0, 1]
|
||||||
const dt = mod(freqVoice / sampleRate, 1);
|
const dt = _mod(freq / sampleRate, 1);
|
||||||
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 = waveshapes.sawblep(this.phase[n], dt);
|
||||||
|
|
||||||
@@ -976,346 +907,3 @@ class ByteBeatProcessor extends AudioWorkletProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
registerProcessor('byte-beat-processor', ByteBeatProcessor);
|
registerProcessor('byte-beat-processor', ByteBeatProcessor);
|
||||||
|
|
||||||
export const WarpMode = Object.freeze({
|
|
||||||
NONE: 0,
|
|
||||||
ASYM: 1,
|
|
||||||
MIRROR: 2,
|
|
||||||
BENDP: 3,
|
|
||||||
BENDM: 4,
|
|
||||||
BENDMP: 5,
|
|
||||||
SYNC: 6,
|
|
||||||
QUANT: 7,
|
|
||||||
FOLD: 8,
|
|
||||||
PWM: 9,
|
|
||||||
ORBIT: 10,
|
|
||||||
SPIN: 11,
|
|
||||||
CHAOS: 12,
|
|
||||||
PRIMES: 13,
|
|
||||||
BINARY: 14,
|
|
||||||
BROWNIAN: 15,
|
|
||||||
RECIPROCAL: 16,
|
|
||||||
WORMHOLE: 17,
|
|
||||||
LOGISTIC: 18,
|
|
||||||
SIGMOID: 19,
|
|
||||||
FRACTAL: 20,
|
|
||||||
FLIP: 21,
|
|
||||||
});
|
|
||||||
|
|
||||||
function hash32(u) {
|
|
||||||
u = u + 0x7ed55d16 + (u << 12);
|
|
||||||
u = u ^ 0xc761c23c ^ (u >>> 19);
|
|
||||||
u = u + 0x165667b1 + (u << 5);
|
|
||||||
u = (u + 0xd3a2646c) ^ (u << 9);
|
|
||||||
u = u + 0xfd7046c5 + (u << 3);
|
|
||||||
u = u ^ 0xb55a4f09 ^ (u >>> 16);
|
|
||||||
return u >>> 0;
|
|
||||||
}
|
|
||||||
const hash01 = (i) => (hash32(i) >>> 8) / 0x01000000;
|
|
||||||
|
|
||||||
function bitReverse(i, n) {
|
|
||||||
let r = 0;
|
|
||||||
for (let b = 0; b < n; b++) {
|
|
||||||
r = (r << 1) | (i & 1);
|
|
||||||
i >>>= 1;
|
|
||||||
}
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
function noise(x) {
|
|
||||||
const i = Math.floor(x),
|
|
||||||
f = x - i;
|
|
||||||
const a = hash01(i),
|
|
||||||
b = hash01(i + 1);
|
|
||||||
return a + (b - a) * f;
|
|
||||||
}
|
|
||||||
|
|
||||||
function brownian(x, oct = 4) {
|
|
||||||
let amp = 0.5,
|
|
||||||
sum = 0,
|
|
||||||
norm = 0,
|
|
||||||
freq = 1;
|
|
||||||
for (let o = 0; o < oct; o++) {
|
|
||||||
sum += amp * noise(x * freq);
|
|
||||||
norm += amp;
|
|
||||||
amp *= 0.5;
|
|
||||||
freq *= 2;
|
|
||||||
}
|
|
||||||
return (sum / norm) * 2 - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
const tablesCache = {};
|
|
||||||
class WavetableOscillatorProcessor extends AudioWorkletProcessor {
|
|
||||||
static get parameterDescriptors() {
|
|
||||||
return [
|
|
||||||
{ name: 'begin', defaultValue: 0, min: 0, max: Number.POSITIVE_INFINITY },
|
|
||||||
{ name: 'end', defaultValue: 0, min: 0, max: Number.POSITIVE_INFINITY },
|
|
||||||
{ name: 'frequency', defaultValue: 440, min: Number.EPSILON },
|
|
||||||
{ name: 'detune', defaultValue: 0 },
|
|
||||||
{ name: 'freqspread', defaultValue: 0.18, min: 0 },
|
|
||||||
{ name: 'position', defaultValue: 0, min: 0, max: 1 },
|
|
||||||
{ name: 'warp', defaultValue: 0, min: 0, max: 1 },
|
|
||||||
{ name: 'warpMode', defaultValue: 0 },
|
|
||||||
{ name: 'voices', defaultValue: 1, min: 1 },
|
|
||||||
{ name: 'panspread', defaultValue: 0.7, min: 0, max: 1 },
|
|
||||||
{ name: 'phaserand', defaultValue: 0, min: 0, max: 1 },
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor(options) {
|
|
||||||
super(options);
|
|
||||||
this.frameLen = 0;
|
|
||||||
this.numFrames = 0;
|
|
||||||
this.phase = [];
|
|
||||||
this.invSR = 1 / sampleRate;
|
|
||||||
|
|
||||||
this.port.onmessage = (e) => {
|
|
||||||
const { type, payload } = e.data || {};
|
|
||||||
if (type === 'table') {
|
|
||||||
const key = payload.key;
|
|
||||||
this.frameLen = payload.frameLen;
|
|
||||||
if (!tablesCache[key]) {
|
|
||||||
const tables = [payload.frames];
|
|
||||||
let table = tables[0];
|
|
||||||
for (let level = 1; level < 1; level++) {
|
|
||||||
const nextLen = table.length >> 1;
|
|
||||||
const nextTable = table.map((frame) => {
|
|
||||||
const avg = new Float32Array(nextLen);
|
|
||||||
for (let i = 0; i < nextLen; i++) {
|
|
||||||
avg[i] = (frame[2 * i] + frame[2 * i + 1]) / 2;
|
|
||||||
}
|
|
||||||
return avg;
|
|
||||||
});
|
|
||||||
tables.push(nextTable);
|
|
||||||
table = nextTable;
|
|
||||||
if (nextLen <= 32) break;
|
|
||||||
}
|
|
||||||
tablesCache[key] = tables;
|
|
||||||
}
|
|
||||||
this.tables = tablesCache[key];
|
|
||||||
this.numFrames = this.tables[0].length;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
_mirror(x) {
|
|
||||||
return 1 - Math.abs(2 * x - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
_toBits(amt, min = 2, max = 12) {
|
|
||||||
const b = max + (min - max) * amt;
|
|
||||||
return { b, n: Math.round(Math.pow(2, b)) };
|
|
||||||
}
|
|
||||||
|
|
||||||
_warpPhase(phase, amt, mode) {
|
|
||||||
switch (mode) {
|
|
||||||
case WarpMode.NONE: {
|
|
||||||
return phase;
|
|
||||||
}
|
|
||||||
case WarpMode.ASYM: {
|
|
||||||
const a = 0.01 + 0.99 * amt;
|
|
||||||
return phase < a ? (0.5 * phase) / a : 0.5 + (0.5 * (phase - a)) / (1 - a);
|
|
||||||
}
|
|
||||||
case WarpMode.MIRROR: {
|
|
||||||
// Asym, then mirror
|
|
||||||
return this._mirror(this._warpPhase(phase, amt, WarpMode.ASYM));
|
|
||||||
}
|
|
||||||
case WarpMode.BENDP: {
|
|
||||||
return Math.pow(phase, 1 + 3 * amt);
|
|
||||||
}
|
|
||||||
case WarpMode.BENDM: {
|
|
||||||
return Math.pow(phase, 1 / (1 + 3 * amt));
|
|
||||||
}
|
|
||||||
case WarpMode.BENDMP: {
|
|
||||||
return amt < 0.5 ? this._warpPhase(phase, 1 - 2 * amt, 3) : this._warpPhase(phase, 2 * amt - 1, 2);
|
|
||||||
}
|
|
||||||
case WarpMode.SYNC: {
|
|
||||||
const syncRatio = Math.pow(16, amt * amt);
|
|
||||||
return (phase * syncRatio) % 1;
|
|
||||||
}
|
|
||||||
case WarpMode.QUANT: {
|
|
||||||
const { n } = this._toBits(amt);
|
|
||||||
return ffloor(phase * n) / n;
|
|
||||||
}
|
|
||||||
case WarpMode.FOLD: {
|
|
||||||
const K = 7;
|
|
||||||
const k = 1 + Math.max(1, Math.round(K * amt));
|
|
||||||
return Math.abs(frac(k * phase) - 0.5) * 2;
|
|
||||||
}
|
|
||||||
case WarpMode.PWM: {
|
|
||||||
const w = clamp(0.5 + 0.49 * (2 * amt - 1), 0, 1);
|
|
||||||
if (phase < w) return (phase / w) * 0.5;
|
|
||||||
return 0.5 + ((phase - w) / (1 - w)) * 0.5;
|
|
||||||
}
|
|
||||||
case WarpMode.ORBIT: {
|
|
||||||
const depth = 0.5 * amt;
|
|
||||||
const n = 3;
|
|
||||||
return frac(phase + depth * Math.sin(2 * Math.PI * n * phase));
|
|
||||||
}
|
|
||||||
case WarpMode.SPIN: {
|
|
||||||
const depth = 0.5 * amt;
|
|
||||||
const { n } = this._toBits(amt, 1, 6);
|
|
||||||
return frac(phase + depth * Math.sin(2 * Math.PI * n * phase));
|
|
||||||
}
|
|
||||||
case WarpMode.CHAOS: {
|
|
||||||
const r = 3.7 + 0.3 * amt;
|
|
||||||
const logistic = r * phase * (1 - phase);
|
|
||||||
return clamp((1 - amt) * phase + amt * logistic, 0, 1);
|
|
||||||
}
|
|
||||||
case WarpMode.PRIMES: {
|
|
||||||
const isPrime = (n) => {
|
|
||||||
if (n < 2) return false;
|
|
||||||
if (n % 2 === 0) return n === 2;
|
|
||||||
for (let d = 3; d * d <= n; d += 2) if (n % d === 0) return false;
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
let { n } = this._toBits(amt, 3);
|
|
||||||
while (!isPrime(n)) n++;
|
|
||||||
return ffloor(phase * n) / n;
|
|
||||||
}
|
|
||||||
case WarpMode.BINARY: {
|
|
||||||
let { b } = this._toBits(amt, 3);
|
|
||||||
b = Math.round(b);
|
|
||||||
const n = 1 << b;
|
|
||||||
const idx = ffloor(phase * n);
|
|
||||||
const ridx = bitReverse(idx, b);
|
|
||||||
return ridx / n;
|
|
||||||
}
|
|
||||||
case WarpMode.MODULAR: {
|
|
||||||
const { n } = this._toBits(amt);
|
|
||||||
const depth = 0.5 * amt;
|
|
||||||
const jump = frac(phase * n) / n;
|
|
||||||
return frac(phase + depth * jump);
|
|
||||||
}
|
|
||||||
case WarpMode.BROWNIAN: {
|
|
||||||
const disp = 0.25 * amt * brownian(64 * phase, 4);
|
|
||||||
return frac(phase + disp);
|
|
||||||
}
|
|
||||||
case WarpMode.RECIPROCAL: {
|
|
||||||
const g = 2 + 4 * amt;
|
|
||||||
const num = phase * g;
|
|
||||||
const den = phase + (1 - phase) * g;
|
|
||||||
const y = den > 1e-12 ? num / den : 0;
|
|
||||||
return clamp(y, 0, 1);
|
|
||||||
}
|
|
||||||
case WarpMode.WORMHOLE: {
|
|
||||||
const gap = clamp(0.8 * amt, 0, 1);
|
|
||||||
const a = 0.5 * (1 - gap);
|
|
||||||
const b = 0.5 * (1 + gap);
|
|
||||||
if (phase < a) return (phase / a) * 0.5;
|
|
||||||
if (phase > b) return 0.5 * (1 + (phase - b) / (1 - b));
|
|
||||||
return 0.5;
|
|
||||||
}
|
|
||||||
case WarpMode.LOGISTIC: {
|
|
||||||
let x = phase;
|
|
||||||
const r = 3.6 + 0.4 * amt;
|
|
||||||
const iters = 1 + Math.round(2 * amt);
|
|
||||||
for (let i = 0; i < iters; i++) x = r * x * (1 - x);
|
|
||||||
return clamp(x, 0, 1);
|
|
||||||
}
|
|
||||||
case WarpMode.SIGMOID: {
|
|
||||||
const k = 1 + 10 * amt;
|
|
||||||
const x = phase - 0.5;
|
|
||||||
const y = 1 / (1 + Math.exp(-k * x));
|
|
||||||
const y0 = 1 / (1 + Math.exp(0.5 * k));
|
|
||||||
const y1 = 1 / (1 + Math.exp(-0.5 * k));
|
|
||||||
return (y - y0) / (y1 - y0);
|
|
||||||
}
|
|
||||||
case WarpMode.FRACTAL: {
|
|
||||||
const d = 0.5 * Math.sin(2 * Math.PI * phase) * amt;
|
|
||||||
return frac(phase + d);
|
|
||||||
}
|
|
||||||
case WarpMode.FLIP: {
|
|
||||||
return phase;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
return phase;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_sampleFrame(frame, phase) {
|
|
||||||
const len = frame.length;
|
|
||||||
const pos = phase * len;
|
|
||||||
let i = pos | 0;
|
|
||||||
if (i >= len) i = 0; // fast wrap
|
|
||||||
const frac = pos - i;
|
|
||||||
const a = frame[i];
|
|
||||||
let i1 = i + 1;
|
|
||||||
if (i1 >= len) i1 = 0;
|
|
||||||
const b = frame[i1];
|
|
||||||
return a + (b - a) * frac;
|
|
||||||
}
|
|
||||||
|
|
||||||
_chooseMip(dphi) {
|
|
||||||
const approxHarm = clamp(dphi, 1e-6, 64);
|
|
||||||
let level = 0;
|
|
||||||
while (level + 1 < (this.tables?.length || 1) && approxHarm < this.tables[level][0].length / 8) {
|
|
||||||
level++;
|
|
||||||
}
|
|
||||||
return level;
|
|
||||||
}
|
|
||||||
|
|
||||||
process(_inputs, outputs, parameters) {
|
|
||||||
if (currentTime >= parameters.end[0]) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (currentTime <= parameters.begin[0]) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
const outL = outputs[0][0];
|
|
||||||
const outR = outputs[0][1] || outputs[0][0];
|
|
||||||
if (!this.tables) {
|
|
||||||
outL.fill(0);
|
|
||||||
if (outR !== outL) outR.set(outL);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
for (let i = 0; i < outL.length; i++) {
|
|
||||||
const detune = pv(parameters.detune, i);
|
|
||||||
const freqspread = pv(parameters.freqspread, i);
|
|
||||||
const tablePos = clamp(pv(parameters.position, i), 0, 1);
|
|
||||||
const idx = tablePos * (this.numFrames - 1);
|
|
||||||
const fIdx = idx | 0;
|
|
||||||
const frac = idx - fIdx;
|
|
||||||
const warpAmount = clamp(pv(parameters.warp, i), 0, 1);
|
|
||||||
const warpMode = pv(parameters.warpMode, i);
|
|
||||||
const voices = pv(parameters.voices, i);
|
|
||||||
const phaseRand = clamp(pv(parameters.phaserand, i), 0, 1);
|
|
||||||
const panspread = voices > 1 ? clamp(pv(parameters.panspread, i), 0, 1) : 0;
|
|
||||||
const gain1 = Math.sqrt(0.5 - 0.5 * panspread);
|
|
||||||
const gain2 = Math.sqrt(0.5 + 0.5 * panspread);
|
|
||||||
let f = pv(parameters.frequency, i);
|
|
||||||
f = applySemitoneDetuneToFrequency(f, detune / 100); // overall detune
|
|
||||||
const normalizer = 1 / Math.sqrt(voices);
|
|
||||||
for (let n = 0; n < voices; n++) {
|
|
||||||
const isOdd = (n & 1) == 1;
|
|
||||||
let gainL = gain1;
|
|
||||||
let gainR = gain2;
|
|
||||||
// invert right and left gain
|
|
||||||
if (isOdd) {
|
|
||||||
gainL = gain2;
|
|
||||||
gainR = gain1;
|
|
||||||
}
|
|
||||||
const fVoice = applySemitoneDetuneToFrequency(f, getUnisonDetune(voices, freqspread, n)); // voice detune
|
|
||||||
const dPhase = fVoice * this.invSR;
|
|
||||||
const level = this._chooseMip(dPhase);
|
|
||||||
const table = this.tables[level];
|
|
||||||
|
|
||||||
// warp phase then sample
|
|
||||||
this.phase[n] = this.phase[n] ?? Math.random() * phaseRand;
|
|
||||||
const ph = this._warpPhase(this.phase[n], warpAmount, warpMode);
|
|
||||||
const s0 = this._sampleFrame(table[fIdx], ph);
|
|
||||||
const s1 = this._sampleFrame(table[Math.min(this.numFrames - 1, fIdx + 1)], ph);
|
|
||||||
let s = s0 + (s1 - s0) * frac;
|
|
||||||
if (warpMode === WarpMode.FLIP && this.phase[n] < warpAmount) {
|
|
||||||
s = -s;
|
|
||||||
}
|
|
||||||
outL[i] += s * gainL * normalizer;
|
|
||||||
outR[i] += s * gainR * normalizer;
|
|
||||||
this.phase[n] = wrapPhase(this.phase[n] + dPhase);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
registerProcessor('wavetable-oscillator-processor', WavetableOscillatorProcessor);
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
//import { ZZFX } from 'zzfx';
|
//import { ZZFX } from 'zzfx';
|
||||||
import { midiToFreq, noteToMidi } from './util.mjs';
|
import { midiToFreq, noteToMidi } from './util.mjs';
|
||||||
import { registerSound } from './superdough.mjs';
|
import { registerSound, getAudioContext } from './superdough.mjs';
|
||||||
import { getAudioContext } from './audioContext.mjs';
|
|
||||||
import { buildSamples } from './zzfx_fork.mjs';
|
import { buildSamples } from './zzfx_fork.mjs';
|
||||||
|
|
||||||
export const getZZFX = (value, t) => {
|
export const getZZFX = (value, t) => {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { getAudioContext } from './audioContext.mjs';
|
import { getAudioContext } from './superdough.mjs';
|
||||||
|
|
||||||
// https://github.com/KilledByAPixel/ZzFX/blob/master/ZzFX.js#L85C5-L180C6
|
// https://github.com/KilledByAPixel/ZzFX/blob/master/ZzFX.js#L85C5-L180C6
|
||||||
// changes: replaced this.volume with 1 + using sampleRate from getAudioContext()
|
// changes: replaced this.volume with 1 + using sampleRate from getAudioContext()
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "supradough",
|
"name": "supradough",
|
||||||
"version": "1.2.4",
|
"version": "1.2.3",
|
||||||
"description": "platform agnostic synth and sampler intended for live coding. a reimplementation of superdough.",
|
"description": "platform agnostic synth and sampler intended for live coding. a reimplementation of superdough.",
|
||||||
"main": "index.mjs",
|
"main": "index.mjs",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
@@ -32,5 +32,6 @@
|
|||||||
"vite": "^6.0.11",
|
"vite": "^6.0.11",
|
||||||
"vite-plugin-bundle-audioworklet": "workspace:*",
|
"vite-plugin-bundle-audioworklet": "workspace:*",
|
||||||
"wav-encoder": "^1.3.0"
|
"wav-encoder": "^1.3.0"
|
||||||
}
|
},
|
||||||
|
"dependencies": {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import './tonal.mjs';
|
import './tonal.mjs';
|
||||||
import './voicings.mjs';
|
import './voicings.mjs';
|
||||||
import './ireal.mjs';
|
|
||||||
|
|
||||||
export * from './tonal.mjs';
|
export * from './tonal.mjs';
|
||||||
export * from './voicings.mjs';
|
export * from './voicings.mjs';
|
||||||
export * from './ireal.mjs';
|
|
||||||
|
import './ireal.mjs';
|
||||||
|
|
||||||
export const packageName = '@strudel/tonal';
|
export const packageName = '@strudel/tonal';
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@strudel/tonal",
|
"name": "@strudel/tonal",
|
||||||
"version": "1.2.5",
|
"version": "1.2.4",
|
||||||
"description": "Tonal functions for strudel",
|
"description": "Tonal functions for strudel",
|
||||||
"main": "index.mjs",
|
"main": "index.mjs",
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
|
|||||||
@@ -7,18 +7,15 @@ This program is free software: you can redistribute it and/or modify it under th
|
|||||||
// import { strict as assert } from 'assert';
|
// import { strict as assert } from 'assert';
|
||||||
|
|
||||||
import '../tonal.mjs'; // need to import this to add prototypes
|
import '../tonal.mjs'; // need to import this to add prototypes
|
||||||
import { pure, n, seq, note, noteToMidi } from '@strudel/core';
|
import { pure, n, seq, note } from '@strudel/core';
|
||||||
import { describe, it, expect } from 'vitest';
|
import { describe, it, expect } from 'vitest';
|
||||||
import { mini } from '../../mini/mini.mjs';
|
import { mini } from '../../mini/mini.mjs';
|
||||||
|
|
||||||
describe('tonal', () => {
|
describe('tonal', () => {
|
||||||
describe('scaleTranspose', () => {
|
it('Should run tonal functions ', () => {
|
||||||
it('transposes notes by scale degrees', () => {
|
|
||||||
expect(pure('c3').scale('C major').scaleTranspose(1).firstCycleValues).toEqual(['D3']);
|
expect(pure('c3').scale('C major').scaleTranspose(1).firstCycleValues).toEqual(['D3']);
|
||||||
});
|
});
|
||||||
});
|
it('scale with plain values', () => {
|
||||||
describe('scale', () => {
|
|
||||||
it('converts plain values', () => {
|
|
||||||
expect(
|
expect(
|
||||||
seq(0, 1, 2)
|
seq(0, 1, 2)
|
||||||
.scale('C major')
|
.scale('C major')
|
||||||
@@ -26,80 +23,34 @@ describe('tonal', () => {
|
|||||||
.firstCycleValues.map((h) => h.note),
|
.firstCycleValues.map((h) => h.note),
|
||||||
).toEqual(['C3', 'D3', 'E3']);
|
).toEqual(['C3', 'D3', 'E3']);
|
||||||
});
|
});
|
||||||
it('converts n values', () => {
|
it('scale with n values', () => {
|
||||||
expect(
|
expect(
|
||||||
n(seq(0, 1, 2))
|
n(seq(0, 1, 2))
|
||||||
.scale('C major')
|
.scale('C major')
|
||||||
.firstCycleValues.map((h) => h.note),
|
.firstCycleValues.map((h) => h.note),
|
||||||
).toEqual(['C3', 'D3', 'E3']);
|
).toEqual(['C3', 'D3', 'E3']);
|
||||||
});
|
});
|
||||||
it('converts n values (mini notation)', () => {
|
it('scale with colon', () => {
|
||||||
expect(
|
expect(
|
||||||
n(seq(0, 1, 2))
|
n(seq(0, 1, 2))
|
||||||
.scale('C:major')
|
.scale('C:major')
|
||||||
.firstCycleValues.map((h) => h.note),
|
.firstCycleValues.map((h) => h.note),
|
||||||
).toEqual(['C3', 'D3', 'E3']);
|
).toEqual(['C3', 'D3', 'E3']);
|
||||||
});
|
});
|
||||||
it('converts n values (no tonic)', () => {
|
it('scale without tonic', () => {
|
||||||
expect(
|
expect(
|
||||||
n(seq(0, 1, 2))
|
n(seq(0, 1, 2))
|
||||||
.scale('major')
|
.scale('major')
|
||||||
.firstCycleValues.map((h) => h.note),
|
.firstCycleValues.map((h) => h.note),
|
||||||
).toEqual(['C3', 'D3', 'E3']);
|
).toEqual(['C3', 'D3', 'E3']);
|
||||||
});
|
});
|
||||||
it('converts n values (explicit mini notation)', () => {
|
it('scale with mininotation colon', () => {
|
||||||
expect(
|
expect(
|
||||||
n(seq(0, 1, 2))
|
n(seq(0, 1, 2))
|
||||||
.scale(mini('C:major'))
|
.scale(mini('C:major'))
|
||||||
.firstCycleValues.map((h) => h.note),
|
.firstCycleValues.map((h) => h.note),
|
||||||
).toEqual(['C3', 'D3', 'E3']);
|
).toEqual(['C3', 'D3', 'E3']);
|
||||||
});
|
});
|
||||||
it('converts decorated n values', () => {
|
|
||||||
expect(
|
|
||||||
n(seq('0b', '1#', '-2', '3##', '4bb'))
|
|
||||||
.scale('C major')
|
|
||||||
.firstCycleValues.map((h) => h.note),
|
|
||||||
).toEqual(['B2', 'Eb3', 'A2', 'G3', 'F3']);
|
|
||||||
});
|
|
||||||
it('produces silence for mixed sharps and flats', () => {
|
|
||||||
expect(
|
|
||||||
n(seq('0b#', '1#b', '2#b#'))
|
|
||||||
.scale('C major')
|
|
||||||
.firstCycleValues.map((h) => h.note),
|
|
||||||
).toEqual([]);
|
|
||||||
});
|
|
||||||
it('snaps notes (upwards) to scale', () => {
|
|
||||||
const inputNotes = ['Cb', 'Eb', 'G', 'A#', 'Bb'];
|
|
||||||
const expectedNotes = ['B2', 'E3', 'G3', 'B3', 'B3'];
|
|
||||||
|
|
||||||
expect(
|
|
||||||
note(seq(inputNotes))
|
|
||||||
.scale('C major')
|
|
||||||
.firstCycleValues.map((h) => h.note),
|
|
||||||
).toEqual(expectedNotes);
|
|
||||||
});
|
|
||||||
it('snaps notes to the correct octave', () => {
|
|
||||||
const inputNotes = ['Cb0', 'Eb4', 'G1', 'A#19', 'Bb8'];
|
|
||||||
const expectedNotes = ['B#-1', 'D#4', 'G#1', 'A#19', 'A#8'];
|
|
||||||
|
|
||||||
expect(
|
|
||||||
note(seq(inputNotes))
|
|
||||||
.scale('A# minor') // A#, B#, C#, D#, E#, F#, G#
|
|
||||||
.firstCycleValues.map((h) => h.note),
|
|
||||||
).toEqual(expectedNotes);
|
|
||||||
});
|
|
||||||
it('handles scale names provided with colons', () => {
|
|
||||||
const inputNotes = ['Cb', 'E', 'G', 'A#', 'Bb'];
|
|
||||||
const expectedNotes = ['A#2', 'D#3', 'G#3', 'A#3', 'A#3'];
|
|
||||||
|
|
||||||
expect(
|
|
||||||
note(seq(inputNotes))
|
|
||||||
.scale('F#:pentatonic') // F#, G#, A#, C#, and D#
|
|
||||||
.firstCycleValues.map((h) => h.note),
|
|
||||||
).toEqual(expectedNotes);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
describe('transpose', () => {
|
|
||||||
it('transposes note numbers with interval numbers', () => {
|
it('transposes note numbers with interval numbers', () => {
|
||||||
expect(
|
expect(
|
||||||
note(seq(40, 40, 40))
|
note(seq(40, 40, 40))
|
||||||
@@ -132,5 +83,4 @@ describe('tonal', () => {
|
|||||||
).toEqual(['C', 'D', 'Eb']);
|
).toEqual(['C', 'D', 'Eb']);
|
||||||
expect(seq('c', 'c', 'c').transpose('1P', '2M', '3m').firstCycleValues).toEqual(['C', 'D', 'Eb']);
|
expect(seq('c', 'c', 'c').transpose('1P', '2M', '3m').firstCycleValues).toEqual(['C', 'D', 'Eb']);
|
||||||
});
|
});
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|||||||
+43
-91
@@ -6,28 +6,19 @@ This program is free software: you can redistribute it and/or modify it under th
|
|||||||
|
|
||||||
import { Note, Interval, Scale } from '@tonaljs/tonal';
|
import { Note, Interval, Scale } from '@tonaljs/tonal';
|
||||||
import { register, _mod, silence, logger, pure, isNote } from '@strudel/core';
|
import { register, _mod, silence, logger, pure, isNote } from '@strudel/core';
|
||||||
import { stepInNamedScale, nearestNumberIndex } from './tonleiter.mjs';
|
import { stepInNamedScale } from './tonleiter.mjs';
|
||||||
import { noteToMidi } from '../core/util.mjs';
|
|
||||||
|
|
||||||
const octavesInterval = (octaves) => (octaves <= 0 ? -1 : 1) + octaves * 7 + 'P';
|
const octavesInterval = (octaves) => (octaves <= 0 ? -1 : 1) + octaves * 7 + 'P';
|
||||||
|
|
||||||
function getScale(scaleName) {
|
|
||||||
scaleName = scaleName.replaceAll(':', ' ');
|
|
||||||
const scale = Scale.get(scaleName);
|
|
||||||
const { tonic, empty } = scale;
|
|
||||||
if ((empty && isNote(scaleName)) || (empty && !tonic)) {
|
|
||||||
throw new Error(
|
|
||||||
`Scale name ${scaleName} is incomplete. Make sure to use ":" instead of spaces, example: .scale("C:major")`,
|
|
||||||
);
|
|
||||||
} else if (empty) {
|
|
||||||
throw new Error(`Invalid scale name "${scaleName}"`);
|
|
||||||
}
|
|
||||||
return scale;
|
|
||||||
}
|
|
||||||
|
|
||||||
function scaleStep(step, scale) {
|
function scaleStep(step, scale) {
|
||||||
|
scale = scale.replaceAll(':', ' ');
|
||||||
step = Math.ceil(step);
|
step = Math.ceil(step);
|
||||||
let { intervals, tonic } = getScale(scale);
|
let { intervals, tonic, empty } = Scale.get(scale);
|
||||||
|
if ((empty && isNote(scale)) || (empty && !tonic)) {
|
||||||
|
throw new Error(`incomplete scale. Make sure to use ":" instead of spaces, example: .scale("C:major")`);
|
||||||
|
} else if (empty) {
|
||||||
|
throw new Error(`invalid scale "${scale}"`);
|
||||||
|
}
|
||||||
tonic = tonic || 'C';
|
tonic = tonic || 'C';
|
||||||
const { pc, oct = 3 } = Note.get(tonic);
|
const { pc, oct = 3 } = Note.get(tonic);
|
||||||
const octaveOffset = Math.floor(step / intervals.length);
|
const octaveOffset = Math.floor(step / intervals.length);
|
||||||
@@ -39,7 +30,8 @@ function scaleStep(step, scale) {
|
|||||||
// transpose note inside scale by offset steps
|
// transpose note inside scale by offset steps
|
||||||
// function scaleOffset(scale: string, offset: number, note: string) {
|
// function scaleOffset(scale: string, offset: number, note: string) {
|
||||||
function scaleOffset(scale, offset, note) {
|
function scaleOffset(scale, offset, note) {
|
||||||
let { notes } = getScale(scale);
|
let [tonic, scaleName] = Scale.tokenize(scale);
|
||||||
|
let { notes } = Scale.get(`${tonic} ${scaleName}`);
|
||||||
notes = notes.map((note) => Note.get(note).pc); // use only pc!
|
notes = notes.map((note) => Note.get(note).pc); // use only pc!
|
||||||
offset = Number(offset);
|
offset = Number(offset);
|
||||||
if (isNaN(offset)) {
|
if (isNaN(offset)) {
|
||||||
@@ -128,7 +120,10 @@ export const { transpose, trans } = register(['transpose', 'trans'], function tr
|
|||||||
const interval = !isNaN(Number(intervalOrSemitones))
|
const interval = !isNaN(Number(intervalOrSemitones))
|
||||||
? Interval.fromSemitones(intervalOrSemitones)
|
? Interval.fromSemitones(intervalOrSemitones)
|
||||||
: String(intervalOrSemitones);
|
: String(intervalOrSemitones);
|
||||||
const targetNote = Note.transpose(note, interval);
|
// TODO: move simplify to player to preserve enharmonics
|
||||||
|
// tone.js doesn't understand multiple sharps flats e.g. F##3 has to be turned into G3
|
||||||
|
// TODO: check if this is still relevant..
|
||||||
|
const targetNote = Note.simplify(Note.transpose(note, interval));
|
||||||
if (typeof hap.value === 'object') {
|
if (typeof hap.value === 'object') {
|
||||||
return hap.withValue(() => ({ ...hap.value, note: targetNote }));
|
return hap.withValue(() => ({ ...hap.value, note: targetNote }));
|
||||||
}
|
}
|
||||||
@@ -176,59 +171,8 @@ export const { scaleTranspose, scaleTrans, strans } = register(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
// Converts a step value, which is a number optionally decorated with sharps and flats,
|
|
||||||
// to a number and an `offset` number of semitones
|
|
||||||
function _convertStepToNumberAndOffset(step) {
|
|
||||||
let asNumber = Number(step);
|
|
||||||
let offset = 0;
|
|
||||||
if (isNaN(asNumber)) {
|
|
||||||
step = String(step);
|
|
||||||
// Check to see if the step matches the expected format:
|
|
||||||
// - A number (possibly negative)
|
|
||||||
// - Some number of sharps or flats (but not both)
|
|
||||||
const match = /^(-?\d+)(#+|b+)?$/.exec(step);
|
|
||||||
|
|
||||||
if (!match) {
|
|
||||||
throw new Error(`invalid scale step "${step}", expected number or integer with optional # b suffixes`);
|
|
||||||
}
|
|
||||||
asNumber = Number(match[1]);
|
|
||||||
// These decorations will determine the semitone offset based on the number of
|
|
||||||
// sharps or flats
|
|
||||||
const decorations = match[2] || '';
|
|
||||||
offset = decorations[0] === '#' ? decorations.length : -decorations.length;
|
|
||||||
}
|
|
||||||
return [asNumber, offset];
|
|
||||||
}
|
|
||||||
|
|
||||||
let scaleToMidisAndNotes = {};
|
|
||||||
// Finds the nearest scale note to `note`
|
|
||||||
function _getNearestScaleNote(scaleName, note, preferHigher = true) {
|
|
||||||
let noteMidi = typeof note === 'string' ? noteToMidi(note) : note;
|
|
||||||
if (scaleToMidisAndNotes[scaleName] === undefined) {
|
|
||||||
const { intervals, tonic } = getScale(scaleName);
|
|
||||||
const { pc } = Note.get(tonic);
|
|
||||||
const expandedIntervals = intervals.concat('8P'); // add the octave for wrapping
|
|
||||||
const sNotes = expandedIntervals.map((interval) => Note.transpose(pc + '0', interval));
|
|
||||||
const sMidi = sNotes.map(noteToMidi);
|
|
||||||
// Cache
|
|
||||||
scaleToMidisAndNotes[scaleName] = [sMidi, sNotes];
|
|
||||||
}
|
|
||||||
const [scaleMidis, scaleNotes] = scaleToMidisAndNotes[scaleName];
|
|
||||||
const rootMidi = scaleMidis[0];
|
|
||||||
const octaveDiff = Math.floor((noteMidi - rootMidi) / 12);
|
|
||||||
const alignedMidis = scaleMidis.map((m) => m + 12 * octaveDiff);
|
|
||||||
const noteIdx = nearestNumberIndex(noteMidi, alignedMidis, preferHigher);
|
|
||||||
const noteMatch = scaleNotes[noteIdx];
|
|
||||||
return Note.transpose(noteMatch, Interval.fromSemitones(12 * octaveDiff));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Turns numbers into notes in the scale (zero indexed) or quantizes notes to a scale.
|
* Turns numbers into notes in the scale (zero indexed). Also sets scale for other scale operations, like {@link Pattern#scaleTranspose}.
|
||||||
*
|
|
||||||
* When describing notes via numbers, note that negative numbers can be used to wrap backwards
|
|
||||||
* in the scale as well as sharps or flats (but not both) to produce notes outside of the scale.
|
|
||||||
*
|
|
||||||
* Also sets scale for other scale operations, like {@link Pattern#scaleTranspose}.
|
|
||||||
*
|
*
|
||||||
* A scale consists of a root note (e.g. `c4`, `c`, `f#`, `bb4`) followed by semicolon (':') and then a [scale type](https://github.com/tonaljs/tonal/blob/main/packages/scale-type/data.ts).
|
* A scale consists of a root note (e.g. `c4`, `c`, `f#`, `bb4`) followed by semicolon (':') and then a [scale type](https://github.com/tonaljs/tonal/blob/main/packages/scale-type/data.ts).
|
||||||
*
|
*
|
||||||
@@ -247,12 +191,6 @@ function _getNearestScaleNote(scaleName, note, preferHigher = true) {
|
|||||||
* n(rand.range(0,12).segment(8))
|
* n(rand.range(0,12).segment(8))
|
||||||
* .scale("C:ritusen")
|
* .scale("C:ritusen")
|
||||||
* .s("piano")
|
* .s("piano")
|
||||||
* @example
|
|
||||||
* n("<[0,7b] [-4# -4] [-2,7##] 4 [0,7] [-4# -4b] [-2,7###] 4b>*4")
|
|
||||||
* .scale("C:<major minor>/2")
|
|
||||||
* .s("piano")
|
|
||||||
* @example
|
|
||||||
* note("C1*16").transpose(irand(36)).scale('Cb2 major').scaleTranspose(3)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export const scale = register(
|
export const scale = register(
|
||||||
@@ -266,35 +204,49 @@ export const scale = register(
|
|||||||
pat
|
pat
|
||||||
.fmap((value) => {
|
.fmap((value) => {
|
||||||
const isObject = typeof value === 'object';
|
const isObject = typeof value === 'object';
|
||||||
// The case where the note has been defined via `n` or `pure`
|
let step = isObject ? value.n : value;
|
||||||
if (!isObject || (isObject && ('n' in value || 'value' in value))) {
|
if (isObject) {
|
||||||
const step = isObject ? (value.n ?? value.value) : value;
|
|
||||||
delete value.n; // remove n so it won't cause trouble
|
delete value.n; // remove n so it won't cause trouble
|
||||||
|
}
|
||||||
if (isNote(step)) {
|
if (isNote(step)) {
|
||||||
// legacy..
|
// legacy..
|
||||||
return pure(step);
|
return pure(step);
|
||||||
}
|
}
|
||||||
|
let asNumber = Number(step);
|
||||||
|
let semitones = 0;
|
||||||
|
if (isNaN(asNumber)) {
|
||||||
|
step = String(step);
|
||||||
|
if (!/^[-+]?\d+(#*|b*){1}$/.test(step)) {
|
||||||
|
logger(
|
||||||
|
`[tonal] invalid scale step "${step}", expected number or integer with optional # b suffixes`,
|
||||||
|
'error',
|
||||||
|
);
|
||||||
|
return silence;
|
||||||
|
}
|
||||||
|
const isharp = step.indexOf('#');
|
||||||
|
if (isharp >= 0) {
|
||||||
|
asNumber = Number(step.substring(0, isharp));
|
||||||
|
semitones = step.length - isharp;
|
||||||
|
} else {
|
||||||
|
const iflat = step.indexOf('b');
|
||||||
|
asNumber = Number(step.substring(0, iflat));
|
||||||
|
semitones = iflat - step.length;
|
||||||
|
}
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
const [number, offset] = _convertStepToNumberAndOffset(step);
|
|
||||||
let note;
|
let note;
|
||||||
if (isObject && value.anchor) {
|
if (isObject && value.anchor) {
|
||||||
note = stepInNamedScale(number, scale, value.anchor);
|
note = stepInNamedScale(asNumber, scale, value.anchor);
|
||||||
} else {
|
} else {
|
||||||
note = scaleStep(number, scale);
|
note = scaleStep(asNumber, scale);
|
||||||
}
|
}
|
||||||
if (offset != 0) note = Note.transpose(note, Interval.fromSemitones(offset));
|
if (semitones != 0) note = Note.transpose(note, Interval.fromSemitones(semitones));
|
||||||
value = pure(isObject ? { ...value, note } : note);
|
value = pure(isObject ? { ...value, note } : note);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger(`[tonal] ${err.message}`, 'error');
|
logger(`[tonal] ${err.message}`, 'error');
|
||||||
return silence;
|
value = silence;
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
|
||||||
// The case where the note has been defined via `note`
|
|
||||||
else {
|
|
||||||
const note = _getNearestScaleNote(scale, value.note);
|
|
||||||
return pure(isObject ? { ...value, note } : note);
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.outerJoin()
|
.outerJoin()
|
||||||
// legacy:
|
// legacy:
|
||||||
|
|||||||
@@ -101,11 +101,11 @@ export function nearestNumberIndex(target, numbers, preferHigher) {
|
|||||||
let scaleSteps = {}; // [scaleName]: semitones[]
|
let scaleSteps = {}; // [scaleName]: semitones[]
|
||||||
|
|
||||||
export function stepInNamedScale(step, scale, anchor, preferHigher) {
|
export function stepInNamedScale(step, scale, anchor, preferHigher) {
|
||||||
const [root, scaleName] = Scale.tokenize(scale);
|
let [root, scaleName] = Scale.tokenize(scale);
|
||||||
const rootMidi = x2midi(root);
|
const rootMidi = x2midi(root);
|
||||||
const rootChroma = midi2chroma(rootMidi);
|
const rootChroma = midi2chroma(rootMidi);
|
||||||
if (!scaleSteps[scaleName]) {
|
if (!scaleSteps[scaleName]) {
|
||||||
const { intervals } = Scale.get(`C ${scaleName}`);
|
let { intervals } = Scale.get(`C ${scaleName}`);
|
||||||
// cache result
|
// cache result
|
||||||
scaleSteps[scaleName] = intervals.map(step2semitones);
|
scaleSteps[scaleName] = intervals.map(step2semitones);
|
||||||
}
|
}
|
||||||
@@ -222,7 +222,6 @@ export const Note = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// TODO: support octave numbers
|
// TODO: support octave numbers
|
||||||
// Example: Note("Bb3").transpose("c3")
|
|
||||||
export function transpose(note, step) {
|
export function transpose(note, step) {
|
||||||
// example: E, 3
|
// example: E, 3
|
||||||
const stepNumber = Step.tokenize(step)[1]; // 3
|
const stepNumber = Step.tokenize(step)[1]; // 3
|
||||||
@@ -236,3 +235,5 @@ export function transpose(note, step) {
|
|||||||
const offsetAccidentals = accidentalString(Step.accidentals(step) + Note.accidentals(note) + stepIndex - indexOffset); // "we need to add a # to to the G to make it a major third from E"
|
const offsetAccidentals = accidentalString(Step.accidentals(step) + Note.accidentals(note) + stepIndex - indexOffset); // "we need to add a # to to the G to make it a major third from E"
|
||||||
return [targetNote, offsetAccidentals].join('');
|
return [targetNote, offsetAccidentals].join('');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Note("Bb3").transpose("c3")
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@strudel/transpiler",
|
"name": "@strudel/transpiler",
|
||||||
"version": "1.2.5",
|
"version": "1.2.4",
|
||||||
"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",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@strudel/web",
|
"name": "@strudel/web",
|
||||||
"version": "1.2.6",
|
"version": "1.2.5",
|
||||||
"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": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@strudel/webaudio",
|
"name": "@strudel/webaudio",
|
||||||
"version": "1.2.6",
|
"version": "1.2.5",
|
||||||
"description": "Web Audio helpers for Strudel",
|
"description": "Web Audio helpers for Strudel",
|
||||||
"main": "index.mjs",
|
"main": "index.mjs",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@strudel/xen",
|
"name": "@strudel/xen",
|
||||||
"version": "1.2.5",
|
"version": "1.2.4",
|
||||||
"description": "Xenharmonic API for strudel",
|
"description": "Xenharmonic API for strudel",
|
||||||
"main": "index.mjs",
|
"main": "index.mjs",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
Generated
+8
-246
@@ -41,7 +41,7 @@ importers:
|
|||||||
version: 2.2.7
|
version: 2.2.7
|
||||||
'@vitest/coverage-v8':
|
'@vitest/coverage-v8':
|
||||||
specifier: 3.0.4
|
specifier: 3.0.4
|
||||||
version: 3.0.4(vitest@3.0.4(@types/debug@4.1.12)(@types/node@22.10.10)(@vitest/ui@3.0.4)(jiti@2.4.2)(lightningcss@1.29.1)(terser@5.37.0)(yaml@2.7.0))
|
version: 3.0.4(vitest@3.0.4)
|
||||||
'@vitest/ui':
|
'@vitest/ui':
|
||||||
specifier: ^3.0.4
|
specifier: ^3.0.4
|
||||||
version: 3.0.4(vitest@3.0.4)
|
version: 3.0.4(vitest@3.0.4)
|
||||||
@@ -212,21 +212,12 @@ importers:
|
|||||||
'@strudel/draw':
|
'@strudel/draw':
|
||||||
specifier: workspace:*
|
specifier: workspace:*
|
||||||
version: link:../draw
|
version: link:../draw
|
||||||
'@strudel/tonal':
|
|
||||||
specifier: workspace:*
|
|
||||||
version: link:../tonal
|
|
||||||
'@strudel/transpiler':
|
'@strudel/transpiler':
|
||||||
specifier: workspace:*
|
specifier: workspace:*
|
||||||
version: link:../transpiler
|
version: link:../transpiler
|
||||||
'@tonaljs/tonal':
|
|
||||||
specifier: ^4.10.0
|
|
||||||
version: 4.10.0
|
|
||||||
nanostores:
|
nanostores:
|
||||||
specifier: ^0.11.3
|
specifier: ^0.11.3
|
||||||
version: 0.11.3
|
version: 0.11.3
|
||||||
superdough:
|
|
||||||
specifier: workspace:*
|
|
||||||
version: link:../superdough
|
|
||||||
devDependencies:
|
devDependencies:
|
||||||
vite:
|
vite:
|
||||||
specifier: ^6.0.11
|
specifier: ^6.0.11
|
||||||
@@ -415,12 +406,9 @@ importers:
|
|||||||
'@strudel/core':
|
'@strudel/core':
|
||||||
specifier: workspace:*
|
specifier: workspace:*
|
||||||
version: link:../core
|
version: link:../core
|
||||||
osc:
|
osc-js:
|
||||||
specifier: ^2.4.5
|
specifier: ^2.4.1
|
||||||
version: 2.4.5
|
version: 2.4.1
|
||||||
ws:
|
|
||||||
specifier: ^8.18.3
|
|
||||||
version: 8.18.3
|
|
||||||
devDependencies:
|
devDependencies:
|
||||||
pkg:
|
pkg:
|
||||||
specifier: ^5.8.1
|
specifier: ^5.8.1
|
||||||
@@ -2432,70 +2420,6 @@ packages:
|
|||||||
'@rtsao/scc@1.1.0':
|
'@rtsao/scc@1.1.0':
|
||||||
resolution: {integrity: sha512-zt6OdqaDoOnJ1ZYsCYGt9YmWzDXl4vQdKTyJev62gFhRGKdx7mcT54V9KIjg+d2wi9EXsPvAPKe7i7WjfVWB8g==}
|
resolution: {integrity: sha512-zt6OdqaDoOnJ1ZYsCYGt9YmWzDXl4vQdKTyJev62gFhRGKdx7mcT54V9KIjg+d2wi9EXsPvAPKe7i7WjfVWB8g==}
|
||||||
|
|
||||||
'@serialport/binding-mock@10.2.2':
|
|
||||||
resolution: {integrity: sha512-HAFzGhk9OuFMpuor7aT5G1ChPgn5qSsklTFOTUX72Rl6p0xwcSVsRtG/xaGp6bxpN7fI9D/S8THLBWbBgS6ldw==}
|
|
||||||
engines: {node: '>=12.0.0'}
|
|
||||||
|
|
||||||
'@serialport/bindings-cpp@12.0.1':
|
|
||||||
resolution: {integrity: sha512-r2XOwY2dDvbW7dKqSPIk2gzsr6M6Qpe9+/Ngs94fNaNlcTRCV02PfaoDmRgcubpNVVcLATlxSxPTIDw12dbKOg==}
|
|
||||||
engines: {node: '>=16.0.0'}
|
|
||||||
|
|
||||||
'@serialport/bindings-interface@1.2.2':
|
|
||||||
resolution: {integrity: sha512-CJaUd5bLvtM9c5dmO9rPBHPXTa9R2UwpkJ0wdh9JCYcbrPWsKz+ErvR0hBLeo7NPeiFdjFO4sonRljiw4d2XiA==}
|
|
||||||
engines: {node: ^12.22 || ^14.13 || >=16}
|
|
||||||
|
|
||||||
'@serialport/parser-byte-length@12.0.0':
|
|
||||||
resolution: {integrity: sha512-0ei0txFAj+s6FTiCJFBJ1T2hpKkX8Md0Pu6dqMrYoirjPskDLJRgZGLqoy3/lnU1bkvHpnJO+9oJ3PB9v8rNlg==}
|
|
||||||
engines: {node: '>=12.0.0'}
|
|
||||||
|
|
||||||
'@serialport/parser-cctalk@12.0.0':
|
|
||||||
resolution: {integrity: sha512-0PfLzO9t2X5ufKuBO34DQKLXrCCqS9xz2D0pfuaLNeTkyGUBv426zxoMf3rsMRodDOZNbFblu3Ae84MOQXjnZw==}
|
|
||||||
engines: {node: '>=12.0.0'}
|
|
||||||
|
|
||||||
'@serialport/parser-delimiter@11.0.0':
|
|
||||||
resolution: {integrity: sha512-aZLJhlRTjSmEwllLG7S4J8s8ctRAS0cbvCpO87smLvl3e4BgzbVgF6Z6zaJd3Aji2uSiYgfedCdNc4L6W+1E2g==}
|
|
||||||
engines: {node: '>=12.0.0'}
|
|
||||||
|
|
||||||
'@serialport/parser-delimiter@12.0.0':
|
|
||||||
resolution: {integrity: sha512-gu26tVt5lQoybhorLTPsH2j2LnX3AOP2x/34+DUSTNaUTzu2fBXw+isVjQJpUBFWu6aeQRZw5bJol5X9Gxjblw==}
|
|
||||||
engines: {node: '>=12.0.0'}
|
|
||||||
|
|
||||||
'@serialport/parser-inter-byte-timeout@12.0.0':
|
|
||||||
resolution: {integrity: sha512-GnCh8K0NAESfhCuXAt+FfBRz1Cf9CzIgXfp7SdMgXwrtuUnCC/yuRTUFWRvuzhYKoAo1TL0hhUo77SFHUH1T/w==}
|
|
||||||
engines: {node: '>=12.0.0'}
|
|
||||||
|
|
||||||
'@serialport/parser-packet-length@12.0.0':
|
|
||||||
resolution: {integrity: sha512-p1hiCRqvGHHLCN/8ZiPUY/G0zrxd7gtZs251n+cfNTn+87rwcdUeu9Dps3Aadx30/sOGGFL6brIRGK4l/t7MuQ==}
|
|
||||||
engines: {node: '>=8.6.0'}
|
|
||||||
|
|
||||||
'@serialport/parser-readline@11.0.0':
|
|
||||||
resolution: {integrity: sha512-rRAivhRkT3YO28WjmmG4FQX6L+KMb5/ikhyylRfzWPw0nSXy97+u07peS9CbHqaNvJkMhH1locp2H36aGMOEIA==}
|
|
||||||
engines: {node: '>=12.0.0'}
|
|
||||||
|
|
||||||
'@serialport/parser-readline@12.0.0':
|
|
||||||
resolution: {integrity: sha512-O7cywCWC8PiOMvo/gglEBfAkLjp/SENEML46BXDykfKP5mTPM46XMaX1L0waWU6DXJpBgjaL7+yX6VriVPbN4w==}
|
|
||||||
engines: {node: '>=12.0.0'}
|
|
||||||
|
|
||||||
'@serialport/parser-ready@12.0.0':
|
|
||||||
resolution: {integrity: sha512-ygDwj3O4SDpZlbrRUraoXIoIqb8sM7aMKryGjYTIF0JRnKeB1ys8+wIp0RFMdFbO62YriUDextHB5Um5cKFSWg==}
|
|
||||||
engines: {node: '>=12.0.0'}
|
|
||||||
|
|
||||||
'@serialport/parser-regex@12.0.0':
|
|
||||||
resolution: {integrity: sha512-dCAVh4P/pZrLcPv9NJ2mvPRBg64L5jXuiRxIlyxxdZGH4WubwXVXY/kBTihQmiAMPxbT3yshSX8f2+feqWsxqA==}
|
|
||||||
engines: {node: '>=12.0.0'}
|
|
||||||
|
|
||||||
'@serialport/parser-slip-encoder@12.0.0':
|
|
||||||
resolution: {integrity: sha512-0APxDGR9YvJXTRfY+uRGhzOhTpU5akSH183RUcwzN7QXh8/1jwFsFLCu0grmAUfi+fItCkR+Xr1TcNJLR13VNA==}
|
|
||||||
engines: {node: '>=12.0.0'}
|
|
||||||
|
|
||||||
'@serialport/parser-spacepacket@12.0.0':
|
|
||||||
resolution: {integrity: sha512-dozONxhPC/78pntuxpz/NOtVps8qIc/UZzdc/LuPvVsqCoJXiRxOg6ZtCP/W58iibJDKPZPAWPGYeZt9DJxI+Q==}
|
|
||||||
engines: {node: '>=12.0.0'}
|
|
||||||
|
|
||||||
'@serialport/stream@12.0.0':
|
|
||||||
resolution: {integrity: sha512-9On64rhzuqKdOQyiYLYv2lQOh3TZU/D3+IWCR5gk0alPel2nwpp4YwDEGiUBfrQZEdQ6xww0PWkzqth4wqwX3Q==}
|
|
||||||
engines: {node: '>=12.0.0'}
|
|
||||||
|
|
||||||
'@shikijs/core@1.29.1':
|
'@shikijs/core@1.29.1':
|
||||||
resolution: {integrity: sha512-Mo1gGGkuOYjDu5H8YwzmOuly9vNr8KDVkqj9xiKhhhFS8jisAtDSEWB9hzqRHLVQgFdA310e8XRJcW4tYhRB2A==}
|
resolution: {integrity: sha512-Mo1gGGkuOYjDu5H8YwzmOuly9vNr8KDVkqj9xiKhhhFS8jisAtDSEWB9hzqRHLVQgFdA310e8XRJcW4tYhRB2A==}
|
||||||
|
|
||||||
@@ -3748,15 +3672,6 @@ packages:
|
|||||||
supports-color:
|
supports-color:
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
debug@4.3.4:
|
|
||||||
resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==}
|
|
||||||
engines: {node: '>=6.0'}
|
|
||||||
peerDependencies:
|
|
||||||
supports-color: '*'
|
|
||||||
peerDependenciesMeta:
|
|
||||||
supports-color:
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
debug@4.4.0:
|
debug@4.4.0:
|
||||||
resolution: {integrity: sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==}
|
resolution: {integrity: sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==}
|
||||||
engines: {node: '>=6.0'}
|
engines: {node: '>=6.0'}
|
||||||
@@ -5366,9 +5281,6 @@ packages:
|
|||||||
resolution: {integrity: sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==}
|
resolution: {integrity: sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==}
|
||||||
engines: {node: '>=10'}
|
engines: {node: '>=10'}
|
||||||
|
|
||||||
long@4.0.0:
|
|
||||||
resolution: {integrity: sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==}
|
|
||||||
|
|
||||||
longest-streak@3.1.0:
|
longest-streak@3.1.0:
|
||||||
resolution: {integrity: sha512-9Ri+o0JYgehTaVBBDoMqIl8GXtbWg711O3srftcHhZ0dqnETqLaoIK0x17fUw9rFSlK/0NlsKe0Ahhyl5pXE2g==}
|
resolution: {integrity: sha512-9Ri+o0JYgehTaVBBDoMqIl8GXtbWg711O3srftcHhZ0dqnETqLaoIK0x17fUw9rFSlK/0NlsKe0Ahhyl5pXE2g==}
|
||||||
|
|
||||||
@@ -5752,9 +5664,6 @@ packages:
|
|||||||
ms@2.0.0:
|
ms@2.0.0:
|
||||||
resolution: {integrity: sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==}
|
resolution: {integrity: sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==}
|
||||||
|
|
||||||
ms@2.1.2:
|
|
||||||
resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==}
|
|
||||||
|
|
||||||
ms@2.1.3:
|
ms@2.1.3:
|
||||||
resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==}
|
resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==}
|
||||||
|
|
||||||
@@ -5813,9 +5722,6 @@ packages:
|
|||||||
resolution: {integrity: sha512-z8iYzQGBu35ZkTQ9mtR8RqugJZ9RCLn8fv3d7LsgDBzOijGQP3RdKTX4LA7LXw03ZhU5z0l4xfhIMgSES31+cg==}
|
resolution: {integrity: sha512-z8iYzQGBu35ZkTQ9mtR8RqugJZ9RCLn8fv3d7LsgDBzOijGQP3RdKTX4LA7LXw03ZhU5z0l4xfhIMgSES31+cg==}
|
||||||
engines: {node: '>=10'}
|
engines: {node: '>=10'}
|
||||||
|
|
||||||
node-addon-api@7.0.0:
|
|
||||||
resolution: {integrity: sha512-vgbBJTS4m5/KkE16t5Ly0WW9hz46swAstv0hYYwMtbG7AznRhNyfLRe8HZAiWIpcHzoO7HxhLuBQj9rJ/Ho0ZA==}
|
|
||||||
|
|
||||||
node-addon-api@8.3.0:
|
node-addon-api@8.3.0:
|
||||||
resolution: {integrity: sha512-8VOpLHFrOQlAH+qA0ZzuGRlALRA6/LVh8QJldbrC4DY0hXoMP0l4Acq8TzFC018HztWiRqyCEj2aTWY2UvnJUg==}
|
resolution: {integrity: sha512-8VOpLHFrOQlAH+qA0ZzuGRlALRA6/LVh8QJldbrC4DY0hXoMP0l4Acq8TzFC018HztWiRqyCEj2aTWY2UvnJUg==}
|
||||||
engines: {node: ^18 || ^20 || >= 21}
|
engines: {node: ^18 || ^20 || >= 21}
|
||||||
@@ -5854,10 +5760,6 @@ packages:
|
|||||||
resolution: {integrity: sha512-yqkmYrMbK1wPrfz7mgeYvA4tBperLg9FQ4S3Sau3nSAkpOA0x0zC8nQ1siBwozy1f4SE8vq2n1WKv99r+PCa1Q==}
|
resolution: {integrity: sha512-yqkmYrMbK1wPrfz7mgeYvA4tBperLg9FQ4S3Sau3nSAkpOA0x0zC8nQ1siBwozy1f4SE8vq2n1WKv99r+PCa1Q==}
|
||||||
engines: {node: '>= 0.6.0'}
|
engines: {node: '>= 0.6.0'}
|
||||||
|
|
||||||
node-gyp-build@4.6.0:
|
|
||||||
resolution: {integrity: sha512-NTZVKn9IylLwUzaKjkas1e4u2DLNcV4rdYagA4PWdPwW87Bi7z+BznyKSRwS/761tV/lzCGXplWsiaMjLqP2zQ==}
|
|
||||||
hasBin: true
|
|
||||||
|
|
||||||
node-gyp-build@4.8.4:
|
node-gyp-build@4.8.4:
|
||||||
resolution: {integrity: sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ==}
|
resolution: {integrity: sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ==}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
@@ -6016,8 +5918,8 @@ packages:
|
|||||||
resolution: {integrity: sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==}
|
resolution: {integrity: sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==}
|
||||||
engines: {node: '>=0.10.0'}
|
engines: {node: '>=0.10.0'}
|
||||||
|
|
||||||
osc@2.4.5:
|
osc-js@2.4.1:
|
||||||
resolution: {integrity: sha512-Nc4/qcl+vA/CMxiKS1xrYgzjfnyB3W94gZnrkn3eTzihlndbEml6+wj1YQNKBI4r+qrw3obCcEoU7SVH/OxpxA==}
|
resolution: {integrity: sha512-QlSeRKJclL47FNvO1MUCAAp9frmCF9zcYbnf6R9HpcklAst8ZyX3ISsk1v/Vghr/5GmXn0bhVjFXF9h+hfnl4Q==}
|
||||||
|
|
||||||
own-keys@1.0.1:
|
own-keys@1.0.1:
|
||||||
resolution: {integrity: sha512-qFOyK5PjiWZd+QQIh+1jhdb9LpxTF0qs7Pm8o5QHYZ0M3vKqSqzsZaEB6oWlxZ+q2sJBMI/Ktgd2N5ZwQoRHfg==}
|
resolution: {integrity: sha512-qFOyK5PjiWZd+QQIh+1jhdb9LpxTF0qs7Pm8o5QHYZ0M3vKqSqzsZaEB6oWlxZ+q2sJBMI/Ktgd2N5ZwQoRHfg==}
|
||||||
@@ -6778,10 +6680,6 @@ packages:
|
|||||||
serialize-javascript@4.0.0:
|
serialize-javascript@4.0.0:
|
||||||
resolution: {integrity: sha512-GaNA54380uFefWghODBWEGisLZFj00nS5ACs6yHa9nLqlLpVLO8ChDGeKRjZnV4Nh4n0Qi7nhYZD/9fCPzEqkw==}
|
resolution: {integrity: sha512-GaNA54380uFefWghODBWEGisLZFj00nS5ACs6yHa9nLqlLpVLO8ChDGeKRjZnV4Nh4n0Qi7nhYZD/9fCPzEqkw==}
|
||||||
|
|
||||||
serialport@12.0.0:
|
|
||||||
resolution: {integrity: sha512-AmH3D9hHPFmnF/oq/rvigfiAouAKyK/TjnrkwZRYSFZxNggJxwvbAbfYrLeuvq7ktUdhuHdVdSjj852Z55R+uA==}
|
|
||||||
engines: {node: '>=16.0.0'}
|
|
||||||
|
|
||||||
set-blocking@2.0.0:
|
set-blocking@2.0.0:
|
||||||
resolution: {integrity: sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==}
|
resolution: {integrity: sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==}
|
||||||
|
|
||||||
@@ -6869,9 +6767,6 @@ packages:
|
|||||||
resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==}
|
resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==}
|
||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
|
|
||||||
slip@1.0.2:
|
|
||||||
resolution: {integrity: sha512-XrcHe3NAcyD3wO+O4I13RcS4/3AF+S9RvGNj9JhJeS02HyImwD2E3QWLrmn9hBfL+fB6yapagwxRkeyYzhk98g==}
|
|
||||||
|
|
||||||
smart-buffer@4.2.0:
|
smart-buffer@4.2.0:
|
||||||
resolution: {integrity: sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==}
|
resolution: {integrity: sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==}
|
||||||
engines: {node: '>= 6.0.0', npm: '>= 3.0.0'}
|
engines: {node: '>= 6.0.0', npm: '>= 3.0.0'}
|
||||||
@@ -7747,9 +7642,6 @@ packages:
|
|||||||
resolution: {integrity: sha512-c9bZp7b5YtRj2wOe6dlj32MK+Bx/M/d+9VB2SHM1OtsUHR0aV0tdP6DWh/iMt0kWi1t5g1Iudu6hQRNd1A4PVA==}
|
resolution: {integrity: sha512-c9bZp7b5YtRj2wOe6dlj32MK+Bx/M/d+9VB2SHM1OtsUHR0aV0tdP6DWh/iMt0kWi1t5g1Iudu6hQRNd1A4PVA==}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
|
|
||||||
wolfy87-eventemitter@5.2.9:
|
|
||||||
resolution: {integrity: sha512-P+6vtWyuDw+MB01X7UeF8TaHBvbCovf4HPEMF/SV7BdDc1SMTiBy13SRD71lQh4ExFTG1d/WNzDGDCyOKSMblw==}
|
|
||||||
|
|
||||||
word-wrap@1.2.5:
|
word-wrap@1.2.5:
|
||||||
resolution: {integrity: sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==}
|
resolution: {integrity: sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==}
|
||||||
engines: {node: '>=0.10.0'}
|
engines: {node: '>=0.10.0'}
|
||||||
@@ -7872,18 +7764,6 @@ packages:
|
|||||||
utf-8-validate:
|
utf-8-validate:
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
ws@8.18.3:
|
|
||||||
resolution: {integrity: sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg==}
|
|
||||||
engines: {node: '>=10.0.0'}
|
|
||||||
peerDependencies:
|
|
||||||
bufferutil: ^4.0.1
|
|
||||||
utf-8-validate: '>=5.0.2'
|
|
||||||
peerDependenciesMeta:
|
|
||||||
bufferutil:
|
|
||||||
optional: true
|
|
||||||
utf-8-validate:
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
xmlcreate@2.0.4:
|
xmlcreate@2.0.4:
|
||||||
resolution: {integrity: sha512-nquOebG4sngPmGPICTS5EnxqhKbCmz5Ox5hsszI2T6U5qdrJizBc+0ilYSEjTSzU0yZcmvppztXe/5Al5fUwdg==}
|
resolution: {integrity: sha512-nquOebG4sngPmGPICTS5EnxqhKbCmz5Ox5hsszI2T6U5qdrJizBc+0ilYSEjTSzU0yZcmvppztXe/5Al5fUwdg==}
|
||||||
|
|
||||||
@@ -9880,76 +9760,6 @@ snapshots:
|
|||||||
|
|
||||||
'@rtsao/scc@1.1.0': {}
|
'@rtsao/scc@1.1.0': {}
|
||||||
|
|
||||||
'@serialport/binding-mock@10.2.2':
|
|
||||||
dependencies:
|
|
||||||
'@serialport/bindings-interface': 1.2.2
|
|
||||||
debug: 4.4.0
|
|
||||||
transitivePeerDependencies:
|
|
||||||
- supports-color
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@serialport/bindings-cpp@12.0.1':
|
|
||||||
dependencies:
|
|
||||||
'@serialport/bindings-interface': 1.2.2
|
|
||||||
'@serialport/parser-readline': 11.0.0
|
|
||||||
debug: 4.3.4
|
|
||||||
node-addon-api: 7.0.0
|
|
||||||
node-gyp-build: 4.6.0
|
|
||||||
transitivePeerDependencies:
|
|
||||||
- supports-color
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@serialport/bindings-interface@1.2.2':
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@serialport/parser-byte-length@12.0.0':
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@serialport/parser-cctalk@12.0.0':
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@serialport/parser-delimiter@11.0.0':
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@serialport/parser-delimiter@12.0.0':
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@serialport/parser-inter-byte-timeout@12.0.0':
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@serialport/parser-packet-length@12.0.0':
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@serialport/parser-readline@11.0.0':
|
|
||||||
dependencies:
|
|
||||||
'@serialport/parser-delimiter': 11.0.0
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@serialport/parser-readline@12.0.0':
|
|
||||||
dependencies:
|
|
||||||
'@serialport/parser-delimiter': 12.0.0
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@serialport/parser-ready@12.0.0':
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@serialport/parser-regex@12.0.0':
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@serialport/parser-slip-encoder@12.0.0':
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@serialport/parser-spacepacket@12.0.0':
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@serialport/stream@12.0.0':
|
|
||||||
dependencies:
|
|
||||||
'@serialport/bindings-interface': 1.2.2
|
|
||||||
debug: 4.3.4
|
|
||||||
transitivePeerDependencies:
|
|
||||||
- supports-color
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@shikijs/core@1.29.1':
|
'@shikijs/core@1.29.1':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@shikijs/engine-javascript': 1.29.1
|
'@shikijs/engine-javascript': 1.29.1
|
||||||
@@ -10554,7 +10364,7 @@ snapshots:
|
|||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
'@vitest/coverage-v8@3.0.4(vitest@3.0.4(@types/debug@4.1.12)(@types/node@22.10.10)(@vitest/ui@3.0.4)(jiti@2.4.2)(lightningcss@1.29.1)(terser@5.37.0)(yaml@2.7.0))':
|
'@vitest/coverage-v8@3.0.4(vitest@3.0.4)':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@ampproject/remapping': 2.3.0
|
'@ampproject/remapping': 2.3.0
|
||||||
'@bcoe/v8-coverage': 1.0.2
|
'@bcoe/v8-coverage': 1.0.2
|
||||||
@@ -11462,11 +11272,6 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
ms: 2.1.3
|
ms: 2.1.3
|
||||||
|
|
||||||
debug@4.3.4:
|
|
||||||
dependencies:
|
|
||||||
ms: 2.1.2
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
debug@4.4.0:
|
debug@4.4.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
ms: 2.1.3
|
ms: 2.1.3
|
||||||
@@ -13336,8 +13141,6 @@ snapshots:
|
|||||||
chalk: 4.1.2
|
chalk: 4.1.2
|
||||||
is-unicode-supported: 0.1.0
|
is-unicode-supported: 0.1.0
|
||||||
|
|
||||||
long@4.0.0: {}
|
|
||||||
|
|
||||||
longest-streak@3.1.0: {}
|
longest-streak@3.1.0: {}
|
||||||
|
|
||||||
loupe@3.1.2: {}
|
loupe@3.1.2: {}
|
||||||
@@ -14015,9 +13818,6 @@ snapshots:
|
|||||||
|
|
||||||
ms@2.0.0: {}
|
ms@2.0.0: {}
|
||||||
|
|
||||||
ms@2.1.2:
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
ms@2.1.3: {}
|
ms@2.1.3: {}
|
||||||
|
|
||||||
multimatch@5.0.0:
|
multimatch@5.0.0:
|
||||||
@@ -14067,9 +13867,6 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
semver: 7.6.3
|
semver: 7.6.3
|
||||||
|
|
||||||
node-addon-api@7.0.0:
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
node-addon-api@8.3.0: {}
|
node-addon-api@8.3.0: {}
|
||||||
|
|
||||||
node-domexception@1.0.0: {}
|
node-domexception@1.0.0: {}
|
||||||
@@ -14096,9 +13893,6 @@ snapshots:
|
|||||||
|
|
||||||
node-getopt@0.3.2: {}
|
node-getopt@0.3.2: {}
|
||||||
|
|
||||||
node-gyp-build@4.6.0:
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
node-gyp-build@4.8.4: {}
|
node-gyp-build@4.8.4: {}
|
||||||
|
|
||||||
node-gyp@10.3.1:
|
node-gyp@10.3.1:
|
||||||
@@ -14350,17 +14144,11 @@ snapshots:
|
|||||||
|
|
||||||
os-tmpdir@1.0.2: {}
|
os-tmpdir@1.0.2: {}
|
||||||
|
|
||||||
osc@2.4.5:
|
osc-js@2.4.1:
|
||||||
dependencies:
|
dependencies:
|
||||||
long: 4.0.0
|
|
||||||
slip: 1.0.2
|
|
||||||
wolfy87-eventemitter: 5.2.9
|
|
||||||
ws: 8.18.0
|
ws: 8.18.0
|
||||||
optionalDependencies:
|
|
||||||
serialport: 12.0.0
|
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- bufferutil
|
- bufferutil
|
||||||
- supports-color
|
|
||||||
- utf-8-validate
|
- utf-8-validate
|
||||||
|
|
||||||
own-keys@1.0.1:
|
own-keys@1.0.1:
|
||||||
@@ -15255,26 +15043,6 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
randombytes: 2.1.0
|
randombytes: 2.1.0
|
||||||
|
|
||||||
serialport@12.0.0:
|
|
||||||
dependencies:
|
|
||||||
'@serialport/binding-mock': 10.2.2
|
|
||||||
'@serialport/bindings-cpp': 12.0.1
|
|
||||||
'@serialport/parser-byte-length': 12.0.0
|
|
||||||
'@serialport/parser-cctalk': 12.0.0
|
|
||||||
'@serialport/parser-delimiter': 12.0.0
|
|
||||||
'@serialport/parser-inter-byte-timeout': 12.0.0
|
|
||||||
'@serialport/parser-packet-length': 12.0.0
|
|
||||||
'@serialport/parser-readline': 12.0.0
|
|
||||||
'@serialport/parser-ready': 12.0.0
|
|
||||||
'@serialport/parser-regex': 12.0.0
|
|
||||||
'@serialport/parser-slip-encoder': 12.0.0
|
|
||||||
'@serialport/parser-spacepacket': 12.0.0
|
|
||||||
'@serialport/stream': 12.0.0
|
|
||||||
debug: 4.3.4
|
|
||||||
transitivePeerDependencies:
|
|
||||||
- supports-color
|
|
||||||
optional: true
|
|
||||||
|
|
||||||
set-blocking@2.0.0: {}
|
set-blocking@2.0.0: {}
|
||||||
|
|
||||||
set-function-length@1.2.2:
|
set-function-length@1.2.2:
|
||||||
@@ -15417,8 +15185,6 @@ snapshots:
|
|||||||
|
|
||||||
slash@3.0.0: {}
|
slash@3.0.0: {}
|
||||||
|
|
||||||
slip@1.0.2: {}
|
|
||||||
|
|
||||||
smart-buffer@4.2.0: {}
|
smart-buffer@4.2.0: {}
|
||||||
|
|
||||||
socks-proxy-agent@8.0.5:
|
socks-proxy-agent@8.0.5:
|
||||||
@@ -16328,8 +16094,6 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
string-width: 7.2.0
|
string-width: 7.2.0
|
||||||
|
|
||||||
wolfy87-eventemitter@5.2.9: {}
|
|
||||||
|
|
||||||
word-wrap@1.2.5: {}
|
word-wrap@1.2.5: {}
|
||||||
|
|
||||||
wordwrap@0.0.3: {}
|
wordwrap@0.0.3: {}
|
||||||
@@ -16529,8 +16293,6 @@ snapshots:
|
|||||||
|
|
||||||
ws@8.18.0: {}
|
ws@8.18.0: {}
|
||||||
|
|
||||||
ws@8.18.3: {}
|
|
||||||
|
|
||||||
xmlcreate@2.0.4: {}
|
xmlcreate@2.0.4: {}
|
||||||
|
|
||||||
xtend@4.0.2: {}
|
xtend@4.0.2: {}
|
||||||
|
|||||||
@@ -2829,116 +2829,28 @@ exports[`runs examples > example "distort" example index 1 1`] = `
|
|||||||
]
|
]
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`runs examples > example "distort" example index 2 1`] = `
|
|
||||||
[
|
|
||||||
"[ 0/1 → 1/4 | s:bd n:4 bank:tr808 distort:3 distortvol:0.5 distorttype:diode ]",
|
|
||||||
"[ 1/4 → 1/2 | s:bd n:4 bank:tr808 distort:3 distortvol:0.5 distorttype:diode ]",
|
|
||||||
"[ 1/2 → 3/4 | s:bd n:4 bank:tr808 distort:3 distortvol:0.5 distorttype:diode ]",
|
|
||||||
"[ 3/4 → 1/1 | s:bd n:4 bank:tr808 distort:3 distortvol:0.5 distorttype:diode ]",
|
|
||||||
"[ 1/1 → 5/4 | s:bd n:4 bank:tr808 distort:3 distortvol:0.5 distorttype:diode ]",
|
|
||||||
"[ 5/4 → 3/2 | s:bd n:4 bank:tr808 distort:3 distortvol:0.5 distorttype:diode ]",
|
|
||||||
"[ 3/2 → 7/4 | s:bd n:4 bank:tr808 distort:3 distortvol:0.5 distorttype:diode ]",
|
|
||||||
"[ 7/4 → 2/1 | s:bd n:4 bank:tr808 distort:3 distortvol:0.5 distorttype:diode ]",
|
|
||||||
"[ 2/1 → 9/4 | s:bd n:4 bank:tr808 distort:3 distortvol:0.5 distorttype:diode ]",
|
|
||||||
"[ 9/4 → 5/2 | s:bd n:4 bank:tr808 distort:3 distortvol:0.5 distorttype:diode ]",
|
|
||||||
"[ 5/2 → 11/4 | s:bd n:4 bank:tr808 distort:3 distortvol:0.5 distorttype:diode ]",
|
|
||||||
"[ 11/4 → 3/1 | s:bd n:4 bank:tr808 distort:3 distortvol:0.5 distorttype:diode ]",
|
|
||||||
"[ 3/1 → 13/4 | s:bd n:4 bank:tr808 distort:3 distortvol:0.5 distorttype:diode ]",
|
|
||||||
"[ 13/4 → 7/2 | s:bd n:4 bank:tr808 distort:3 distortvol:0.5 distorttype:diode ]",
|
|
||||||
"[ 7/2 → 15/4 | s:bd n:4 bank:tr808 distort:3 distortvol:0.5 distorttype:diode ]",
|
|
||||||
"[ 15/4 → 4/1 | s:bd n:4 bank:tr808 distort:3 distortvol:0.5 distorttype:diode ]",
|
|
||||||
]
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`runs examples > example "distorttype" example index 0 1`] = `
|
|
||||||
[
|
|
||||||
"[ 0/1 → 1/4 | s:bd bank:tr909 distort:2 distorttype:0 ]",
|
|
||||||
"[ 1/4 → 1/2 | s:bd bank:tr909 distort:2 distorttype:0 ]",
|
|
||||||
"[ 1/2 → 3/4 | s:bd bank:tr909 distort:2 distorttype:0 ]",
|
|
||||||
"[ 3/4 → 1/1 | s:bd bank:tr909 distort:2 distorttype:0 ]",
|
|
||||||
"[ 1/1 → 5/4 | s:bd bank:tr909 distort:2 distorttype:1 ]",
|
|
||||||
"[ 5/4 → 3/2 | s:bd bank:tr909 distort:2 distorttype:1 ]",
|
|
||||||
"[ 3/2 → 7/4 | s:bd bank:tr909 distort:2 distorttype:1 ]",
|
|
||||||
"[ 7/4 → 2/1 | s:bd bank:tr909 distort:2 distorttype:1 ]",
|
|
||||||
"[ 2/1 → 9/4 | s:bd bank:tr909 distort:2 distorttype:2 ]",
|
|
||||||
"[ 9/4 → 5/2 | s:bd bank:tr909 distort:2 distorttype:2 ]",
|
|
||||||
"[ 5/2 → 11/4 | s:bd bank:tr909 distort:2 distorttype:2 ]",
|
|
||||||
"[ 11/4 → 3/1 | s:bd bank:tr909 distort:2 distorttype:2 ]",
|
|
||||||
"[ 3/1 → 13/4 | s:bd bank:tr909 distort:2 distorttype:0 ]",
|
|
||||||
"[ 13/4 → 7/2 | s:bd bank:tr909 distort:2 distorttype:0 ]",
|
|
||||||
"[ 7/2 → 15/4 | s:bd bank:tr909 distort:2 distorttype:0 ]",
|
|
||||||
"[ 15/4 → 4/1 | s:bd bank:tr909 distort:2 distorttype:0 ]",
|
|
||||||
]
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`runs examples > example "distorttype" example index 1 1`] = `
|
|
||||||
[
|
|
||||||
"[ (0/1 → 1/2) ⇝ 1/1 | s:sine note:F1 release:1 penv:24 pdecay:0.05 distort:1 distorttype:fold ]",
|
|
||||||
"[ 0/1 ⇜ (1/2 → 1/1) | s:sine note:F1 release:1 penv:24 pdecay:0.05 distort:1 distorttype:fold ]",
|
|
||||||
"[ (1/1 → 3/2) ⇝ 2/1 | s:sine note:F1 release:1 penv:24 pdecay:0.05 distort:4.6367951557040215 distorttype:chebyshev ]",
|
|
||||||
"[ 1/1 ⇜ (3/2 → 2/1) | s:sine note:F1 release:1 penv:24 pdecay:0.05 distort:4.6367951557040215 distorttype:chebyshev ]",
|
|
||||||
"[ (2/1 → 5/2) ⇝ 3/1 | s:sine note:F1 release:1 penv:24 pdecay:0.05 distort:7.716689839959145 distorttype:scurve ]",
|
|
||||||
"[ 2/1 ⇜ (5/2 → 3/1) | s:sine note:F1 release:1 penv:24 pdecay:0.05 distort:7.716689839959145 distorttype:scurve ]",
|
|
||||||
"[ (3/1 → 7/2) ⇝ 4/1 | s:sine note:F1 release:1 penv:24 pdecay:0.05 distort:2.5210237745195627 distorttype:diode ]",
|
|
||||||
"[ 3/1 ⇜ (7/2 → 4/1) | s:sine note:F1 release:1 penv:24 pdecay:0.05 distort:2.5210237745195627 distorttype:diode ]",
|
|
||||||
]
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`runs examples > example "distortvol" example index 0 1`] = `
|
|
||||||
[
|
|
||||||
"[ 0/1 → 1/4 | s:bd bank:tr909 distort:2 distortvol:0.8 ]",
|
|
||||||
"[ 1/4 → 1/2 | s:bd bank:tr909 distort:2 distortvol:0.8 ]",
|
|
||||||
"[ 1/2 → 3/4 | s:bd bank:tr909 distort:2 distortvol:0.8 ]",
|
|
||||||
"[ 3/4 → 1/1 | s:bd bank:tr909 distort:2 distortvol:0.8 ]",
|
|
||||||
"[ 1/1 → 5/4 | s:bd bank:tr909 distort:2 distortvol:0.8 ]",
|
|
||||||
"[ 5/4 → 3/2 | s:bd bank:tr909 distort:2 distortvol:0.8 ]",
|
|
||||||
"[ 3/2 → 7/4 | s:bd bank:tr909 distort:2 distortvol:0.8 ]",
|
|
||||||
"[ 7/4 → 2/1 | s:bd bank:tr909 distort:2 distortvol:0.8 ]",
|
|
||||||
"[ 2/1 → 9/4 | s:bd bank:tr909 distort:2 distortvol:0.8 ]",
|
|
||||||
"[ 9/4 → 5/2 | s:bd bank:tr909 distort:2 distortvol:0.8 ]",
|
|
||||||
"[ 5/2 → 11/4 | s:bd bank:tr909 distort:2 distortvol:0.8 ]",
|
|
||||||
"[ 11/4 → 3/1 | s:bd bank:tr909 distort:2 distortvol:0.8 ]",
|
|
||||||
"[ 3/1 → 13/4 | s:bd bank:tr909 distort:2 distortvol:0.8 ]",
|
|
||||||
"[ 13/4 → 7/2 | s:bd bank:tr909 distort:2 distortvol:0.8 ]",
|
|
||||||
"[ 7/2 → 15/4 | s:bd bank:tr909 distort:2 distortvol:0.8 ]",
|
|
||||||
"[ 15/4 → 4/1 | s:bd bank:tr909 distort:2 distortvol:0.8 ]",
|
|
||||||
]
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`runs examples > example "djf" example index 0 1`] = `
|
exports[`runs examples > example "djf" example index 0 1`] = `
|
||||||
[
|
[
|
||||||
"[ 0/1 → 1/8 | note:D3 s:supersaw djf:0.5 ]",
|
"[ 0/1 → 1/4 | n:0 s:superzow octave:3 djf:0.5 ]",
|
||||||
"[ 1/8 → 1/4 | note:G4 s:supersaw djf:0.5 ]",
|
"[ 1/4 → 1/2 | n:3 s:superzow octave:3 djf:0.5 ]",
|
||||||
"[ 1/4 → 3/8 | note:Bb3 s:supersaw djf:0.5 ]",
|
"[ 1/2 → 3/4 | n:7 s:superzow octave:3 djf:0.5 ]",
|
||||||
"[ 3/8 → 1/2 | note:C4 s:supersaw djf:0.5 ]",
|
"[ 3/4 → 1/1 | n:10 s:superzow octave:3 djf:0.5 ]",
|
||||||
"[ 1/2 → 5/8 | note:A3 s:supersaw djf:0.5 ]",
|
"[ 3/4 → 1/1 | n:24 s:superzow octave:3 djf:0.5 ]",
|
||||||
"[ 5/8 → 3/4 | note:F3 s:supersaw djf:0.5 ]",
|
"[ 1/1 → 5/4 | n:0 s:superzow octave:3 djf:0.25 ]",
|
||||||
"[ 3/4 → 7/8 | note:G3 s:supersaw djf:0.5 ]",
|
"[ 5/4 → 3/2 | n:3 s:superzow octave:3 djf:0.25 ]",
|
||||||
"[ 7/8 → 1/1 | note:C4 s:supersaw djf:0.5 ]",
|
"[ 3/2 → 7/4 | n:7 s:superzow octave:3 djf:0.25 ]",
|
||||||
"[ 1/1 → 9/8 | note:Eb4 s:supersaw djf:0.3 ]",
|
"[ 7/4 → 2/1 | n:10 s:superzow octave:3 djf:0.25 ]",
|
||||||
"[ 9/8 → 5/4 | note:G4 s:supersaw djf:0.3 ]",
|
"[ 7/4 → 2/1 | n:24 s:superzow octave:3 djf:0.25 ]",
|
||||||
"[ 5/4 → 11/8 | note:A4 s:supersaw djf:0.3 ]",
|
"[ 2/1 → 9/4 | n:0 s:superzow octave:3 djf:0.5 ]",
|
||||||
"[ 11/8 → 3/2 | note:F3 s:supersaw djf:0.3 ]",
|
"[ 9/4 → 5/2 | n:3 s:superzow octave:3 djf:0.5 ]",
|
||||||
"[ 3/2 → 13/8 | note:F4 s:supersaw djf:0.3 ]",
|
"[ 5/2 → 11/4 | n:7 s:superzow octave:3 djf:0.5 ]",
|
||||||
"[ 13/8 → 7/4 | note:D4 s:supersaw djf:0.3 ]",
|
"[ 11/4 → 3/1 | n:10 s:superzow octave:3 djf:0.5 ]",
|
||||||
"[ 7/4 → 15/8 | note:G3 s:supersaw djf:0.3 ]",
|
"[ 11/4 → 3/1 | n:24 s:superzow octave:3 djf:0.5 ]",
|
||||||
"[ 15/8 → 2/1 | note:F4 s:supersaw djf:0.3 ]",
|
"[ 3/1 → 13/4 | n:0 s:superzow octave:3 djf:0.75 ]",
|
||||||
"[ 2/1 → 17/8 | note:Eb5 s:supersaw djf:0.2 ]",
|
"[ 13/4 → 7/2 | n:3 s:superzow octave:3 djf:0.75 ]",
|
||||||
"[ 17/8 → 9/4 | note:D5 s:supersaw djf:0.2 ]",
|
"[ 7/2 → 15/4 | n:7 s:superzow octave:3 djf:0.75 ]",
|
||||||
"[ 9/4 → 19/8 | note:Bb3 s:supersaw djf:0.2 ]",
|
"[ 15/4 → 4/1 | n:10 s:superzow octave:3 djf:0.75 ]",
|
||||||
"[ 19/8 → 5/2 | note:C5 s:supersaw djf:0.2 ]",
|
"[ 15/4 → 4/1 | n:24 s:superzow octave:3 djf:0.75 ]",
|
||||||
"[ 5/2 → 21/8 | note:D4 s:supersaw djf:0.2 ]",
|
|
||||||
"[ 21/8 → 11/4 | note:F3 s:supersaw djf:0.2 ]",
|
|
||||||
"[ 11/4 → 23/8 | note:G4 s:supersaw djf:0.2 ]",
|
|
||||||
"[ 23/8 → 3/1 | note:D3 s:supersaw djf:0.2 ]",
|
|
||||||
"[ 3/1 → 25/8 | note:G3 s:supersaw djf:0.75 ]",
|
|
||||||
"[ 25/8 → 13/4 | note:Bb3 s:supersaw djf:0.75 ]",
|
|
||||||
"[ 13/4 → 27/8 | note:Eb5 s:supersaw djf:0.75 ]",
|
|
||||||
"[ 27/8 → 7/2 | note:C4 s:supersaw djf:0.75 ]",
|
|
||||||
"[ 7/2 → 29/8 | note:C4 s:supersaw djf:0.75 ]",
|
|
||||||
"[ 29/8 → 15/4 | note:Eb5 s:supersaw djf:0.75 ]",
|
|
||||||
"[ 15/4 → 31/8 | note:Bb4 s:supersaw djf:0.75 ]",
|
|
||||||
"[ 31/8 → 4/1 | note:A4 s:supersaw djf:0.75 ]",
|
|
||||||
]
|
]
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@@ -3181,50 +3093,57 @@ exports[`runs examples > example "dry" example index 0 1`] = `
|
|||||||
exports[`runs examples > example "duckattack" example index 0 1`] = `
|
exports[`runs examples > example "duckattack" example index 0 1`] = `
|
||||||
[
|
[
|
||||||
"[ 0/1 → 1/16 | s:bd n:4 duckorbit:2 duckattack:0.2 duckdepth:1 ]",
|
"[ 0/1 → 1/16 | s:bd n:4 duckorbit:2 duckattack:0.2 duckdepth:1 ]",
|
||||||
|
"[ 0/1 → 1/8 | note:C3 s:sawtooth delay:0.7 orbit:2 ]",
|
||||||
|
"[ 1/8 → 1/4 | note:D3 s:sawtooth delay:0.7 orbit:2 ]",
|
||||||
"[ 1/4 → 5/16 | s:bd n:4 duckorbit:2 duckattack:0.2 duckdepth:1 ]",
|
"[ 1/4 → 5/16 | s:bd n:4 duckorbit:2 duckattack:0.2 duckdepth:1 ]",
|
||||||
|
"[ 1/4 → 3/8 | note:Eb3 s:sawtooth delay:0.7 orbit:2 ]",
|
||||||
|
"[ 3/8 → 1/2 | note:F3 s:sawtooth delay:0.7 orbit:2 ]",
|
||||||
"[ 1/2 → 9/16 | s:bd n:4 duckorbit:2 duckattack:0.2 duckdepth:1 ]",
|
"[ 1/2 → 9/16 | s:bd n:4 duckorbit:2 duckattack:0.2 duckdepth:1 ]",
|
||||||
|
"[ 1/2 → 5/8 | note:G3 s:sawtooth delay:0.7 orbit:2 ]",
|
||||||
|
"[ 5/8 → 3/4 | note:Ab3 s:sawtooth delay:0.7 orbit:2 ]",
|
||||||
"[ 11/16 → 3/4 | s:bd n:4 duckorbit:2 duckattack:0.2 duckdepth:1 ]",
|
"[ 11/16 → 3/4 | s:bd n:4 duckorbit:2 duckattack:0.2 duckdepth:1 ]",
|
||||||
|
"[ 3/4 → 7/8 | note:Bb3 s:sawtooth delay:0.7 orbit:2 ]",
|
||||||
"[ 7/8 → 15/16 | s:bd n:4 duckorbit:2 duckattack:0.2 duckdepth:1 ]",
|
"[ 7/8 → 15/16 | s:bd n:4 duckorbit:2 duckattack:0.2 duckdepth:1 ]",
|
||||||
|
"[ 7/8 → 1/1 | note:C4 s:sawtooth delay:0.7 orbit:2 ]",
|
||||||
"[ 1/1 → 17/16 | s:bd n:4 duckorbit:2 duckattack:0 duckdepth:1 ]",
|
"[ 1/1 → 17/16 | s:bd n:4 duckorbit:2 duckattack:0 duckdepth:1 ]",
|
||||||
|
"[ 1/1 → 9/8 | note:C3 s:sawtooth delay:0.7 orbit:2 ]",
|
||||||
|
"[ 9/8 → 5/4 | note:D3 s:sawtooth delay:0.7 orbit:2 ]",
|
||||||
"[ 5/4 → 21/16 | s:bd n:4 duckorbit:2 duckattack:0 duckdepth:1 ]",
|
"[ 5/4 → 21/16 | s:bd n:4 duckorbit:2 duckattack:0 duckdepth:1 ]",
|
||||||
|
"[ 5/4 → 11/8 | note:Eb3 s:sawtooth delay:0.7 orbit:2 ]",
|
||||||
|
"[ 11/8 → 3/2 | note:F3 s:sawtooth delay:0.7 orbit:2 ]",
|
||||||
"[ 3/2 → 25/16 | s:bd n:4 duckorbit:2 duckattack:0 duckdepth:1 ]",
|
"[ 3/2 → 25/16 | s:bd n:4 duckorbit:2 duckattack:0 duckdepth:1 ]",
|
||||||
|
"[ 3/2 → 13/8 | note:G3 s:sawtooth delay:0.7 orbit:2 ]",
|
||||||
|
"[ 13/8 → 7/4 | note:Ab3 s:sawtooth delay:0.7 orbit:2 ]",
|
||||||
"[ 27/16 → 7/4 | s:bd n:4 duckorbit:2 duckattack:0 duckdepth:1 ]",
|
"[ 27/16 → 7/4 | s:bd n:4 duckorbit:2 duckattack:0 duckdepth:1 ]",
|
||||||
|
"[ 7/4 → 15/8 | note:Bb3 s:sawtooth delay:0.7 orbit:2 ]",
|
||||||
"[ 15/8 → 31/16 | s:bd n:4 duckorbit:2 duckattack:0 duckdepth:1 ]",
|
"[ 15/8 → 31/16 | s:bd n:4 duckorbit:2 duckattack:0 duckdepth:1 ]",
|
||||||
|
"[ 15/8 → 2/1 | note:C4 s:sawtooth delay:0.7 orbit:2 ]",
|
||||||
"[ 2/1 → 33/16 | s:bd n:4 duckorbit:2 duckattack:0.4 duckdepth:1 ]",
|
"[ 2/1 → 33/16 | s:bd n:4 duckorbit:2 duckattack:0.4 duckdepth:1 ]",
|
||||||
|
"[ 2/1 → 17/8 | note:C3 s:sawtooth delay:0.7 orbit:2 ]",
|
||||||
|
"[ 17/8 → 9/4 | note:D3 s:sawtooth delay:0.7 orbit:2 ]",
|
||||||
"[ 9/4 → 37/16 | s:bd n:4 duckorbit:2 duckattack:0.4 duckdepth:1 ]",
|
"[ 9/4 → 37/16 | s:bd n:4 duckorbit:2 duckattack:0.4 duckdepth:1 ]",
|
||||||
|
"[ 9/4 → 19/8 | note:Eb3 s:sawtooth delay:0.7 orbit:2 ]",
|
||||||
|
"[ 19/8 → 5/2 | note:F3 s:sawtooth delay:0.7 orbit:2 ]",
|
||||||
"[ 5/2 → 41/16 | s:bd n:4 duckorbit:2 duckattack:0.4 duckdepth:1 ]",
|
"[ 5/2 → 41/16 | s:bd n:4 duckorbit:2 duckattack:0.4 duckdepth:1 ]",
|
||||||
|
"[ 5/2 → 21/8 | note:G3 s:sawtooth delay:0.7 orbit:2 ]",
|
||||||
|
"[ 21/8 → 11/4 | note:Ab3 s:sawtooth delay:0.7 orbit:2 ]",
|
||||||
"[ 43/16 → 11/4 | s:bd n:4 duckorbit:2 duckattack:0.4 duckdepth:1 ]",
|
"[ 43/16 → 11/4 | s:bd n:4 duckorbit:2 duckattack:0.4 duckdepth:1 ]",
|
||||||
|
"[ 11/4 → 23/8 | note:Bb3 s:sawtooth delay:0.7 orbit:2 ]",
|
||||||
"[ 23/8 → 47/16 | s:bd n:4 duckorbit:2 duckattack:0.4 duckdepth:1 ]",
|
"[ 23/8 → 47/16 | s:bd n:4 duckorbit:2 duckattack:0.4 duckdepth:1 ]",
|
||||||
|
"[ 23/8 → 3/1 | note:C4 s:sawtooth delay:0.7 orbit:2 ]",
|
||||||
"[ 3/1 → 49/16 | s:bd n:4 duckorbit:2 duckattack:0.2 duckdepth:1 ]",
|
"[ 3/1 → 49/16 | s:bd n:4 duckorbit:2 duckattack:0.2 duckdepth:1 ]",
|
||||||
|
"[ 3/1 → 25/8 | note:C3 s:sawtooth delay:0.7 orbit:2 ]",
|
||||||
|
"[ 25/8 → 13/4 | note:D3 s:sawtooth delay:0.7 orbit:2 ]",
|
||||||
"[ 13/4 → 53/16 | s:bd n:4 duckorbit:2 duckattack:0.2 duckdepth:1 ]",
|
"[ 13/4 → 53/16 | s:bd n:4 duckorbit:2 duckattack:0.2 duckdepth:1 ]",
|
||||||
|
"[ 13/4 → 27/8 | note:Eb3 s:sawtooth delay:0.7 orbit:2 ]",
|
||||||
|
"[ 27/8 → 7/2 | note:F3 s:sawtooth delay:0.7 orbit:2 ]",
|
||||||
"[ 7/2 → 57/16 | s:bd n:4 duckorbit:2 duckattack:0.2 duckdepth:1 ]",
|
"[ 7/2 → 57/16 | s:bd n:4 duckorbit:2 duckattack:0.2 duckdepth:1 ]",
|
||||||
|
"[ 7/2 → 29/8 | note:G3 s:sawtooth delay:0.7 orbit:2 ]",
|
||||||
|
"[ 29/8 → 15/4 | note:Ab3 s:sawtooth delay:0.7 orbit:2 ]",
|
||||||
"[ 59/16 → 15/4 | s:bd n:4 duckorbit:2 duckattack:0.2 duckdepth:1 ]",
|
"[ 59/16 → 15/4 | s:bd n:4 duckorbit:2 duckattack:0.2 duckdepth:1 ]",
|
||||||
|
"[ 15/4 → 31/8 | note:Bb3 s:sawtooth delay:0.7 orbit:2 ]",
|
||||||
"[ 31/8 → 63/16 | s:bd n:4 duckorbit:2 duckattack:0.2 duckdepth:1 ]",
|
"[ 31/8 → 63/16 | s:bd n:4 duckorbit:2 duckattack:0.2 duckdepth:1 ]",
|
||||||
]
|
"[ 31/8 → 4/1 | note:C4 s:sawtooth delay:0.7 orbit:2 ]",
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`runs examples > example "duckattack" example index 1 1`] = `
|
|
||||||
[
|
|
||||||
"[ 0/1 → 1/16 | s:bd n:4 duckorbit:[2 5] duckattack:[0.4 0.1] ]",
|
|
||||||
"[ 1/4 → 5/16 | s:bd n:4 duckorbit:[2 5] duckattack:[0.4 0.1] ]",
|
|
||||||
"[ 1/2 → 9/16 | s:bd n:4 duckorbit:[2 5] duckattack:[0.4 0.1] ]",
|
|
||||||
"[ 11/16 → 3/4 | s:bd n:4 duckorbit:[2 5] duckattack:[0.4 0.1] ]",
|
|
||||||
"[ 7/8 → 15/16 | s:bd n:4 duckorbit:[2 5] duckattack:[0.4 0.1] ]",
|
|
||||||
"[ 1/1 → 17/16 | s:bd n:4 duckorbit:[2 5] duckattack:[0.4 0.1] ]",
|
|
||||||
"[ 5/4 → 21/16 | s:bd n:4 duckorbit:[2 5] duckattack:[0.4 0.1] ]",
|
|
||||||
"[ 3/2 → 25/16 | s:bd n:4 duckorbit:[2 5] duckattack:[0.4 0.1] ]",
|
|
||||||
"[ 27/16 → 7/4 | s:bd n:4 duckorbit:[2 5] duckattack:[0.4 0.1] ]",
|
|
||||||
"[ 15/8 → 31/16 | s:bd n:4 duckorbit:[2 5] duckattack:[0.4 0.1] ]",
|
|
||||||
"[ 2/1 → 33/16 | s:bd n:4 duckorbit:[2 5] duckattack:[0.4 0.1] ]",
|
|
||||||
"[ 9/4 → 37/16 | s:bd n:4 duckorbit:[2 5] duckattack:[0.4 0.1] ]",
|
|
||||||
"[ 5/2 → 41/16 | s:bd n:4 duckorbit:[2 5] duckattack:[0.4 0.1] ]",
|
|
||||||
"[ 43/16 → 11/4 | s:bd n:4 duckorbit:[2 5] duckattack:[0.4 0.1] ]",
|
|
||||||
"[ 23/8 → 47/16 | s:bd n:4 duckorbit:[2 5] duckattack:[0.4 0.1] ]",
|
|
||||||
"[ 3/1 → 49/16 | s:bd n:4 duckorbit:[2 5] duckattack:[0.4 0.1] ]",
|
|
||||||
"[ 13/4 → 53/16 | s:bd n:4 duckorbit:[2 5] duckattack:[0.4 0.1] ]",
|
|
||||||
"[ 7/2 → 57/16 | s:bd n:4 duckorbit:[2 5] duckattack:[0.4 0.1] ]",
|
|
||||||
"[ 59/16 → 15/4 | s:bd n:4 duckorbit:[2 5] duckattack:[0.4 0.1] ]",
|
|
||||||
"[ 31/8 → 63/16 | s:bd n:4 duckorbit:[2 5] duckattack:[0.4 0.1] ]",
|
|
||||||
]
|
]
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@@ -3285,94 +3204,6 @@ exports[`runs examples > example "duckdepth" example index 0 1`] = `
|
|||||||
]
|
]
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`runs examples > example "duckdepth" example index 1 1`] = `
|
|
||||||
[
|
|
||||||
"[ 0/1 → 1/16 | s:bd n:4 duckorbit:[2 3] duckattack:0.2 duckdepth:[1 0.5] ]",
|
|
||||||
"[ 1/4 → 5/16 | s:bd n:4 duckorbit:[2 3] duckattack:0.2 duckdepth:[1 0.5] ]",
|
|
||||||
"[ 1/2 → 9/16 | s:bd n:4 duckorbit:[2 3] duckattack:0.2 duckdepth:[1 0.5] ]",
|
|
||||||
"[ 11/16 → 3/4 | s:bd n:4 duckorbit:[2 3] duckattack:0.2 duckdepth:[1 0.5] ]",
|
|
||||||
"[ 7/8 → 15/16 | s:bd n:4 duckorbit:[2 3] duckattack:0.2 duckdepth:[1 0.5] ]",
|
|
||||||
"[ 1/1 → 17/16 | s:bd n:4 duckorbit:[2 3] duckattack:0.2 duckdepth:[1 0.5] ]",
|
|
||||||
"[ 5/4 → 21/16 | s:bd n:4 duckorbit:[2 3] duckattack:0.2 duckdepth:[1 0.5] ]",
|
|
||||||
"[ 3/2 → 25/16 | s:bd n:4 duckorbit:[2 3] duckattack:0.2 duckdepth:[1 0.5] ]",
|
|
||||||
"[ 27/16 → 7/4 | s:bd n:4 duckorbit:[2 3] duckattack:0.2 duckdepth:[1 0.5] ]",
|
|
||||||
"[ 15/8 → 31/16 | s:bd n:4 duckorbit:[2 3] duckattack:0.2 duckdepth:[1 0.5] ]",
|
|
||||||
"[ 2/1 → 33/16 | s:bd n:4 duckorbit:[2 3] duckattack:0.2 duckdepth:[1 0.5] ]",
|
|
||||||
"[ 9/4 → 37/16 | s:bd n:4 duckorbit:[2 3] duckattack:0.2 duckdepth:[1 0.5] ]",
|
|
||||||
"[ 5/2 → 41/16 | s:bd n:4 duckorbit:[2 3] duckattack:0.2 duckdepth:[1 0.5] ]",
|
|
||||||
"[ 43/16 → 11/4 | s:bd n:4 duckorbit:[2 3] duckattack:0.2 duckdepth:[1 0.5] ]",
|
|
||||||
"[ 23/8 → 47/16 | s:bd n:4 duckorbit:[2 3] duckattack:0.2 duckdepth:[1 0.5] ]",
|
|
||||||
"[ 3/1 → 49/16 | s:bd n:4 duckorbit:[2 3] duckattack:0.2 duckdepth:[1 0.5] ]",
|
|
||||||
"[ 13/4 → 53/16 | s:bd n:4 duckorbit:[2 3] duckattack:0.2 duckdepth:[1 0.5] ]",
|
|
||||||
"[ 7/2 → 57/16 | s:bd n:4 duckorbit:[2 3] duckattack:0.2 duckdepth:[1 0.5] ]",
|
|
||||||
"[ 59/16 → 15/4 | s:bd n:4 duckorbit:[2 3] duckattack:0.2 duckdepth:[1 0.5] ]",
|
|
||||||
"[ 31/8 → 63/16 | s:bd n:4 duckorbit:[2 3] duckattack:0.2 duckdepth:[1 0.5] ]",
|
|
||||||
]
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`runs examples > example "duckonset" example index 0 1`] = `
|
|
||||||
[
|
|
||||||
"[ 0/1 → 1/4 | s:bd duckorbit:2 duckattack:0.3 duckonset:0 postgain:0 ]",
|
|
||||||
"[ 1/4 → 1/2 | s:bd duckorbit:2 duckattack:0.3 duckonset:0 postgain:0 ]",
|
|
||||||
"[ 1/2 → 3/4 | s:bd duckorbit:2 duckattack:0.3 duckonset:0 postgain:0 ]",
|
|
||||||
"[ 3/4 → 1/1 | s:bd duckorbit:2 duckattack:0.3 duckonset:0 postgain:0 ]",
|
|
||||||
"[ 1/1 → 5/4 | s:bd duckorbit:2 duckattack:0.3 duckonset:0 postgain:0 ]",
|
|
||||||
"[ 5/4 → 3/2 | s:bd duckorbit:2 duckattack:0.3 duckonset:0 postgain:0 ]",
|
|
||||||
"[ 3/2 → 7/4 | s:bd duckorbit:2 duckattack:0.3 duckonset:0 postgain:0 ]",
|
|
||||||
"[ 7/4 → 2/1 | s:bd duckorbit:2 duckattack:0.3 duckonset:0 postgain:0 ]",
|
|
||||||
"[ 2/1 → 9/4 | s:bd duckorbit:2 duckattack:0.3 duckonset:0 postgain:0 ]",
|
|
||||||
"[ 9/4 → 5/2 | s:bd duckorbit:2 duckattack:0.3 duckonset:0 postgain:0 ]",
|
|
||||||
"[ 5/2 → 11/4 | s:bd duckorbit:2 duckattack:0.3 duckonset:0 postgain:0 ]",
|
|
||||||
"[ 11/4 → 3/1 | s:bd duckorbit:2 duckattack:0.3 duckonset:0 postgain:0 ]",
|
|
||||||
"[ 3/1 → 13/4 | s:bd duckorbit:2 duckattack:0.3 duckonset:0 postgain:0 ]",
|
|
||||||
"[ 13/4 → 7/2 | s:bd duckorbit:2 duckattack:0.3 duckonset:0 postgain:0 ]",
|
|
||||||
"[ 7/2 → 15/4 | s:bd duckorbit:2 duckattack:0.3 duckonset:0 postgain:0 ]",
|
|
||||||
"[ 15/4 → 4/1 | s:bd duckorbit:2 duckattack:0.3 duckonset:0 postgain:0 ]",
|
|
||||||
]
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`runs examples > example "duckonset" example index 1 1`] = `
|
|
||||||
[
|
|
||||||
"[ 0/1 → 1/4 | s:bd duckorbit:2 duckattack:0.3 duckonset:0.01 postgain:0 ]",
|
|
||||||
"[ 1/4 → 1/2 | s:bd duckorbit:2 duckattack:0.3 duckonset:0.01 postgain:0 ]",
|
|
||||||
"[ 1/2 → 3/4 | s:bd duckorbit:2 duckattack:0.3 duckonset:0.01 postgain:0 ]",
|
|
||||||
"[ 3/4 → 1/1 | s:bd duckorbit:2 duckattack:0.3 duckonset:0.01 postgain:0 ]",
|
|
||||||
"[ 1/1 → 5/4 | s:bd duckorbit:2 duckattack:0.3 duckonset:0.01 postgain:0 ]",
|
|
||||||
"[ 5/4 → 3/2 | s:bd duckorbit:2 duckattack:0.3 duckonset:0.01 postgain:0 ]",
|
|
||||||
"[ 3/2 → 7/4 | s:bd duckorbit:2 duckattack:0.3 duckonset:0.01 postgain:0 ]",
|
|
||||||
"[ 7/4 → 2/1 | s:bd duckorbit:2 duckattack:0.3 duckonset:0.01 postgain:0 ]",
|
|
||||||
"[ 2/1 → 9/4 | s:bd duckorbit:2 duckattack:0.3 duckonset:0.01 postgain:0 ]",
|
|
||||||
"[ 9/4 → 5/2 | s:bd duckorbit:2 duckattack:0.3 duckonset:0.01 postgain:0 ]",
|
|
||||||
"[ 5/2 → 11/4 | s:bd duckorbit:2 duckattack:0.3 duckonset:0.01 postgain:0 ]",
|
|
||||||
"[ 11/4 → 3/1 | s:bd duckorbit:2 duckattack:0.3 duckonset:0.01 postgain:0 ]",
|
|
||||||
"[ 3/1 → 13/4 | s:bd duckorbit:2 duckattack:0.3 duckonset:0.01 postgain:0 ]",
|
|
||||||
"[ 13/4 → 7/2 | s:bd duckorbit:2 duckattack:0.3 duckonset:0.01 postgain:0 ]",
|
|
||||||
"[ 7/2 → 15/4 | s:bd duckorbit:2 duckattack:0.3 duckonset:0.01 postgain:0 ]",
|
|
||||||
"[ 15/4 → 4/1 | s:bd duckorbit:2 duckattack:0.3 duckonset:0.01 postgain:0 ]",
|
|
||||||
]
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`runs examples > example "duckonset" example index 2 1`] = `
|
|
||||||
[
|
|
||||||
"[ 0/1 → 1/4 | s:bd bank:tr909 duckorbit:[4 7] duckonset:[0.3 0.003] duckattack:0.25 ]",
|
|
||||||
"[ 1/4 → 1/2 | s:bd bank:tr909 duckorbit:[4 7] duckonset:[0.3 0.003] duckattack:0.25 ]",
|
|
||||||
"[ 1/2 → 3/4 | s:bd bank:tr909 duckorbit:[4 7] duckonset:[0.3 0.003] duckattack:0.25 ]",
|
|
||||||
"[ 3/4 → 1/1 | s:bd bank:tr909 duckorbit:[4 7] duckonset:[0.3 0.003] duckattack:0.25 ]",
|
|
||||||
"[ 1/1 → 5/4 | s:bd bank:tr909 duckorbit:[4 7] duckonset:[0.3 0.003] duckattack:0.25 ]",
|
|
||||||
"[ 5/4 → 3/2 | s:bd bank:tr909 duckorbit:[4 7] duckonset:[0.3 0.003] duckattack:0.25 ]",
|
|
||||||
"[ 3/2 → 7/4 | s:bd bank:tr909 duckorbit:[4 7] duckonset:[0.3 0.003] duckattack:0.25 ]",
|
|
||||||
"[ 7/4 → 2/1 | s:bd bank:tr909 duckorbit:[4 7] duckonset:[0.3 0.003] duckattack:0.25 ]",
|
|
||||||
"[ 2/1 → 9/4 | s:bd bank:tr909 duckorbit:[4 7] duckonset:[0.3 0.003] duckattack:0.25 ]",
|
|
||||||
"[ 9/4 → 5/2 | s:bd bank:tr909 duckorbit:[4 7] duckonset:[0.3 0.003] duckattack:0.25 ]",
|
|
||||||
"[ 5/2 → 11/4 | s:bd bank:tr909 duckorbit:[4 7] duckonset:[0.3 0.003] duckattack:0.25 ]",
|
|
||||||
"[ 11/4 → 3/1 | s:bd bank:tr909 duckorbit:[4 7] duckonset:[0.3 0.003] duckattack:0.25 ]",
|
|
||||||
"[ 3/1 → 13/4 | s:bd bank:tr909 duckorbit:[4 7] duckonset:[0.3 0.003] duckattack:0.25 ]",
|
|
||||||
"[ 13/4 → 7/2 | s:bd bank:tr909 duckorbit:[4 7] duckonset:[0.3 0.003] duckattack:0.25 ]",
|
|
||||||
"[ 7/2 → 15/4 | s:bd bank:tr909 duckorbit:[4 7] duckonset:[0.3 0.003] duckattack:0.25 ]",
|
|
||||||
"[ 15/4 → 4/1 | s:bd bank:tr909 duckorbit:[4 7] duckonset:[0.3 0.003] duckattack:0.25 ]",
|
|
||||||
]
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`runs examples > example "duckorbit" example index 0 1`] = `
|
exports[`runs examples > example "duckorbit" example index 0 1`] = `
|
||||||
[
|
[
|
||||||
"[ 0/1 → 1/16 | s:bd n:4 duckorbit:2 duckattack:0.2 duckdepth:1 ]",
|
"[ 0/1 → 1/16 | s:bd n:4 duckorbit:2 duckattack:0.2 duckdepth:1 ]",
|
||||||
@@ -3398,31 +3229,6 @@ exports[`runs examples > example "duckorbit" example index 0 1`] = `
|
|||||||
]
|
]
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`runs examples > example "duckorbit" example index 1 1`] = `
|
|
||||||
[
|
|
||||||
"[ 0/1 → 1/16 | s:bd n:4 duckorbit:[2 3] duckattack:0.2 duckdepth:1 ]",
|
|
||||||
"[ 1/4 → 5/16 | s:bd n:4 duckorbit:[2 3] duckattack:0.2 duckdepth:1 ]",
|
|
||||||
"[ 1/2 → 9/16 | s:bd n:4 duckorbit:[2 3] duckattack:0.2 duckdepth:1 ]",
|
|
||||||
"[ 11/16 → 3/4 | s:bd n:4 duckorbit:[2 3] duckattack:0.2 duckdepth:1 ]",
|
|
||||||
"[ 7/8 → 15/16 | s:bd n:4 duckorbit:[2 3] duckattack:0.2 duckdepth:1 ]",
|
|
||||||
"[ 1/1 → 17/16 | s:bd n:4 duckorbit:[2 3] duckattack:0.2 duckdepth:1 ]",
|
|
||||||
"[ 5/4 → 21/16 | s:bd n:4 duckorbit:[2 3] duckattack:0.2 duckdepth:1 ]",
|
|
||||||
"[ 3/2 → 25/16 | s:bd n:4 duckorbit:[2 3] duckattack:0.2 duckdepth:1 ]",
|
|
||||||
"[ 27/16 → 7/4 | s:bd n:4 duckorbit:[2 3] duckattack:0.2 duckdepth:1 ]",
|
|
||||||
"[ 15/8 → 31/16 | s:bd n:4 duckorbit:[2 3] duckattack:0.2 duckdepth:1 ]",
|
|
||||||
"[ 2/1 → 33/16 | s:bd n:4 duckorbit:[2 3] duckattack:0.2 duckdepth:1 ]",
|
|
||||||
"[ 9/4 → 37/16 | s:bd n:4 duckorbit:[2 3] duckattack:0.2 duckdepth:1 ]",
|
|
||||||
"[ 5/2 → 41/16 | s:bd n:4 duckorbit:[2 3] duckattack:0.2 duckdepth:1 ]",
|
|
||||||
"[ 43/16 → 11/4 | s:bd n:4 duckorbit:[2 3] duckattack:0.2 duckdepth:1 ]",
|
|
||||||
"[ 23/8 → 47/16 | s:bd n:4 duckorbit:[2 3] duckattack:0.2 duckdepth:1 ]",
|
|
||||||
"[ 3/1 → 49/16 | s:bd n:4 duckorbit:[2 3] duckattack:0.2 duckdepth:1 ]",
|
|
||||||
"[ 13/4 → 53/16 | s:bd n:4 duckorbit:[2 3] duckattack:0.2 duckdepth:1 ]",
|
|
||||||
"[ 7/2 → 57/16 | s:bd n:4 duckorbit:[2 3] duckattack:0.2 duckdepth:1 ]",
|
|
||||||
"[ 59/16 → 15/4 | s:bd n:4 duckorbit:[2 3] duckattack:0.2 duckdepth:1 ]",
|
|
||||||
"[ 31/8 → 63/16 | s:bd n:4 duckorbit:[2 3] duckattack:0.2 duckdepth:1 ]",
|
|
||||||
]
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`runs examples > example "duration" example index 0 1`] = `
|
exports[`runs examples > example "duration" example index 0 1`] = `
|
||||||
[
|
[
|
||||||
"[ 0/1 → 1/4 | note:c s:piano duration:0.5 ]",
|
"[ 0/1 → 1/4 | note:c s:piano duration:0.5 ]",
|
||||||
@@ -3495,20 +3301,28 @@ exports[`runs examples > example "echo" example index 0 1`] = `
|
|||||||
]
|
]
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
exports[`runs examples > example "echoForEach" example index 0 1`] = `[]`;
|
||||||
|
|
||||||
exports[`runs examples > example "echoWith" example index 0 1`] = `
|
exports[`runs examples > example "echoWith" example index 0 1`] = `
|
||||||
[
|
[
|
||||||
"[ -3/8 ⇜ (0/1 → 1/8) | note:Bb3 ]",
|
"[ -3/8 ⇜ (0/1 → 1/8) | note:Bb3 ]",
|
||||||
"[ -1/4 ⇜ (0/1 → 1/4) | note:D4 ]",
|
"[ -1/4 ⇜ (0/1 → 1/8) ⇝ 1/4 | note:D4 ]",
|
||||||
"[ -1/8 ⇜ (0/1 → 3/8) | note:F4 ]",
|
"[ -1/8 ⇜ (0/1 → 1/8) ⇝ 3/8 | note:F4 ]",
|
||||||
"[ 0/1 → 1/1 | note:C3 ]",
|
"[ 0/1 → 1/1 | note:C3 ]",
|
||||||
|
"[ -1/4 ⇜ (1/8 → 1/4) | note:D4 ]",
|
||||||
|
"[ -1/8 ⇜ (1/8 → 1/4) ⇝ 3/8 | note:F4 ]",
|
||||||
"[ (1/8 → 1/1) ⇝ 9/8 | note:Eb3 ]",
|
"[ (1/8 → 1/1) ⇝ 9/8 | note:Eb3 ]",
|
||||||
|
"[ -1/8 ⇜ (1/4 → 3/8) | note:F4 ]",
|
||||||
"[ (1/4 → 1/1) ⇝ 5/4 | note:G3 ]",
|
"[ (1/4 → 1/1) ⇝ 5/4 | note:G3 ]",
|
||||||
"[ (3/8 → 1/1) ⇝ 11/8 | note:Bb3 ]",
|
"[ (3/8 → 1/1) ⇝ 11/8 | note:Bb3 ]",
|
||||||
"[ 1/8 ⇜ (1/1 → 9/8) | note:Eb3 ]",
|
"[ 1/8 ⇜ (1/1 → 9/8) | note:Eb3 ]",
|
||||||
"[ 1/4 ⇜ (1/1 → 5/4) | note:G3 ]",
|
"[ 1/4 ⇜ (1/1 → 9/8) ⇝ 5/4 | note:G3 ]",
|
||||||
"[ 3/8 ⇜ (1/1 → 11/8) | note:Bb3 ]",
|
"[ 3/8 ⇜ (1/1 → 9/8) ⇝ 11/8 | note:Bb3 ]",
|
||||||
"[ 1/1 → 3/2 | note:Eb3 ]",
|
"[ 1/1 → 3/2 | note:Eb3 ]",
|
||||||
|
"[ 1/4 ⇜ (9/8 → 5/4) | note:G3 ]",
|
||||||
|
"[ 3/8 ⇜ (9/8 → 5/4) ⇝ 11/8 | note:Bb3 ]",
|
||||||
"[ 9/8 → 13/8 | note:G3 ]",
|
"[ 9/8 → 13/8 | note:G3 ]",
|
||||||
|
"[ 3/8 ⇜ (5/4 → 11/8) | note:Bb3 ]",
|
||||||
"[ 5/4 → 7/4 | note:Bb3 ]",
|
"[ 5/4 → 7/4 | note:Bb3 ]",
|
||||||
"[ 11/8 → 15/8 | note:D4 ]",
|
"[ 11/8 → 15/8 | note:D4 ]",
|
||||||
"[ 3/2 → 2/1 | note:G3 ]",
|
"[ 3/2 → 2/1 | note:G3 ]",
|
||||||
@@ -3516,17 +3330,23 @@ exports[`runs examples > example "echoWith" example index 0 1`] = `
|
|||||||
"[ (7/4 → 2/1) ⇝ 9/4 | note:D4 ]",
|
"[ (7/4 → 2/1) ⇝ 9/4 | note:D4 ]",
|
||||||
"[ (15/8 → 2/1) ⇝ 19/8 | note:F4 ]",
|
"[ (15/8 → 2/1) ⇝ 19/8 | note:F4 ]",
|
||||||
"[ 13/8 ⇜ (2/1 → 17/8) | note:Bb3 ]",
|
"[ 13/8 ⇜ (2/1 → 17/8) | note:Bb3 ]",
|
||||||
"[ 7/4 ⇜ (2/1 → 9/4) | note:D4 ]",
|
"[ 7/4 ⇜ (2/1 → 17/8) ⇝ 9/4 | note:D4 ]",
|
||||||
"[ 15/8 ⇜ (2/1 → 19/8) | note:F4 ]",
|
"[ 15/8 ⇜ (2/1 → 17/8) ⇝ 19/8 | note:F4 ]",
|
||||||
"[ 2/1 → 3/1 | note:C3 ]",
|
"[ 2/1 → 3/1 | note:C3 ]",
|
||||||
|
"[ 7/4 ⇜ (17/8 → 9/4) | note:D4 ]",
|
||||||
|
"[ 15/8 ⇜ (17/8 → 9/4) ⇝ 19/8 | note:F4 ]",
|
||||||
"[ (17/8 → 3/1) ⇝ 25/8 | note:Eb3 ]",
|
"[ (17/8 → 3/1) ⇝ 25/8 | note:Eb3 ]",
|
||||||
|
"[ 15/8 ⇜ (9/4 → 19/8) | note:F4 ]",
|
||||||
"[ (9/4 → 3/1) ⇝ 13/4 | note:G3 ]",
|
"[ (9/4 → 3/1) ⇝ 13/4 | note:G3 ]",
|
||||||
"[ (19/8 → 3/1) ⇝ 27/8 | note:Bb3 ]",
|
"[ (19/8 → 3/1) ⇝ 27/8 | note:Bb3 ]",
|
||||||
"[ 17/8 ⇜ (3/1 → 25/8) | note:Eb3 ]",
|
"[ 17/8 ⇜ (3/1 → 25/8) | note:Eb3 ]",
|
||||||
"[ 9/4 ⇜ (3/1 → 13/4) | note:G3 ]",
|
"[ 9/4 ⇜ (3/1 → 25/8) ⇝ 13/4 | note:G3 ]",
|
||||||
"[ 19/8 ⇜ (3/1 → 27/8) | note:Bb3 ]",
|
"[ 19/8 ⇜ (3/1 → 25/8) ⇝ 27/8 | note:Bb3 ]",
|
||||||
"[ 3/1 → 7/2 | note:Eb3 ]",
|
"[ 3/1 → 7/2 | note:Eb3 ]",
|
||||||
|
"[ 9/4 ⇜ (25/8 → 13/4) | note:G3 ]",
|
||||||
|
"[ 19/8 ⇜ (25/8 → 13/4) ⇝ 27/8 | note:Bb3 ]",
|
||||||
"[ 25/8 → 29/8 | note:G3 ]",
|
"[ 25/8 → 29/8 | note:G3 ]",
|
||||||
|
"[ 19/8 ⇜ (13/4 → 27/8) | note:Bb3 ]",
|
||||||
"[ 13/4 → 15/4 | note:Bb3 ]",
|
"[ 13/4 → 15/4 | note:Bb3 ]",
|
||||||
"[ 27/8 → 31/8 | note:D4 ]",
|
"[ 27/8 → 31/8 | note:D4 ]",
|
||||||
"[ 7/2 → 4/1 | note:G3 ]",
|
"[ 7/2 → 4/1 | note:G3 ]",
|
||||||
@@ -3838,8 +3658,6 @@ exports[`runs examples > example "fast" example index 0 1`] = `
|
|||||||
|
|
||||||
exports[`runs examples > example "fastChunk" example index 0 1`] = `
|
exports[`runs examples > example "fastChunk" example index 0 1`] = `
|
||||||
[
|
[
|
||||||
"[ 0/1 → 1/4 | color:red note:0 ]",
|
|
||||||
"[ 1/4 → 1/2 | color:red note:1 ]",
|
|
||||||
"[ 1/2 → 3/4 | note:E2 ]",
|
"[ 1/2 → 3/4 | note:E2 ]",
|
||||||
"[ 3/4 → 1/1 | note:F2 ]",
|
"[ 3/4 → 1/1 | note:F2 ]",
|
||||||
"[ 1/1 → 5/4 | note:G2 ]",
|
"[ 1/1 → 5/4 | note:G2 ]",
|
||||||
@@ -3848,8 +3666,6 @@ exports[`runs examples > example "fastChunk" example index 0 1`] = `
|
|||||||
"[ 7/4 → 2/1 | note:C3 ]",
|
"[ 7/4 → 2/1 | note:C3 ]",
|
||||||
"[ 2/1 → 9/4 | note:D3 ]",
|
"[ 2/1 → 9/4 | note:D3 ]",
|
||||||
"[ 9/4 → 5/2 | note:D2 ]",
|
"[ 9/4 → 5/2 | note:D2 ]",
|
||||||
"[ 5/2 → 11/4 | color:red note:2 ]",
|
|
||||||
"[ 11/4 → 3/1 | color:red note:3 ]",
|
|
||||||
"[ 3/1 → 13/4 | note:G2 ]",
|
"[ 3/1 → 13/4 | note:G2 ]",
|
||||||
"[ 13/4 → 7/2 | note:A2 ]",
|
"[ 13/4 → 7/2 | note:A2 ]",
|
||||||
"[ 7/2 → 15/4 | note:B2 ]",
|
"[ 7/2 → 15/4 | note:B2 ]",
|
||||||
@@ -6758,27 +6574,6 @@ exports[`runs examples > example "note" example index 2 1`] = `
|
|||||||
]
|
]
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`runs examples > example "note" example index 3 1`] = `
|
|
||||||
[
|
|
||||||
"[ 0/1 → 1/4 | note:fbb1 s:saw ]",
|
|
||||||
"[ 1/4 → 1/2 | note:a#0 s:saw ]",
|
|
||||||
"[ 1/2 → 3/4 | note:cbbb-1 s:saw ]",
|
|
||||||
"[ 3/4 → 1/1 | note:e##-2 s:saw ]",
|
|
||||||
"[ 1/1 → 5/4 | note:fbb1 s:saw ]",
|
|
||||||
"[ 5/4 → 3/2 | note:a#0 s:saw ]",
|
|
||||||
"[ 3/2 → 7/4 | note:cbbb-1 s:saw ]",
|
|
||||||
"[ 7/4 → 2/1 | note:e##-2 s:saw ]",
|
|
||||||
"[ 2/1 → 9/4 | note:fbb1 s:saw ]",
|
|
||||||
"[ 9/4 → 5/2 | note:a#0 s:saw ]",
|
|
||||||
"[ 5/2 → 11/4 | note:cbbb-1 s:saw ]",
|
|
||||||
"[ 11/4 → 3/1 | note:e##-2 s:saw ]",
|
|
||||||
"[ 3/1 → 13/4 | note:fbb1 s:saw ]",
|
|
||||||
"[ 13/4 → 7/2 | note:a#0 s:saw ]",
|
|
||||||
"[ 7/2 → 15/4 | note:cbbb-1 s:saw ]",
|
|
||||||
"[ 15/4 → 4/1 | note:e##-2 s:saw ]",
|
|
||||||
]
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`runs examples > example "nrpnn" example index 0 1`] = `
|
exports[`runs examples > example "nrpnn" example index 0 1`] = `
|
||||||
[
|
[
|
||||||
"[ 0/1 → 1/1 | note:c4 nrpnn:[1 8] nrpv:123 midichan:1 ]",
|
"[ 0/1 → 1/1 | note:c4 nrpnn:[1 8] nrpv:123 midichan:1 ]",
|
||||||
@@ -6958,24 +6753,6 @@ exports[`runs examples > example "orbit" example index 0 1`] = `
|
|||||||
]
|
]
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`runs examples > example "oschost" example index 0 1`] = `
|
|
||||||
[
|
|
||||||
"[ 0/1 → 1/1 | note:c4 oschost:127.0.0.1 oscport:57120 ]",
|
|
||||||
"[ 1/1 → 2/1 | note:c4 oschost:127.0.0.1 oscport:57120 ]",
|
|
||||||
"[ 2/1 → 3/1 | note:c4 oschost:127.0.0.1 oscport:57120 ]",
|
|
||||||
"[ 3/1 → 4/1 | note:c4 oschost:127.0.0.1 oscport:57120 ]",
|
|
||||||
]
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`runs examples > example "oscport" example index 0 1`] = `
|
|
||||||
[
|
|
||||||
"[ 0/1 → 1/1 | note:c4 oschost:127.0.0.1 oscport:57120 ]",
|
|
||||||
"[ 1/1 → 2/1 | note:c4 oschost:127.0.0.1 oscport:57120 ]",
|
|
||||||
"[ 2/1 → 3/1 | note:c4 oschost:127.0.0.1 oscport:57120 ]",
|
|
||||||
"[ 3/1 → 4/1 | note:c4 oschost:127.0.0.1 oscport:57120 ]",
|
|
||||||
]
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`runs examples > example "outside" example index 0 1`] = `
|
exports[`runs examples > example "outside" example index 0 1`] = `
|
||||||
[
|
[
|
||||||
"[ 0/1 → 1/1 | note:A3 ]",
|
"[ 0/1 → 1/1 | note:A3 ]",
|
||||||
@@ -8325,33 +8102,6 @@ exports[`runs examples > example "repeatCycles" example index 0 1`] = `
|
|||||||
]
|
]
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`runs examples > example "replicate" example index 0 1`] = `
|
|
||||||
[
|
|
||||||
"[ 0/1 → 1/8 | s:bd ]",
|
|
||||||
"[ 1/8 → 1/4 | s:bd ]",
|
|
||||||
"[ 3/8 → 1/2 | s:cp ]",
|
|
||||||
"[ 1/2 → 5/8 | s:bd ]",
|
|
||||||
"[ 5/8 → 3/4 | s:bd ]",
|
|
||||||
"[ 7/8 → 1/1 | s:cp ]",
|
|
||||||
"[ 1/1 → 9/8 | s:bd ]",
|
|
||||||
"[ 5/4 → 11/8 | s:sd ]",
|
|
||||||
"[ 3/2 → 13/8 | s:bd ]",
|
|
||||||
"[ 13/8 → 7/4 | s:bd ]",
|
|
||||||
"[ 15/8 → 2/1 | s:cp ]",
|
|
||||||
"[ 2/1 → 17/8 | s:bd ]",
|
|
||||||
"[ 17/8 → 9/4 | s:bd ]",
|
|
||||||
"[ 19/8 → 5/2 | s:cp ]",
|
|
||||||
"[ 5/2 → 21/8 | s:bd ]",
|
|
||||||
"[ 11/4 → 23/8 | s:sd ]",
|
|
||||||
"[ 3/1 → 25/8 | s:bd ]",
|
|
||||||
"[ 25/8 → 13/4 | s:bd ]",
|
|
||||||
"[ 27/8 → 7/2 | s:cp ]",
|
|
||||||
"[ 7/2 → 29/8 | s:bd ]",
|
|
||||||
"[ 29/8 → 15/4 | s:bd ]",
|
|
||||||
"[ 31/8 → 4/1 | s:cp ]",
|
|
||||||
]
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`runs examples > example "reset" example index 0 1`] = `
|
exports[`runs examples > example "reset" example index 0 1`] = `
|
||||||
[
|
[
|
||||||
"[ 0/1 → 1/8 | s:hh ]",
|
"[ 0/1 → 1/8 | s:hh ]",
|
||||||
@@ -9112,108 +8862,6 @@ exports[`runs examples > example "scale" example index 2 1`] = `
|
|||||||
]
|
]
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`runs examples > example "scale" example index 3 1`] = `
|
|
||||||
[
|
|
||||||
"[ 0/1 → 1/4 | note:C3 s:piano ]",
|
|
||||||
"[ 0/1 → 1/4 | note:B3 s:piano ]",
|
|
||||||
"[ 1/4 → 3/8 | note:Gb2 s:piano ]",
|
|
||||||
"[ 3/8 → 1/2 | note:F2 s:piano ]",
|
|
||||||
"[ 1/2 → 3/4 | note:A2 s:piano ]",
|
|
||||||
"[ 1/2 → 3/4 | note:D4 s:piano ]",
|
|
||||||
"[ 3/4 → 1/1 | note:G3 s:piano ]",
|
|
||||||
"[ 1/1 → 5/4 | note:C3 s:piano ]",
|
|
||||||
"[ 1/1 → 5/4 | note:C4 s:piano ]",
|
|
||||||
"[ 5/4 → 11/8 | note:Gb2 s:piano ]",
|
|
||||||
"[ 11/8 → 3/2 | note:E2 s:piano ]",
|
|
||||||
"[ 3/2 → 7/4 | note:A2 s:piano ]",
|
|
||||||
"[ 3/2 → 7/4 | note:Eb4 s:piano ]",
|
|
||||||
"[ 7/4 → 2/1 | note:F#3 s:piano ]",
|
|
||||||
"[ 2/1 → 9/4 | note:C3 s:piano ]",
|
|
||||||
"[ 2/1 → 9/4 | note:B3 s:piano ]",
|
|
||||||
"[ 9/4 → 19/8 | note:Gb2 s:piano ]",
|
|
||||||
"[ 19/8 → 5/2 | note:F2 s:piano ]",
|
|
||||||
"[ 5/2 → 11/4 | note:Ab2 s:piano ]",
|
|
||||||
"[ 5/2 → 11/4 | note:D4 s:piano ]",
|
|
||||||
"[ 11/4 → 3/1 | note:G3 s:piano ]",
|
|
||||||
"[ 3/1 → 13/4 | note:C3 s:piano ]",
|
|
||||||
"[ 3/1 → 13/4 | note:C4 s:piano ]",
|
|
||||||
"[ 13/4 → 27/8 | note:Gb2 s:piano ]",
|
|
||||||
"[ 27/8 → 7/2 | note:E2 s:piano ]",
|
|
||||||
"[ 7/2 → 15/4 | note:Ab2 s:piano ]",
|
|
||||||
"[ 7/2 → 15/4 | note:Eb4 s:piano ]",
|
|
||||||
"[ 15/4 → 4/1 | note:F#3 s:piano ]",
|
|
||||||
]
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`runs examples > example "scale" example index 4 1`] = `
|
|
||||||
[
|
|
||||||
"[ 0/1 → 1/16 | note:Gb1 ]",
|
|
||||||
"[ 1/16 → 1/8 | note:Gb1 ]",
|
|
||||||
"[ 1/8 → 3/16 | note:Gb1 ]",
|
|
||||||
"[ 3/16 → 1/4 | note:Gb1 ]",
|
|
||||||
"[ 1/4 → 5/16 | note:Gb1 ]",
|
|
||||||
"[ 5/16 → 3/8 | note:Gb1 ]",
|
|
||||||
"[ 3/8 → 7/16 | note:Gb1 ]",
|
|
||||||
"[ 7/16 → 1/2 | note:Gb1 ]",
|
|
||||||
"[ 1/2 → 9/16 | note:Gb1 ]",
|
|
||||||
"[ 9/16 → 5/8 | note:Gb1 ]",
|
|
||||||
"[ 5/8 → 11/16 | note:Gb1 ]",
|
|
||||||
"[ 11/16 → 3/4 | note:Gb1 ]",
|
|
||||||
"[ 3/4 → 13/16 | note:Gb1 ]",
|
|
||||||
"[ 13/16 → 7/8 | note:Gb1 ]",
|
|
||||||
"[ 7/8 → 15/16 | note:Gb1 ]",
|
|
||||||
"[ 15/16 → 1/1 | note:Gb1 ]",
|
|
||||||
"[ 1/1 → 17/16 | note:Cb3 ]",
|
|
||||||
"[ 17/16 → 9/8 | note:Cb3 ]",
|
|
||||||
"[ 9/8 → 19/16 | note:Cb3 ]",
|
|
||||||
"[ 19/16 → 5/4 | note:Cb3 ]",
|
|
||||||
"[ 5/4 → 21/16 | note:Cb3 ]",
|
|
||||||
"[ 21/16 → 11/8 | note:Cb3 ]",
|
|
||||||
"[ 11/8 → 23/16 | note:Cb3 ]",
|
|
||||||
"[ 23/16 → 3/2 | note:Cb3 ]",
|
|
||||||
"[ 3/2 → 25/16 | note:Cb3 ]",
|
|
||||||
"[ 25/16 → 13/8 | note:Cb3 ]",
|
|
||||||
"[ 13/8 → 27/16 | note:Cb3 ]",
|
|
||||||
"[ 27/16 → 7/4 | note:Cb3 ]",
|
|
||||||
"[ 7/4 → 29/16 | note:Cb3 ]",
|
|
||||||
"[ 29/16 → 15/8 | note:Cb3 ]",
|
|
||||||
"[ 15/8 → 31/16 | note:Cb3 ]",
|
|
||||||
"[ 31/16 → 2/1 | note:Cb3 ]",
|
|
||||||
"[ 2/1 → 33/16 | note:Eb4 ]",
|
|
||||||
"[ 33/16 → 17/8 | note:Eb4 ]",
|
|
||||||
"[ 17/8 → 35/16 | note:Eb4 ]",
|
|
||||||
"[ 35/16 → 9/4 | note:Eb4 ]",
|
|
||||||
"[ 9/4 → 37/16 | note:Eb4 ]",
|
|
||||||
"[ 37/16 → 19/8 | note:Eb4 ]",
|
|
||||||
"[ 19/8 → 39/16 | note:Eb4 ]",
|
|
||||||
"[ 39/16 → 5/2 | note:Eb4 ]",
|
|
||||||
"[ 5/2 → 41/16 | note:Eb4 ]",
|
|
||||||
"[ 41/16 → 21/8 | note:Eb4 ]",
|
|
||||||
"[ 21/8 → 43/16 | note:Eb4 ]",
|
|
||||||
"[ 43/16 → 11/4 | note:Eb4 ]",
|
|
||||||
"[ 11/4 → 45/16 | note:Eb4 ]",
|
|
||||||
"[ 45/16 → 23/8 | note:Eb4 ]",
|
|
||||||
"[ 23/8 → 47/16 | note:Eb4 ]",
|
|
||||||
"[ 47/16 → 3/1 | note:Eb4 ]",
|
|
||||||
"[ 3/1 → 49/16 | note:Db2 ]",
|
|
||||||
"[ 49/16 → 25/8 | note:Db2 ]",
|
|
||||||
"[ 25/8 → 51/16 | note:Db2 ]",
|
|
||||||
"[ 51/16 → 13/4 | note:Db2 ]",
|
|
||||||
"[ 13/4 → 53/16 | note:Db2 ]",
|
|
||||||
"[ 53/16 → 27/8 | note:Db2 ]",
|
|
||||||
"[ 27/8 → 55/16 | note:Db2 ]",
|
|
||||||
"[ 55/16 → 7/2 | note:Db2 ]",
|
|
||||||
"[ 7/2 → 57/16 | note:Db2 ]",
|
|
||||||
"[ 57/16 → 29/8 | note:Db2 ]",
|
|
||||||
"[ 29/8 → 59/16 | note:Db2 ]",
|
|
||||||
"[ 59/16 → 15/4 | note:Db2 ]",
|
|
||||||
"[ 15/4 → 61/16 | note:Db2 ]",
|
|
||||||
"[ 61/16 → 31/8 | note:Db2 ]",
|
|
||||||
"[ 31/8 → 63/16 | note:Db2 ]",
|
|
||||||
"[ 63/16 → 4/1 | note:Db2 ]",
|
|
||||||
]
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`runs examples > example "scaleTranspose" example index 0 1`] = `
|
exports[`runs examples > example "scaleTranspose" example index 0 1`] = `
|
||||||
[
|
[
|
||||||
"[ 0/1 → 1/2 | note:C3 ]",
|
"[ 0/1 → 1/2 | note:C3 ]",
|
||||||
@@ -11910,112 +11558,6 @@ exports[`runs examples > example "vowel" example index 1 1`] = `
|
|||||||
]
|
]
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`runs examples > example "warp" example index 0 1`] = `
|
|
||||||
[
|
|
||||||
"[ 0/1 → 1/8 | s:basique bank:wt_digital note:F1 warp:0 warpmode:spin ]",
|
|
||||||
"[ (1/8 → 1/5) ⇝ 1/4 | s:basique bank:wt_digital note:F1 warp:0 warpmode:spin ]",
|
|
||||||
"[ 1/8 ⇜ (1/5 → 1/4) | s:basique bank:wt_digital note:F1 warp:0.25 warpmode:spin ]",
|
|
||||||
"[ 1/4 → 3/8 | s:basique bank:wt_digital note:F1 warp:0.25 warpmode:spin ]",
|
|
||||||
"[ (3/8 → 2/5) ⇝ 1/2 | s:basique bank:wt_digital note:F1 warp:0.25 warpmode:spin ]",
|
|
||||||
"[ 3/8 ⇜ (2/5 → 1/2) | s:basique bank:wt_digital note:F1 warp:0.5 warpmode:spin ]",
|
|
||||||
"[ (1/2 → 3/5) ⇝ 5/8 | s:basique bank:wt_digital note:F1 warp:0.5 warpmode:spin ]",
|
|
||||||
"[ 1/2 ⇜ (3/5 → 5/8) | s:basique bank:wt_digital note:F1 warp:0.75 warpmode:spin ]",
|
|
||||||
"[ 5/8 → 3/4 | s:basique bank:wt_digital note:F1 warp:0.75 warpmode:spin ]",
|
|
||||||
"[ (3/4 → 4/5) ⇝ 7/8 | s:basique bank:wt_digital note:F1 warp:0.75 warpmode:spin ]",
|
|
||||||
"[ 3/4 ⇜ (4/5 → 7/8) | s:basique bank:wt_digital note:F1 warp:1 warpmode:spin ]",
|
|
||||||
"[ 7/8 → 1/1 | s:basique bank:wt_digital note:F1 warp:1 warpmode:spin ]",
|
|
||||||
"[ 1/1 → 9/8 | s:basique bank:wt_digital note:F1 warp:0 warpmode:spin ]",
|
|
||||||
"[ (9/8 → 6/5) ⇝ 5/4 | s:basique bank:wt_digital note:F1 warp:0 warpmode:spin ]",
|
|
||||||
"[ 9/8 ⇜ (6/5 → 5/4) | s:basique bank:wt_digital note:F1 warp:0.25 warpmode:spin ]",
|
|
||||||
"[ 5/4 → 11/8 | s:basique bank:wt_digital note:F1 warp:0.25 warpmode:spin ]",
|
|
||||||
"[ (11/8 → 7/5) ⇝ 3/2 | s:basique bank:wt_digital note:F1 warp:0.25 warpmode:spin ]",
|
|
||||||
"[ 11/8 ⇜ (7/5 → 3/2) | s:basique bank:wt_digital note:F1 warp:0.5 warpmode:spin ]",
|
|
||||||
"[ (3/2 → 8/5) ⇝ 13/8 | s:basique bank:wt_digital note:F1 warp:0.5 warpmode:spin ]",
|
|
||||||
"[ 3/2 ⇜ (8/5 → 13/8) | s:basique bank:wt_digital note:F1 warp:0.75 warpmode:spin ]",
|
|
||||||
"[ 13/8 → 7/4 | s:basique bank:wt_digital note:F1 warp:0.75 warpmode:spin ]",
|
|
||||||
"[ (7/4 → 9/5) ⇝ 15/8 | s:basique bank:wt_digital note:F1 warp:0.75 warpmode:spin ]",
|
|
||||||
"[ 7/4 ⇜ (9/5 → 15/8) | s:basique bank:wt_digital note:F1 warp:1 warpmode:spin ]",
|
|
||||||
"[ 15/8 → 2/1 | s:basique bank:wt_digital note:F1 warp:1 warpmode:spin ]",
|
|
||||||
"[ 2/1 → 17/8 | s:basique bank:wt_digital note:F1 warp:0 warpmode:spin ]",
|
|
||||||
"[ (17/8 → 11/5) ⇝ 9/4 | s:basique bank:wt_digital note:F1 warp:0 warpmode:spin ]",
|
|
||||||
"[ 17/8 ⇜ (11/5 → 9/4) | s:basique bank:wt_digital note:F1 warp:0.25 warpmode:spin ]",
|
|
||||||
"[ 9/4 → 19/8 | s:basique bank:wt_digital note:F1 warp:0.25 warpmode:spin ]",
|
|
||||||
"[ (19/8 → 12/5) ⇝ 5/2 | s:basique bank:wt_digital note:F1 warp:0.25 warpmode:spin ]",
|
|
||||||
"[ 19/8 ⇜ (12/5 → 5/2) | s:basique bank:wt_digital note:F1 warp:0.5 warpmode:spin ]",
|
|
||||||
"[ (5/2 → 13/5) ⇝ 21/8 | s:basique bank:wt_digital note:F1 warp:0.5 warpmode:spin ]",
|
|
||||||
"[ 5/2 ⇜ (13/5 → 21/8) | s:basique bank:wt_digital note:F1 warp:0.75 warpmode:spin ]",
|
|
||||||
"[ 21/8 → 11/4 | s:basique bank:wt_digital note:F1 warp:0.75 warpmode:spin ]",
|
|
||||||
"[ (11/4 → 14/5) ⇝ 23/8 | s:basique bank:wt_digital note:F1 warp:0.75 warpmode:spin ]",
|
|
||||||
"[ 11/4 ⇜ (14/5 → 23/8) | s:basique bank:wt_digital note:F1 warp:1 warpmode:spin ]",
|
|
||||||
"[ 23/8 → 3/1 | s:basique bank:wt_digital note:F1 warp:1 warpmode:spin ]",
|
|
||||||
"[ 3/1 → 25/8 | s:basique bank:wt_digital note:F1 warp:0 warpmode:spin ]",
|
|
||||||
"[ (25/8 → 16/5) ⇝ 13/4 | s:basique bank:wt_digital note:F1 warp:0 warpmode:spin ]",
|
|
||||||
"[ 25/8 ⇜ (16/5 → 13/4) | s:basique bank:wt_digital note:F1 warp:0.25 warpmode:spin ]",
|
|
||||||
"[ 13/4 → 27/8 | s:basique bank:wt_digital note:F1 warp:0.25 warpmode:spin ]",
|
|
||||||
"[ (27/8 → 17/5) ⇝ 7/2 | s:basique bank:wt_digital note:F1 warp:0.25 warpmode:spin ]",
|
|
||||||
"[ 27/8 ⇜ (17/5 → 7/2) | s:basique bank:wt_digital note:F1 warp:0.5 warpmode:spin ]",
|
|
||||||
"[ (7/2 → 18/5) ⇝ 29/8 | s:basique bank:wt_digital note:F1 warp:0.5 warpmode:spin ]",
|
|
||||||
"[ 7/2 ⇜ (18/5 → 29/8) | s:basique bank:wt_digital note:F1 warp:0.75 warpmode:spin ]",
|
|
||||||
"[ 29/8 → 15/4 | s:basique bank:wt_digital note:F1 warp:0.75 warpmode:spin ]",
|
|
||||||
"[ (15/4 → 19/5) ⇝ 31/8 | s:basique bank:wt_digital note:F1 warp:0.75 warpmode:spin ]",
|
|
||||||
"[ 15/4 ⇜ (19/5 → 31/8) | s:basique bank:wt_digital note:F1 warp:1 warpmode:spin ]",
|
|
||||||
"[ 31/8 → 4/1 | s:basique bank:wt_digital note:F1 warp:1 warpmode:spin ]",
|
|
||||||
]
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`runs examples > example "warpmode" example index 0 1`] = `
|
|
||||||
[
|
|
||||||
"[ 0/1 → 1/8 | s:morgana bank:wt_digital note:F1 warp:0 warpmode:asym ]",
|
|
||||||
"[ (1/8 → 1/5) ⇝ 1/4 | s:morgana bank:wt_digital note:F1 warp:0 warpmode:asym ]",
|
|
||||||
"[ 1/8 ⇜ (1/5 → 1/4) | s:morgana bank:wt_digital note:F1 warp:0.25 warpmode:asym ]",
|
|
||||||
"[ 1/4 → 3/8 | s:morgana bank:wt_digital note:F1 warp:0.25 warpmode:asym ]",
|
|
||||||
"[ (3/8 → 2/5) ⇝ 1/2 | s:morgana bank:wt_digital note:F1 warp:0.25 warpmode:asym ]",
|
|
||||||
"[ 3/8 ⇜ (2/5 → 1/2) | s:morgana bank:wt_digital note:F1 warp:0.5 warpmode:asym ]",
|
|
||||||
"[ (1/2 → 3/5) ⇝ 5/8 | s:morgana bank:wt_digital note:F1 warp:0.5 warpmode:bendp ]",
|
|
||||||
"[ 1/2 ⇜ (3/5 → 5/8) | s:morgana bank:wt_digital note:F1 warp:0.75 warpmode:bendp ]",
|
|
||||||
"[ 5/8 → 3/4 | s:morgana bank:wt_digital note:F1 warp:0.75 warpmode:bendp ]",
|
|
||||||
"[ (3/4 → 4/5) ⇝ 7/8 | s:morgana bank:wt_digital note:F1 warp:0.75 warpmode:bendp ]",
|
|
||||||
"[ 3/4 ⇜ (4/5 → 7/8) | s:morgana bank:wt_digital note:F1 warp:1 warpmode:bendp ]",
|
|
||||||
"[ 7/8 → 1/1 | s:morgana bank:wt_digital note:F1 warp:1 warpmode:bendp ]",
|
|
||||||
"[ 1/1 → 9/8 | s:morgana bank:wt_digital note:F1 warp:0 warpmode:spin ]",
|
|
||||||
"[ (9/8 → 6/5) ⇝ 5/4 | s:morgana bank:wt_digital note:F1 warp:0 warpmode:spin ]",
|
|
||||||
"[ 9/8 ⇜ (6/5 → 5/4) | s:morgana bank:wt_digital note:F1 warp:0.25 warpmode:spin ]",
|
|
||||||
"[ 5/4 → 11/8 | s:morgana bank:wt_digital note:F1 warp:0.25 warpmode:spin ]",
|
|
||||||
"[ (11/8 → 7/5) ⇝ 3/2 | s:morgana bank:wt_digital note:F1 warp:0.25 warpmode:spin ]",
|
|
||||||
"[ 11/8 ⇜ (7/5 → 3/2) | s:morgana bank:wt_digital note:F1 warp:0.5 warpmode:spin ]",
|
|
||||||
"[ (3/2 → 8/5) ⇝ 13/8 | s:morgana bank:wt_digital note:F1 warp:0.5 warpmode:logistic ]",
|
|
||||||
"[ 3/2 ⇜ (8/5 → 13/8) | s:morgana bank:wt_digital note:F1 warp:0.75 warpmode:logistic ]",
|
|
||||||
"[ 13/8 → 7/4 | s:morgana bank:wt_digital note:F1 warp:0.75 warpmode:logistic ]",
|
|
||||||
"[ (7/4 → 9/5) ⇝ 15/8 | s:morgana bank:wt_digital note:F1 warp:0.75 warpmode:logistic ]",
|
|
||||||
"[ 7/4 ⇜ (9/5 → 15/8) | s:morgana bank:wt_digital note:F1 warp:1 warpmode:logistic ]",
|
|
||||||
"[ 15/8 → 2/1 | s:morgana bank:wt_digital note:F1 warp:1 warpmode:logistic ]",
|
|
||||||
"[ 2/1 → 17/8 | s:morgana bank:wt_digital note:F1 warp:0 warpmode:sync ]",
|
|
||||||
"[ (17/8 → 11/5) ⇝ 9/4 | s:morgana bank:wt_digital note:F1 warp:0 warpmode:sync ]",
|
|
||||||
"[ 17/8 ⇜ (11/5 → 9/4) | s:morgana bank:wt_digital note:F1 warp:0.25 warpmode:sync ]",
|
|
||||||
"[ 9/4 → 19/8 | s:morgana bank:wt_digital note:F1 warp:0.25 warpmode:sync ]",
|
|
||||||
"[ (19/8 → 12/5) ⇝ 5/2 | s:morgana bank:wt_digital note:F1 warp:0.25 warpmode:sync ]",
|
|
||||||
"[ 19/8 ⇜ (12/5 → 5/2) | s:morgana bank:wt_digital note:F1 warp:0.5 warpmode:sync ]",
|
|
||||||
"[ (5/2 → 13/5) ⇝ 21/8 | s:morgana bank:wt_digital note:F1 warp:0.5 warpmode:wormhole ]",
|
|
||||||
"[ 5/2 ⇜ (13/5 → 21/8) | s:morgana bank:wt_digital note:F1 warp:0.75 warpmode:wormhole ]",
|
|
||||||
"[ 21/8 → 11/4 | s:morgana bank:wt_digital note:F1 warp:0.75 warpmode:wormhole ]",
|
|
||||||
"[ (11/4 → 14/5) ⇝ 23/8 | s:morgana bank:wt_digital note:F1 warp:0.75 warpmode:wormhole ]",
|
|
||||||
"[ 11/4 ⇜ (14/5 → 23/8) | s:morgana bank:wt_digital note:F1 warp:1 warpmode:wormhole ]",
|
|
||||||
"[ 23/8 → 3/1 | s:morgana bank:wt_digital note:F1 warp:1 warpmode:wormhole ]",
|
|
||||||
"[ 3/1 → 25/8 | s:morgana bank:wt_digital note:F1 warp:0 warpmode:brownian ]",
|
|
||||||
"[ (25/8 → 16/5) ⇝ 13/4 | s:morgana bank:wt_digital note:F1 warp:0 warpmode:brownian ]",
|
|
||||||
"[ 25/8 ⇜ (16/5 → 13/4) | s:morgana bank:wt_digital note:F1 warp:0.25 warpmode:brownian ]",
|
|
||||||
"[ 13/4 → 27/8 | s:morgana bank:wt_digital note:F1 warp:0.25 warpmode:brownian ]",
|
|
||||||
"[ (27/8 → 17/5) ⇝ 7/2 | s:morgana bank:wt_digital note:F1 warp:0.25 warpmode:brownian ]",
|
|
||||||
"[ 27/8 ⇜ (17/5 → 7/2) | s:morgana bank:wt_digital note:F1 warp:0.5 warpmode:brownian ]",
|
|
||||||
"[ (7/2 → 18/5) ⇝ 29/8 | s:morgana bank:wt_digital note:F1 warp:0.5 warpmode:asym ]",
|
|
||||||
"[ 7/2 ⇜ (18/5 → 29/8) | s:morgana bank:wt_digital note:F1 warp:0.75 warpmode:asym ]",
|
|
||||||
"[ 29/8 → 15/4 | s:morgana bank:wt_digital note:F1 warp:0.75 warpmode:asym ]",
|
|
||||||
"[ (15/4 → 19/5) ⇝ 31/8 | s:morgana bank:wt_digital note:F1 warp:0.75 warpmode:asym ]",
|
|
||||||
"[ 15/4 ⇜ (19/5 → 31/8) | s:morgana bank:wt_digital note:F1 warp:1 warpmode:asym ]",
|
|
||||||
"[ 31/8 → 4/1 | s:morgana bank:wt_digital note:F1 warp:1 warpmode:asym ]",
|
|
||||||
]
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`runs examples > example "wchoose" example index 0 1`] = `
|
exports[`runs examples > example "wchoose" example index 0 1`] = `
|
||||||
[
|
[
|
||||||
"[ 0/1 → 1/5 | note:c2 s:sine ]",
|
"[ 0/1 → 1/5 | note:c2 s:sine ]",
|
||||||
@@ -12220,128 +11762,6 @@ exports[`runs examples > example "withValue" example index 0 1`] = `
|
|||||||
]
|
]
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`runs examples > example "wt" example index 0 1`] = `
|
|
||||||
[
|
|
||||||
"[ 0/1 → 1/8 | s:squelch bank:wt_digital note:F1 wt:0 ]",
|
|
||||||
"[ (1/8 → 1/5) ⇝ 1/4 | s:squelch bank:wt_digital note:F1 wt:0 ]",
|
|
||||||
"[ 1/8 ⇜ (1/5 → 1/4) | s:squelch bank:wt_digital note:F1 wt:0.25 ]",
|
|
||||||
"[ 1/4 → 3/8 | s:squelch bank:wt_digital note:F1 wt:0.25 ]",
|
|
||||||
"[ (3/8 → 2/5) ⇝ 1/2 | s:squelch bank:wt_digital note:F1 wt:0.25 ]",
|
|
||||||
"[ 3/8 ⇜ (2/5 → 1/2) | s:squelch bank:wt_digital note:F1 wt:0.5 ]",
|
|
||||||
"[ (1/2 → 3/5) ⇝ 5/8 | s:squelch bank:wt_digital note:F1 wt:0.5 ]",
|
|
||||||
"[ 1/2 ⇜ (3/5 → 5/8) | s:squelch bank:wt_digital note:F1 wt:0.75 ]",
|
|
||||||
"[ 5/8 → 3/4 | s:squelch bank:wt_digital note:F1 wt:0.75 ]",
|
|
||||||
"[ (3/4 → 4/5) ⇝ 7/8 | s:squelch bank:wt_digital note:F1 wt:0.75 ]",
|
|
||||||
"[ 3/4 ⇜ (4/5 → 7/8) | s:squelch bank:wt_digital note:F1 wt:1 ]",
|
|
||||||
"[ 7/8 → 1/1 | s:squelch bank:wt_digital note:F1 wt:1 ]",
|
|
||||||
"[ 1/1 → 9/8 | s:squelch bank:wt_digital note:F1 wt:0 ]",
|
|
||||||
"[ (9/8 → 6/5) ⇝ 5/4 | s:squelch bank:wt_digital note:F1 wt:0 ]",
|
|
||||||
"[ 9/8 ⇜ (6/5 → 5/4) | s:squelch bank:wt_digital note:F1 wt:0.25 ]",
|
|
||||||
"[ 5/4 → 11/8 | s:squelch bank:wt_digital note:F1 wt:0.25 ]",
|
|
||||||
"[ (11/8 → 7/5) ⇝ 3/2 | s:squelch bank:wt_digital note:F1 wt:0.25 ]",
|
|
||||||
"[ 11/8 ⇜ (7/5 → 3/2) | s:squelch bank:wt_digital note:F1 wt:0.5 ]",
|
|
||||||
"[ (3/2 → 8/5) ⇝ 13/8 | s:squelch bank:wt_digital note:F1 wt:0.5 ]",
|
|
||||||
"[ 3/2 ⇜ (8/5 → 13/8) | s:squelch bank:wt_digital note:F1 wt:0.75 ]",
|
|
||||||
"[ 13/8 → 7/4 | s:squelch bank:wt_digital note:F1 wt:0.75 ]",
|
|
||||||
"[ (7/4 → 9/5) ⇝ 15/8 | s:squelch bank:wt_digital note:F1 wt:0.75 ]",
|
|
||||||
"[ 7/4 ⇜ (9/5 → 15/8) | s:squelch bank:wt_digital note:F1 wt:1 ]",
|
|
||||||
"[ 15/8 → 2/1 | s:squelch bank:wt_digital note:F1 wt:1 ]",
|
|
||||||
"[ 2/1 → 17/8 | s:squelch bank:wt_digital note:F1 wt:0 ]",
|
|
||||||
"[ (17/8 → 11/5) ⇝ 9/4 | s:squelch bank:wt_digital note:F1 wt:0 ]",
|
|
||||||
"[ 17/8 ⇜ (11/5 → 9/4) | s:squelch bank:wt_digital note:F1 wt:0.25 ]",
|
|
||||||
"[ 9/4 → 19/8 | s:squelch bank:wt_digital note:F1 wt:0.25 ]",
|
|
||||||
"[ (19/8 → 12/5) ⇝ 5/2 | s:squelch bank:wt_digital note:F1 wt:0.25 ]",
|
|
||||||
"[ 19/8 ⇜ (12/5 → 5/2) | s:squelch bank:wt_digital note:F1 wt:0.5 ]",
|
|
||||||
"[ (5/2 → 13/5) ⇝ 21/8 | s:squelch bank:wt_digital note:F1 wt:0.5 ]",
|
|
||||||
"[ 5/2 ⇜ (13/5 → 21/8) | s:squelch bank:wt_digital note:F1 wt:0.75 ]",
|
|
||||||
"[ 21/8 → 11/4 | s:squelch bank:wt_digital note:F1 wt:0.75 ]",
|
|
||||||
"[ (11/4 → 14/5) ⇝ 23/8 | s:squelch bank:wt_digital note:F1 wt:0.75 ]",
|
|
||||||
"[ 11/4 ⇜ (14/5 → 23/8) | s:squelch bank:wt_digital note:F1 wt:1 ]",
|
|
||||||
"[ 23/8 → 3/1 | s:squelch bank:wt_digital note:F1 wt:1 ]",
|
|
||||||
"[ 3/1 → 25/8 | s:squelch bank:wt_digital note:F1 wt:0 ]",
|
|
||||||
"[ (25/8 → 16/5) ⇝ 13/4 | s:squelch bank:wt_digital note:F1 wt:0 ]",
|
|
||||||
"[ 25/8 ⇜ (16/5 → 13/4) | s:squelch bank:wt_digital note:F1 wt:0.25 ]",
|
|
||||||
"[ 13/4 → 27/8 | s:squelch bank:wt_digital note:F1 wt:0.25 ]",
|
|
||||||
"[ (27/8 → 17/5) ⇝ 7/2 | s:squelch bank:wt_digital note:F1 wt:0.25 ]",
|
|
||||||
"[ 27/8 ⇜ (17/5 → 7/2) | s:squelch bank:wt_digital note:F1 wt:0.5 ]",
|
|
||||||
"[ (7/2 → 18/5) ⇝ 29/8 | s:squelch bank:wt_digital note:F1 wt:0.5 ]",
|
|
||||||
"[ 7/2 ⇜ (18/5 → 29/8) | s:squelch bank:wt_digital note:F1 wt:0.75 ]",
|
|
||||||
"[ 29/8 → 15/4 | s:squelch bank:wt_digital note:F1 wt:0.75 ]",
|
|
||||||
"[ (15/4 → 19/5) ⇝ 31/8 | s:squelch bank:wt_digital note:F1 wt:0.75 ]",
|
|
||||||
"[ 15/4 ⇜ (19/5 → 31/8) | s:squelch bank:wt_digital note:F1 wt:1 ]",
|
|
||||||
"[ 31/8 → 4/1 | s:squelch bank:wt_digital note:F1 wt:1 ]",
|
|
||||||
]
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`runs examples > example "wtphaserand" example index 0 1`] = `
|
|
||||||
[
|
|
||||||
"[ 0/1 → 1/16 | s:basique bank:wt_digital wtphaserand:0 ]",
|
|
||||||
"[ 1/16 → 1/8 | s:basique bank:wt_digital wtphaserand:0 ]",
|
|
||||||
"[ 1/8 → 3/16 | s:basique bank:wt_digital wtphaserand:0 ]",
|
|
||||||
"[ 3/16 → 1/4 | s:basique bank:wt_digital wtphaserand:0 ]",
|
|
||||||
"[ 1/4 → 5/16 | s:basique bank:wt_digital wtphaserand:0 ]",
|
|
||||||
"[ 5/16 → 3/8 | s:basique bank:wt_digital wtphaserand:0 ]",
|
|
||||||
"[ 3/8 → 7/16 | s:basique bank:wt_digital wtphaserand:0 ]",
|
|
||||||
"[ 7/16 → 1/2 | s:basique bank:wt_digital wtphaserand:0 ]",
|
|
||||||
"[ 1/2 → 9/16 | s:basique bank:wt_digital wtphaserand:0 ]",
|
|
||||||
"[ 9/16 → 5/8 | s:basique bank:wt_digital wtphaserand:0 ]",
|
|
||||||
"[ 5/8 → 11/16 | s:basique bank:wt_digital wtphaserand:0 ]",
|
|
||||||
"[ 11/16 → 3/4 | s:basique bank:wt_digital wtphaserand:0 ]",
|
|
||||||
"[ 3/4 → 13/16 | s:basique bank:wt_digital wtphaserand:0 ]",
|
|
||||||
"[ 13/16 → 7/8 | s:basique bank:wt_digital wtphaserand:0 ]",
|
|
||||||
"[ 7/8 → 15/16 | s:basique bank:wt_digital wtphaserand:0 ]",
|
|
||||||
"[ 15/16 → 1/1 | s:basique bank:wt_digital wtphaserand:0 ]",
|
|
||||||
"[ 1/1 → 17/16 | s:basique bank:wt_digital wtphaserand:1 ]",
|
|
||||||
"[ 17/16 → 9/8 | s:basique bank:wt_digital wtphaserand:1 ]",
|
|
||||||
"[ 9/8 → 19/16 | s:basique bank:wt_digital wtphaserand:1 ]",
|
|
||||||
"[ 19/16 → 5/4 | s:basique bank:wt_digital wtphaserand:1 ]",
|
|
||||||
"[ 5/4 → 21/16 | s:basique bank:wt_digital wtphaserand:1 ]",
|
|
||||||
"[ 21/16 → 11/8 | s:basique bank:wt_digital wtphaserand:1 ]",
|
|
||||||
"[ 11/8 → 23/16 | s:basique bank:wt_digital wtphaserand:1 ]",
|
|
||||||
"[ 23/16 → 3/2 | s:basique bank:wt_digital wtphaserand:1 ]",
|
|
||||||
"[ 3/2 → 25/16 | s:basique bank:wt_digital wtphaserand:1 ]",
|
|
||||||
"[ 25/16 → 13/8 | s:basique bank:wt_digital wtphaserand:1 ]",
|
|
||||||
"[ 13/8 → 27/16 | s:basique bank:wt_digital wtphaserand:1 ]",
|
|
||||||
"[ 27/16 → 7/4 | s:basique bank:wt_digital wtphaserand:1 ]",
|
|
||||||
"[ 7/4 → 29/16 | s:basique bank:wt_digital wtphaserand:1 ]",
|
|
||||||
"[ 29/16 → 15/8 | s:basique bank:wt_digital wtphaserand:1 ]",
|
|
||||||
"[ 15/8 → 31/16 | s:basique bank:wt_digital wtphaserand:1 ]",
|
|
||||||
"[ 31/16 → 2/1 | s:basique bank:wt_digital wtphaserand:1 ]",
|
|
||||||
"[ 2/1 → 33/16 | s:basique bank:wt_digital wtphaserand:0 ]",
|
|
||||||
"[ 33/16 → 17/8 | s:basique bank:wt_digital wtphaserand:0 ]",
|
|
||||||
"[ 17/8 → 35/16 | s:basique bank:wt_digital wtphaserand:0 ]",
|
|
||||||
"[ 35/16 → 9/4 | s:basique bank:wt_digital wtphaserand:0 ]",
|
|
||||||
"[ 9/4 → 37/16 | s:basique bank:wt_digital wtphaserand:0 ]",
|
|
||||||
"[ 37/16 → 19/8 | s:basique bank:wt_digital wtphaserand:0 ]",
|
|
||||||
"[ 19/8 → 39/16 | s:basique bank:wt_digital wtphaserand:0 ]",
|
|
||||||
"[ 39/16 → 5/2 | s:basique bank:wt_digital wtphaserand:0 ]",
|
|
||||||
"[ 5/2 → 41/16 | s:basique bank:wt_digital wtphaserand:0 ]",
|
|
||||||
"[ 41/16 → 21/8 | s:basique bank:wt_digital wtphaserand:0 ]",
|
|
||||||
"[ 21/8 → 43/16 | s:basique bank:wt_digital wtphaserand:0 ]",
|
|
||||||
"[ 43/16 → 11/4 | s:basique bank:wt_digital wtphaserand:0 ]",
|
|
||||||
"[ 11/4 → 45/16 | s:basique bank:wt_digital wtphaserand:0 ]",
|
|
||||||
"[ 45/16 → 23/8 | s:basique bank:wt_digital wtphaserand:0 ]",
|
|
||||||
"[ 23/8 → 47/16 | s:basique bank:wt_digital wtphaserand:0 ]",
|
|
||||||
"[ 47/16 → 3/1 | s:basique bank:wt_digital wtphaserand:0 ]",
|
|
||||||
"[ 3/1 → 49/16 | s:basique bank:wt_digital wtphaserand:1 ]",
|
|
||||||
"[ 49/16 → 25/8 | s:basique bank:wt_digital wtphaserand:1 ]",
|
|
||||||
"[ 25/8 → 51/16 | s:basique bank:wt_digital wtphaserand:1 ]",
|
|
||||||
"[ 51/16 → 13/4 | s:basique bank:wt_digital wtphaserand:1 ]",
|
|
||||||
"[ 13/4 → 53/16 | s:basique bank:wt_digital wtphaserand:1 ]",
|
|
||||||
"[ 53/16 → 27/8 | s:basique bank:wt_digital wtphaserand:1 ]",
|
|
||||||
"[ 27/8 → 55/16 | s:basique bank:wt_digital wtphaserand:1 ]",
|
|
||||||
"[ 55/16 → 7/2 | s:basique bank:wt_digital wtphaserand:1 ]",
|
|
||||||
"[ 7/2 → 57/16 | s:basique bank:wt_digital wtphaserand:1 ]",
|
|
||||||
"[ 57/16 → 29/8 | s:basique bank:wt_digital wtphaserand:1 ]",
|
|
||||||
"[ 29/8 → 59/16 | s:basique bank:wt_digital wtphaserand:1 ]",
|
|
||||||
"[ 59/16 → 15/4 | s:basique bank:wt_digital wtphaserand:1 ]",
|
|
||||||
"[ 15/4 → 61/16 | s:basique bank:wt_digital wtphaserand:1 ]",
|
|
||||||
"[ 61/16 → 31/8 | s:basique bank:wt_digital wtphaserand:1 ]",
|
|
||||||
"[ 31/8 → 63/16 | s:basique bank:wt_digital wtphaserand:1 ]",
|
|
||||||
"[ 63/16 → 4/1 | s:basique bank:wt_digital wtphaserand:1 ]",
|
|
||||||
]
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`runs examples > example "xfade" example index 0 1`] = `
|
exports[`runs examples > example "xfade" example index 0 1`] = `
|
||||||
[
|
[
|
||||||
"[ 0/1 → 1/8 | s:hh gain:0 ]",
|
"[ 0/1 → 1/8 | s:hh gain:0 ]",
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
The FontStruction “TIC-80 wide font”
|
|
||||||
(https://fontstruct.com/fontstructions/show/1388526) by “nesbox” is licensed
|
|
||||||
under a Creative Commons CC0 Public Domain Dedication license
|
|
||||||
(http://creativecommons.org/publicdomain/zero/1.0/).
|
|
||||||
[ancestry]
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
The font file in this archive was created using Fontstruct the free, online
|
|
||||||
font-building tool.
|
|
||||||
This font was created by “nesbox”.
|
|
||||||
This font has a homepage where this archive and other versions may be found:
|
|
||||||
https://fontstruct.com/fontstructions/show/1388526
|
|
||||||
[ancestry]
|
|
||||||
Try Fontstruct at https://fontstruct.com
|
|
||||||
It’s easy and it’s fun.
|
|
||||||
|
|
||||||
Fontstruct is copyright ©2017-2025 Rob Meek
|
|
||||||
|
|
||||||
LEGAL NOTICE:
|
|
||||||
In using this font you must comply with the licensing terms described in the
|
|
||||||
file “license.txt” included with this archive.
|
|
||||||
If you redistribute the font file in this archive, it must be accompanied by all
|
|
||||||
the other files from this archive, including this one.
|
|
||||||
Binary file not shown.
@@ -1,28 +0,0 @@
|
|||||||
{
|
|
||||||
"_base": "https://raw.githubusercontent.com/tidalcycles/uzu-wavetables/main/",
|
|
||||||
"wt_digital": [
|
|
||||||
"wt_digital/wt_bad_day.wav",
|
|
||||||
"wt_digital/wt_basique.wav",
|
|
||||||
"wt_digital/wt_crickets.wav",
|
|
||||||
"wt_digital/wt_curses.wav",
|
|
||||||
"wt_digital/wt_echoes.wav"
|
|
||||||
],
|
|
||||||
"wt_digital_bad_day": ["wt_digital/wt_bad_day.wav"],
|
|
||||||
"wt_digital_basique": ["wt_digital/wt_basique.wav"],
|
|
||||||
"wt_digital_crickets": ["wt_digital/wt_crickets.wav"],
|
|
||||||
"wt_digital_curses": ["wt_digital/wt_curses.wav"],
|
|
||||||
"wt_digital_echoes": ["wt_digital/wt_echoes.wav"],
|
|
||||||
"wt_vgame": [
|
|
||||||
"wt_vgame/wt_vgame10.wav",
|
|
||||||
"wt_vgame/wt_vgame11.wav",
|
|
||||||
"wt_vgame/wt_vgame12.wav",
|
|
||||||
"wt_vgame/wt_vgame13.wav",
|
|
||||||
"wt_vgame/wt_vgame14.wav",
|
|
||||||
"wt_vgame/wt_vgame15.wav",
|
|
||||||
"wt_vgame/wt_vgame16.wav",
|
|
||||||
"wt_vgame/wt_vgame17.wav",
|
|
||||||
"wt_vgame/wt_vgame18.wav",
|
|
||||||
"wt_vgame/wt_vgame19.wav",
|
|
||||||
"wt_vgame/wt_vgame20.wav"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -60,23 +60,6 @@ Strudel makes heavy use of chained functions. Here is a more sophisticated examp
|
|||||||
.room(0.5)`}
|
.room(0.5)`}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
## Write your own chained function
|
|
||||||
|
|
||||||
You can write your own chained function using `register`. Here's the above chain but registered as a reusable, chained function.
|
|
||||||
|
|
||||||
<MiniRepl
|
|
||||||
client:idle
|
|
||||||
tune={`const effectChain = register('effectChain', (pat) => pat
|
|
||||||
.s("sawtooth")
|
|
||||||
.cutoff(500)
|
|
||||||
//.delay(0.5)
|
|
||||||
.room(0.5)
|
|
||||||
)
|
|
||||||
note("a3 c#4 e4 a4").effectChain()`}
|
|
||||||
/>
|
|
||||||
|
|
||||||
Try adding `.rev()` after `effectChain()` to hear further effects added.
|
|
||||||
|
|
||||||
# Comments
|
# Comments
|
||||||
|
|
||||||
The `//` in the example above is a line comment, resulting in the `delay` function being ignored.
|
The `//` in the example above is a line comment, resulting in the `delay` function being ignored.
|
||||||
|
|||||||
@@ -381,7 +381,7 @@ Sampler effects are functions that can be used to change the behaviour of sample
|
|||||||
|
|
||||||
### scrub
|
### scrub
|
||||||
|
|
||||||
<JsDoc client:idle name="Pattern.scrub" h={0} />
|
<JsDoc client:idle name="Pattern.scrub" h={0} />{' '}
|
||||||
|
|
||||||
### speed
|
### speed
|
||||||
|
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ It has 20 parameters in total, here is a snippet that uses all:
|
|||||||
.pitchJump(0) // +/- pitch change after pitchJumpTime
|
.pitchJump(0) // +/- pitch change after pitchJumpTime
|
||||||
.pitchJumpTime(0) // >0 time after pitchJump is applied
|
.pitchJumpTime(0) // >0 time after pitchJump is applied
|
||||||
.lfo(0) // >0 resets slide + pitchJump + sets tremolo speed
|
.lfo(0) // >0 resets slide + pitchJump + sets tremolo speed
|
||||||
.tremolo(0.5) // 0-1 lfo volume modulation amount
|
.tremolo(0) // 0-1 lfo volume modulation amount
|
||||||
//.duration(.2) // overwrite strudel event duration
|
//.duration(.2) // overwrite strudel event duration
|
||||||
//.gain(1) // change volume
|
//.gain(1) // change volume
|
||||||
._scope() // vizualise waveform (not zzfx related)
|
._scope() // vizualise waveform (not zzfx related)
|
||||||
|
|||||||
@@ -7,21 +7,6 @@ layout: ../../layouts/MainLayout.astro
|
|||||||
|
|
||||||
This Guide shows you the different ways to get started with using Strudel in your own project.
|
This Guide shows you the different ways to get started with using Strudel in your own project.
|
||||||
|
|
||||||
## Respect the license
|
|
||||||
|
|
||||||
First, please take a moment to understand Strudel's free/open source license,
|
|
||||||
[AGPL-3.0](https://www.gnu.org/licenses/agpl-3.0.en.html).
|
|
||||||
|
|
||||||
Here is a lay summary, but check the license for legal definitions and responsibilities.
|
|
||||||
|
|
||||||
- You can distribute modified versions if you keep track of the changes and the date you made them.
|
|
||||||
- You must license derivative work under the same license.
|
|
||||||
- Source code must be distributed along with web publication.
|
|
||||||
|
|
||||||
Among other things, it means that when you share your work, the whole application must be shared under the same free/open source license, or one compatible with it. This is because we want Strudel to stay free/open source. In other words, you are not permitted to distribute integrations of Strudel with libraries or other code that does not have a compatible free/open source license.
|
|
||||||
|
|
||||||
This also applies to clones informed by reading Strudel's source code, as legally speaking, that counts as a 'derivative work'. Again, please [read the licence](https://www.gnu.org/licenses/agpl-3.0.en.html) for details.
|
|
||||||
|
|
||||||
## Embedding the Strudel REPL
|
## Embedding the Strudel REPL
|
||||||
|
|
||||||
There are 3 quick ways to embed strudel in your website:
|
There are 3 quick ways to embed strudel in your website:
|
||||||
|
|||||||
@@ -44,10 +44,10 @@ export function Reference() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const lowerCaseSearch = search.toLowerCase();
|
const lowCaseSearch = search.toLowerCase();
|
||||||
return (
|
return (
|
||||||
entry.name.toLowerCase().includes(lowerCaseSearch) ||
|
entry.name.toLowerCase().includes(lowCaseSearch) ||
|
||||||
(entry.synonyms?.some((s) => s.toLowerCase().includes(lowerCaseSearch)) ?? false)
|
(entry.synonyms?.some((s) => s.includes(lowCaseSearch)) ?? false)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}, [search]);
|
}, [search]);
|
||||||
|
|||||||
@@ -74,7 +74,6 @@ const fontFamilyOptions = {
|
|||||||
FiraCode: 'FiraCode',
|
FiraCode: 'FiraCode',
|
||||||
'FiraCode-SemiBold': 'FiraCode SemiBold',
|
'FiraCode-SemiBold': 'FiraCode SemiBold',
|
||||||
teletext: 'teletext',
|
teletext: 'teletext',
|
||||||
tic80: 'tic80',
|
|
||||||
mode7: 'mode7',
|
mode7: 'mode7',
|
||||||
BigBlueTerminal: 'BigBlueTerminal',
|
BigBlueTerminal: 'BigBlueTerminal',
|
||||||
x3270: 'x3270',
|
x3270: 'x3270',
|
||||||
|
|||||||
@@ -44,9 +44,6 @@ export function SoundsTab() {
|
|||||||
if (soundsFilter === soundFilterType.SYNTHS) {
|
if (soundsFilter === soundFilterType.SYNTHS) {
|
||||||
return filtered.filter(([_, { data }]) => ['synth', 'soundfont'].includes(data.type));
|
return filtered.filter(([_, { data }]) => ['synth', 'soundfont'].includes(data.type));
|
||||||
}
|
}
|
||||||
if (soundsFilter === soundFilterType.WAVETABLES) {
|
|
||||||
return filtered.filter(([_, { data }]) => data.type === 'wavetable');
|
|
||||||
}
|
|
||||||
//TODO: tidy this up, it does not need to be saved in settings
|
//TODO: tidy this up, it does not need to be saved in settings
|
||||||
if (soundsFilter === 'importSounds') {
|
if (soundsFilter === 'importSounds') {
|
||||||
return [];
|
return [];
|
||||||
@@ -57,9 +54,6 @@ export function SoundsTab() {
|
|||||||
// holds mutable ref to current triggered sound
|
// holds mutable ref to current triggered sound
|
||||||
const trigRef = useRef();
|
const trigRef = useRef();
|
||||||
|
|
||||||
// Used to cycle through sound previews on banks with multiple sounds
|
|
||||||
let soundPreviewIdx = 0;
|
|
||||||
|
|
||||||
// stop current sound on mouseup
|
// stop current sound on mouseup
|
||||||
useEvent('mouseup', () => {
|
useEvent('mouseup', () => {
|
||||||
const t = trigRef.current;
|
const t = trigRef.current;
|
||||||
@@ -80,7 +74,6 @@ export function SoundsTab() {
|
|||||||
samples: 'samples',
|
samples: 'samples',
|
||||||
drums: 'drum-machines',
|
drums: 'drum-machines',
|
||||||
synths: 'Synths',
|
synths: 'Synths',
|
||||||
wavetables: 'Wavetables',
|
|
||||||
user: 'User',
|
user: 'User',
|
||||||
importSounds: 'import-sounds',
|
importSounds: 'import-sounds',
|
||||||
}}
|
}}
|
||||||
@@ -117,13 +110,11 @@ export function SoundsTab() {
|
|||||||
const params = {
|
const params = {
|
||||||
note: ['synth', 'soundfont'].includes(data.type) ? 'a3' : undefined,
|
note: ['synth', 'soundfont'].includes(data.type) ? 'a3' : undefined,
|
||||||
s: name,
|
s: name,
|
||||||
n: soundPreviewIdx,
|
|
||||||
clip: 1,
|
clip: 1,
|
||||||
release: 0.5,
|
release: 0.5,
|
||||||
sustain: 1,
|
sustain: 1,
|
||||||
duration: 0.5,
|
duration: 0.5,
|
||||||
};
|
};
|
||||||
soundPreviewIdx++;
|
|
||||||
const time = ctx.currentTime + 0.05;
|
const time = ctx.currentTime + 0.05;
|
||||||
const onended = () => trigRef.current?.node?.disconnect();
|
const onended = () => trigRef.current?.node?.disconnect();
|
||||||
trigRef.current = Promise.resolve(onTrigger(time, params, onended));
|
trigRef.current = Promise.resolve(onTrigger(time, params, onended));
|
||||||
@@ -135,7 +126,6 @@ export function SoundsTab() {
|
|||||||
{' '}
|
{' '}
|
||||||
{name}
|
{name}
|
||||||
{data?.type === 'sample' ? `(${getSamples(data.samples)})` : ''}
|
{data?.type === 'sample' ? `(${getSamples(data.samples)})` : ''}
|
||||||
{data?.type === 'wavetable' ? `(${getSamples(data.tables)})` : ''}
|
|
||||||
{data?.type === 'soundfont' ? `(${data.fonts.length})` : ''}
|
{data?.type === 'soundfont' ? `(${data.fonts.length})` : ''}
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { registerSampleSource } from '@strudel/webaudio';
|
import { registerSound, onTriggerSample } from '@strudel/webaudio';
|
||||||
import { isAudioFile } from './files.mjs';
|
import { isAudioFile } from './files.mjs';
|
||||||
import { logger } from '@strudel/core';
|
import { logger } from '@strudel/core';
|
||||||
|
|
||||||
@@ -76,7 +76,13 @@ export function registerSamplesFromDB(config = userSamplesDBConfig, onComplete =
|
|||||||
})
|
})
|
||||||
.map((title) => titlePathMap.get(title));
|
.map((title) => titlePathMap.get(title));
|
||||||
|
|
||||||
registerSampleSource(key, value, { prebake: false });
|
registerSound(key, (t, hapValue, onended) => onTriggerSample(t, hapValue, onended, value), {
|
||||||
|
type: 'sample',
|
||||||
|
samples: value,
|
||||||
|
baseUrl: undefined,
|
||||||
|
prebake: false,
|
||||||
|
tag: undefined,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
logger('imported sounds registered!', 'success');
|
logger('imported sounds registered!', 'success');
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import './files.mjs';
|
|||||||
|
|
||||||
const { BASE_URL } = import.meta.env;
|
const { BASE_URL } = import.meta.env;
|
||||||
const baseNoTrailing = BASE_URL.endsWith('/') ? BASE_URL.slice(0, -1) : BASE_URL;
|
const baseNoTrailing = BASE_URL.endsWith('/') ? BASE_URL.slice(0, -1) : BASE_URL;
|
||||||
const baseCDN = 'https://strudel.b-cdn.net';
|
|
||||||
|
|
||||||
export async function prebake() {
|
export async function prebake() {
|
||||||
// https://archive.org/details/SalamanderGrandPianoV3
|
// https://archive.org/details/SalamanderGrandPianoV3
|
||||||
@@ -20,23 +19,20 @@ export async function prebake() {
|
|||||||
// => getting "window is not defined", as soon as "@strudel/soundfonts" is imported statically
|
// => getting "window is not defined", as soon as "@strudel/soundfonts" is imported statically
|
||||||
// seems to be a problem with soundfont2
|
// seems to be a problem with soundfont2
|
||||||
import('@strudel/soundfonts').then(({ registerSoundfonts }) => registerSoundfonts()),
|
import('@strudel/soundfonts').then(({ registerSoundfonts }) => registerSoundfonts()),
|
||||||
samples(`${baseCDN}/piano.json`, `${baseCDN}/piano/`, { prebake: true }),
|
samples(`${baseNoTrailing}/piano.json`, undefined, { prebake: true }),
|
||||||
// https://github.com/sgossner/VCSL/
|
// https://github.com/sgossner/VCSL/
|
||||||
// https://api.github.com/repositories/126427031/contents/
|
// https://api.github.com/repositories/126427031/contents/
|
||||||
// LICENSE: CC0 general-purpose
|
// LICENSE: CC0 general-purpose
|
||||||
samples(`${baseCDN}/vcsl.json`, `${baseCDN}/VCSL/`, { prebake: true }),
|
samples(`${baseNoTrailing}/vcsl.json`, 'github:sgossner/VCSL/master/', { prebake: true }),
|
||||||
samples(`${baseCDN}/tidal-drum-machines.json`, `${baseCDN}/tidal-drum-machines/machines/`, {
|
samples(`${baseNoTrailing}/tidal-drum-machines.json`, 'github:ritchse/tidal-drum-machines/main/machines/', {
|
||||||
prebake: true,
|
prebake: true,
|
||||||
tag: 'drum-machines',
|
tag: 'drum-machines',
|
||||||
}),
|
}),
|
||||||
samples(`${baseCDN}/uzu-drumkit.json`, `${baseCDN}/uzu-drumkit/`, {
|
samples(`${baseNoTrailing}/uzu-drumkit.json`, undefined, {
|
||||||
prebake: true,
|
prebake: true,
|
||||||
tag: 'drum-machines',
|
tag: 'drum-machines',
|
||||||
}),
|
}),
|
||||||
samples(`${baseCDN}/uzu-wavetables.json`, `${baseCDN}/uzu-wavetables/`, {
|
samples(`${baseNoTrailing}/mridangam.json`, undefined, { prebake: true, tag: 'drum-machines' }),
|
||||||
prebake: true,
|
|
||||||
}),
|
|
||||||
samples(`${baseCDN}/mridangam.json`, `${baseCDN}/mrid/`, { prebake: true, tag: 'drum-machines' }),
|
|
||||||
samples(
|
samples(
|
||||||
{
|
{
|
||||||
casio: ['casio/high.wav', 'casio/low.wav', 'casio/noise.wav'],
|
casio: ['casio/high.wav', 'casio/low.wav', 'casio/noise.wav'],
|
||||||
@@ -146,14 +142,14 @@ export async function prebake() {
|
|||||||
'num/20.wav',
|
'num/20.wav',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
`${baseCDN}/Dirt-Samples/`,
|
'github:tidalcycles/dirt-samples',
|
||||||
{
|
{
|
||||||
prebake: true,
|
prebake: true,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
aliasBank(`${baseCDN}/tidal-drum-machines-alias.json`);
|
aliasBank(`${baseNoTrailing}/tidal-drum-machines-alias.json`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const maxPan = noteToMidi('C8');
|
const maxPan = noteToMidi('C8');
|
||||||
|
|||||||
@@ -285,7 +285,7 @@ stack(
|
|||||||
.mul(gain(sine.struct("x*8").add(3/5).mul(2/5).fast(8)))
|
.mul(gain(sine.struct("x*8").add(3/5).mul(2/5).fast(8)))
|
||||||
.piano()`;
|
.piano()`;
|
||||||
|
|
||||||
// iter, echo, echoWith
|
// iter, echo, echoForEach
|
||||||
export const undergroundPlumber = `// "Underground plumber"
|
export const undergroundPlumber = `// "Underground plumber"
|
||||||
// @license CC BY-NC-SA 4.0 https://creativecommons.org/licenses/by-nc-sa/4.0/
|
// @license CC BY-NC-SA 4.0 https://creativecommons.org/licenses/by-nc-sa/4.0/
|
||||||
// @by Felix Roos
|
// @by Felix Roos
|
||||||
@@ -307,7 +307,7 @@ stack(
|
|||||||
.cutoff(400).decay(.12).sustain(0)
|
.cutoff(400).decay(.12).sustain(0)
|
||||||
,
|
,
|
||||||
"[g2,[c3 eb3]]".iter(4)
|
"[g2,[c3 eb3]]".iter(4)
|
||||||
.echoWith(4, 1/8, (x,n)=>x.transpose(n*12).gain(Math.pow(.4,n)))
|
.echoForEach(4, 1/8, (x,n)=>x.transpose(n*12).gain(Math.pow(.4,n)))
|
||||||
.note().layer(h)
|
.note().layer(h)
|
||||||
.clip(.1)
|
.clip(.1)
|
||||||
)
|
)
|
||||||
@@ -432,7 +432,7 @@ export const festivalOfFingers3 = `// "Festival of fingers 3"
|
|||||||
setcps(1)
|
setcps(1)
|
||||||
|
|
||||||
n("[-7*3],0,2,6,[8 7]")
|
n("[-7*3],0,2,6,[8 7]")
|
||||||
.echoWith(
|
.echoForEach(
|
||||||
4, // echo 4 times
|
4, // echo 4 times
|
||||||
1/4, // 1/4s between echos
|
1/4, // 1/4s between echos
|
||||||
(x,i)=>x
|
(x,i)=>x
|
||||||
@@ -485,7 +485,7 @@ stack(
|
|||||||
.decay(.1).sustain(0) // make notes short
|
.decay(.1).sustain(0) // make notes short
|
||||||
.s('triangle') // waveform
|
.s('triangle') // waveform
|
||||||
.degradeBy(perlin.range(0,.5)) // randomly controlled random removal :)
|
.degradeBy(perlin.range(0,.5)) // randomly controlled random removal :)
|
||||||
.echoWith(4,.125,(x,n)=>x.gain(.15*1/(n+1))) // echo notes
|
.echoForEach(4,.125,(x,n)=>x.gain(.15*1/(n+1))) // echo notes
|
||||||
//.hush()
|
//.hush()
|
||||||
)
|
)
|
||||||
.slow(3/2)`;
|
.slow(3/2)`;
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ export const soundFilterType = {
|
|||||||
DRUMS: 'drums',
|
DRUMS: 'drums',
|
||||||
SAMPLES: 'samples',
|
SAMPLES: 'samples',
|
||||||
SYNTHS: 'synths',
|
SYNTHS: 'synths',
|
||||||
WAVETABLES: 'wavetables',
|
|
||||||
ALL: 'all',
|
ALL: 'all',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -50,11 +50,6 @@
|
|||||||
src: url('/fonts/teletext/EuropeanTeletext.ttf');
|
src: url('/fonts/teletext/EuropeanTeletext.ttf');
|
||||||
size-adjust: 90%;
|
size-adjust: 90%;
|
||||||
}
|
}
|
||||||
@font-face {
|
|
||||||
font-family: 'tic80';
|
|
||||||
src: url('/fonts/tic80/tic-80-wide-font.otf');
|
|
||||||
size-adjust: 60%;
|
|
||||||
}
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'mode7';
|
font-family: 'mode7';
|
||||||
src: url('/fonts/mode7/MODE7GX3.TTF');
|
src: url('/fonts/mode7/MODE7GX3.TTF');
|
||||||
|
|||||||
Reference in New Issue
Block a user