mirror of
https://codeberg.org/uzu/strudel
synced 2026-07-25 06:58:15 -04:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d1dd895d94 | |||
| f8124fca80 | |||
| 95fee04bea | |||
| f60894f2ce |
@@ -150,7 +150,6 @@ Important: Always publish with `pnpm`, as `npm` does not support overriding main
|
|||||||
|
|
||||||
|
|
||||||
## useful commands
|
## useful commands
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
#regenerate the test snapshots (ex: when updating or creating new pattern functions)
|
#regenerate the test snapshots (ex: when updating or creating new pattern functions)
|
||||||
pnpm snapshot
|
pnpm snapshot
|
||||||
@@ -161,81 +160,6 @@ pnpm run osc
|
|||||||
#build the standalone version
|
#build the standalone version
|
||||||
pnpm tauri build
|
pnpm tauri build
|
||||||
```
|
```
|
||||||
|
|
||||||
## version tag patching
|
|
||||||
|
|
||||||
here's a little guide on how to patch patterns in the database to prevent breaking old patterns due to breaking changes in newer versions.
|
|
||||||
|
|
||||||
the general tactic is to use `// @version x.y` to tag a pattern with a specific strudel version. when a pattern is evaluated, this metadata will de-activate any breaking changes that came after the specified version.
|
|
||||||
for example, in version 1.1, the default value for `fanchor` was changed from `0.5` to `0`.
|
|
||||||
if play a pattern that was made before that change, sounds that use filter evenlopes can sound very different, so by adding `// @version 1.0` will make it sound like it used to.
|
|
||||||
before releasing a new version with breaking changes, we can edit all patterns in the database, inserting the version tag they were created under:
|
|
||||||
|
|
||||||
as an example, to release version 1.2, do the following:
|
|
||||||
|
|
||||||
1. get date range
|
|
||||||
|
|
||||||
```sh
|
|
||||||
# get date of last version:
|
|
||||||
git log -1 --format=%aI @strudel/core@1.1.0
|
|
||||||
# 2024-05-31T23:07:26+02:00
|
|
||||||
|
|
||||||
# get date of current version:
|
|
||||||
git log -1 --format=%aI @strudel/core@1.2.0
|
|
||||||
# 2025-05-01T12:39:24+02:00
|
|
||||||
# might also use todays timestamp if version is not yet released
|
|
||||||
```
|
|
||||||
|
|
||||||
now we know, all patterns between these 2 dates have to receive a version tag (unless they already have one).
|
|
||||||
|
|
||||||
2. get patterns in question
|
|
||||||
|
|
||||||
```sql
|
|
||||||
SELECT *
|
|
||||||
FROM code_v1
|
|
||||||
WHERE code NOT LIKE '%@version%'
|
|
||||||
AND created_at > '2024-05-31T23:07:26+02:00'
|
|
||||||
AND created_at < '2025-05-01T12:39:24+02:00'
|
|
||||||
ORDER BY created_at ASC;
|
|
||||||
```
|
|
||||||
|
|
||||||
this gives us all unversioned patterns that were saved between 1.1.0 and 1.2.0. in this case, it's 9373 patterns!
|
|
||||||
|
|
||||||
3. insert version tags
|
|
||||||
|
|
||||||
we are now ready to insert the version tag to these patterns.
|
|
||||||
before updating thousands of patterns, it's probably a good idea to test if a single one gets udpated:
|
|
||||||
|
|
||||||
```sql
|
|
||||||
UPDATE code_v1
|
|
||||||
SET code = code || E'\n// @version 1.1'
|
|
||||||
WHERE hash = 'Ns2sMB40yIw4';
|
|
||||||
```
|
|
||||||
|
|
||||||
after [verifying](https://strudel.cc/?Ns2sMB40yIw4) that the version tag has been added, let's insert it everywhere:
|
|
||||||
|
|
||||||
```sql
|
|
||||||
UPDATE code_v1
|
|
||||||
SET code = code || E'\n// @version 1.1'
|
|
||||||
WHERE code NOT LIKE '%@version%'
|
|
||||||
AND created_at > '2024-05-31T23:07:26+02:00'
|
|
||||||
AND created_at < '2025-05-01T12:39:24+02:00'
|
|
||||||
```
|
|
||||||
|
|
||||||
4. verify
|
|
||||||
|
|
||||||
we can verify that the edits worked by querying all patterns that contain the new version tag:
|
|
||||||
|
|
||||||
```sql
|
|
||||||
SELECT *
|
|
||||||
FROM code_v1
|
|
||||||
WHERE code LIKE '%@version 1.1%'
|
|
||||||
AND created_at > '2024-05-31T23:07:26+02:00'
|
|
||||||
AND created_at < '2025-05-01T12:39:24+02:00'
|
|
||||||
ORDER BY created_at ASC;
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
## Have Fun
|
## Have Fun
|
||||||
|
|
||||||
Remember to have fun, and that this project is driven by the passion of volunteers!
|
Remember to have fun, and that this project is driven by the passion of volunteers!
|
||||||
|
|||||||
@@ -38,7 +38,13 @@ Licensing info for the default sound banks can be found over on the [dough-sampl
|
|||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
There are many ways to contribute to this project! See [contribution guide](./CONTRIBUTING.md). You can find the full list of contributors [here](https://codeberg.org/uzu/strudel/activity/contributors).
|
There are many ways to contribute to this project! See [contribution guide](./CONTRIBUTING.md).
|
||||||
|
|
||||||
|
<a href="https://codeberg.org/uzu/strudel/activity/contributors">
|
||||||
|
<img src="https://contrib.rocks/image?repo=tidalcycles/strudel" />
|
||||||
|
</a>
|
||||||
|
|
||||||
|
Made with [contrib.rocks](https://contrib.rocks).
|
||||||
|
|
||||||
## Community
|
## Community
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
jsdoc-synonyms.js - Add support for @synonyms tag
|
jsdoc-synonyms.js - Add support for @synonym tag
|
||||||
Copyright (C) 2023 Strudel contributors - see <https://codeberg.org/uzu/strudel/activity/contributors>
|
Copyright (C) 2023 Strudel contributors - see <https://codeberg.org/uzu/strudel/activity/contributors>
|
||||||
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/>.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"description": "Port of tidalcycles to javascript",
|
"description": "Port of tidalcycles to javascript",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"strudeljson": "node ./website/src/repl/create_strudel_json.mjs",
|
||||||
"setup": "pnpm i",
|
"setup": "pnpm i",
|
||||||
"pretest": "npm run jsdoc-json",
|
"pretest": "npm run jsdoc-json",
|
||||||
"prebuild": "npm run jsdoc-json",
|
"prebuild": "npm run jsdoc-json",
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { closeBrackets } from '@codemirror/autocomplete';
|
import { closeBrackets } from '@codemirror/autocomplete';
|
||||||
export { toggleComment, toggleBlockComment, toggleLineComment, toggleBlockCommentByLine } from '@codemirror/commands';
|
export { toggleComment, toggleBlockComment, toggleLineComment, toggleBlockCommentByLine } from '@codemirror/commands';
|
||||||
// import { search, highlightSelectionMatches } from '@codemirror/search';
|
// import { search, highlightSelectionMatches } from '@codemirror/search';
|
||||||
import { history, indentWithTab } from '@codemirror/commands';
|
import { history } from '@codemirror/commands';
|
||||||
import { javascript } from '@codemirror/lang-javascript';
|
import { javascript } from '@codemirror/lang-javascript';
|
||||||
import { defaultHighlightStyle, syntaxHighlighting, bracketMatching } from '@codemirror/language';
|
import { defaultHighlightStyle, syntaxHighlighting, bracketMatching } from '@codemirror/language';
|
||||||
import { Compartment, EditorState, Prec } from '@codemirror/state';
|
import { Compartment, EditorState, Prec } from '@codemirror/state';
|
||||||
@@ -37,14 +37,6 @@ const extensions = {
|
|||||||
isActiveLineHighlighted: (on) => (on ? [highlightActiveLine(), highlightActiveLineGutter()] : []),
|
isActiveLineHighlighted: (on) => (on ? [highlightActiveLine(), highlightActiveLineGutter()] : []),
|
||||||
isFlashEnabled,
|
isFlashEnabled,
|
||||||
keybindings,
|
keybindings,
|
||||||
isTabIndentationEnabled: (on) => (on ? keymap.of([indentWithTab]) : []),
|
|
||||||
isMultiCursorEnabled: (on) =>
|
|
||||||
on
|
|
||||||
? [
|
|
||||||
EditorState.allowMultipleSelections.of(true),
|
|
||||||
EditorView.clickAddsSelectionRange.of((ev) => ev.metaKey || ev.ctrlKey),
|
|
||||||
]
|
|
||||||
: [],
|
|
||||||
};
|
};
|
||||||
const compartments = Object.fromEntries(Object.keys(extensions).map((key) => [key, new Compartment()]));
|
const compartments = Object.fromEntries(Object.keys(extensions).map((key) => [key, new Compartment()]));
|
||||||
|
|
||||||
@@ -59,8 +51,6 @@ export const defaultSettings = {
|
|||||||
isFlashEnabled: true,
|
isFlashEnabled: true,
|
||||||
isTooltipEnabled: false,
|
isTooltipEnabled: false,
|
||||||
isLineWrappingEnabled: false,
|
isLineWrappingEnabled: false,
|
||||||
isTabIndentationEnabled: false,
|
|
||||||
isMultiCursorEnabled: false,
|
|
||||||
theme: 'strudelTheme',
|
theme: 'strudelTheme',
|
||||||
fontFamily: 'monospace',
|
fontFamily: 'monospace',
|
||||||
fontSize: 18,
|
fontSize: 18,
|
||||||
|
|||||||
@@ -21,11 +21,11 @@ const vscodeExtension = (options) => [vscodePlugin].concat(options ?? []);
|
|||||||
const keymaps = {
|
const keymaps = {
|
||||||
vim,
|
vim,
|
||||||
emacs,
|
emacs,
|
||||||
codemirror: () => keymap.of(defaultKeymap),
|
|
||||||
vscode: vscodeExtension,
|
vscode: vscodeExtension,
|
||||||
};
|
};
|
||||||
|
|
||||||
export function keybindings(name) {
|
export function keybindings(name) {
|
||||||
const active = keymaps[name];
|
const active = keymaps[name];
|
||||||
return [active ? active() : [], keymap.of(historyKeymap)];
|
return [keymap.of(defaultKeymap), keymap.of(historyKeymap), active ? active() : []];
|
||||||
|
// keymap.of(searchKeymap),
|
||||||
}
|
}
|
||||||
|
|||||||
+14
-150
@@ -160,18 +160,6 @@ export const { velocity } = registerControl('velocity');
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
export const { gain } = registerControl('gain');
|
export const { gain } = registerControl('gain');
|
||||||
|
|
||||||
/**
|
|
||||||
* Applies a linear gain adjustment
|
|
||||||
*
|
|
||||||
* @name gainlinear
|
|
||||||
* @synonyms gainlin
|
|
||||||
* @param {number | Pattern} amount gainlin
|
|
||||||
* @example
|
|
||||||
* s("hh*8").gainlin(".4!2 1 .4!2 1 .4 1").fast(2)
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
export const { gainlinear, gainlin } = registerControl('gainlinear', 'gainlin');
|
|
||||||
/**
|
/**
|
||||||
* Gain applied after all effects have been processed.
|
* Gain applied after all effects have been processed.
|
||||||
*
|
*
|
||||||
@@ -264,20 +252,6 @@ export const { fmenv } = registerControl('fmenv');
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
export const { fmattack } = registerControl('fmattack');
|
export const { fmattack } = registerControl('fmattack');
|
||||||
|
|
||||||
/**
|
|
||||||
* waveform of the fm modulator
|
|
||||||
*
|
|
||||||
* @name fmwave
|
|
||||||
* @param {number | Pattern} wave waveform
|
|
||||||
* @example
|
|
||||||
* n("0 1 2 3".fast(4)).scale("d:minor").s("sine").fmwave("<sine square sawtooth crackle>").fm(4).fmh(2.01)
|
|
||||||
* @example
|
|
||||||
* n("0 1 2 3".fast(4)).chord("<Dm Am F G>").voicing().s("sawtooth").fmwave("brown").fm(.6)
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
export const { fmwave } = registerControl('fmwave');
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decay time for the FM envelope: seconds until the sustain level is reached after the attack phase.
|
* Decay time for the FM envelope: seconds until the sustain level is reached after the attack phase.
|
||||||
*
|
*
|
||||||
@@ -470,78 +444,6 @@ 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
|
|
||||||
*
|
|
||||||
* @name tremolo
|
|
||||||
* @synonyms trem
|
|
||||||
* @param {number | Pattern} speed modulation speed in HZ
|
|
||||||
* @example
|
|
||||||
* note("d d d# d".fast(4)).s("supersaw").tremolo("<3 2 100> ").tremoloskew("<.5>")
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
export const { tremolo } = registerControl(['tremolo', 'tremolodepth', 'tremoloskew', 'tremolophase'], 'trem');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* modulate the amplitude of a sound with a continuous waveform
|
|
||||||
*
|
|
||||||
* @name tremolosync
|
|
||||||
* @synonyms tremsync
|
|
||||||
* @param {number | Pattern} cycles modulation speed in cycles
|
|
||||||
* @example
|
|
||||||
* note("d d d# d".fast(4)).s("supersaw").tremolosync("4").tremoloskew("<1 .5 0>")
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
export const { tremolosync } = registerControl(
|
|
||||||
['tremolosync', 'tremolodepth', 'tremoloskew', 'tremolophase'],
|
|
||||||
'tremsync',
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* depth of amplitude modulation
|
|
||||||
*
|
|
||||||
* @name tremolodepth
|
|
||||||
* @synonyms tremdepth
|
|
||||||
* @param {number | Pattern} depth
|
|
||||||
* @example
|
|
||||||
* note("a1 a1 a#1 a1".fast(4)).s("pulse").tremsync(4).tremolodepth("<1 2 .7>")
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
export const { tremolodepth } = registerControl('tremolodepth', 'tremdepth');
|
|
||||||
/**
|
|
||||||
* alter the shape of the modulation waveform
|
|
||||||
*
|
|
||||||
* @name tremoloskew
|
|
||||||
* @synonyms tremskew
|
|
||||||
* @param {number | Pattern} amount between 0 & 1, the shape of the waveform
|
|
||||||
* @example
|
|
||||||
* note("{f a c e}%16").s("sawtooth").tremsync(4).tremoloskew("<.5 0 1>")
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
export const { tremoloskew } = registerControl('tremoloskew', 'tremskew');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* alter the phase of the modulation waveform
|
|
||||||
*
|
|
||||||
* @name tremolophase
|
|
||||||
* @synonyms tremphase
|
|
||||||
* @param {number | Pattern} offset the offset in cycles of the modulation
|
|
||||||
* @example
|
|
||||||
* note("{f a c e}%16").s("sawtooth").tremsync(4).tremolophase("<0 .25 .66>")
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
export const { tremolophase } = registerControl('tremolophase', 'tremphase');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* shape of amplitude modulation
|
|
||||||
*
|
|
||||||
* @name tremoloshape
|
|
||||||
* @param {number | Pattern} shape tri | square | sine | saw | ramp
|
|
||||||
* @example
|
|
||||||
* note("{f g c d}%16").tremsync(4).tremoloshape("<sine tri square>").s("sawtooth")
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
export const { tremoloshape } = registerControl('tremoloshape', 'tremshape');
|
|
||||||
/**
|
/**
|
||||||
* filter overdrive for supported filter types
|
* filter overdrive for supported filter types
|
||||||
*
|
*
|
||||||
@@ -551,41 +453,6 @@ export const { tremoloshape } = registerControl('tremoloshape', 'tremshape');
|
|||||||
* note("{f g g c d a a#}%16".sub(17)).s("supersaw").lpenv(8).lpf(150).lpq(.8).ftype('ladder').drive("<.5 4>")
|
* note("{f g g c d a a#}%16".sub(17)).s("supersaw").lpenv(8).lpf(150).lpq(.8).ftype('ladder').drive("<.5 4>")
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* modulate the amplitude of an orbit to create a "sidechain" like effect
|
|
||||||
*
|
|
||||||
* @name duckorbit
|
|
||||||
* @param {number | Pattern} orbit target orbit
|
|
||||||
* @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))
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
export const { duck } = registerControl('duckorbit', 'duck');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* the amount of ducking applied to target orbit
|
|
||||||
*
|
|
||||||
* @name duckdepth
|
|
||||||
* @param {number | Pattern} depth depth of modulation from 0 to 1
|
|
||||||
* @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>"))
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
export const { duckdepth } = registerControl('duckdepth');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* the attack time of the duck effect
|
|
||||||
*
|
|
||||||
* @name duckattack
|
|
||||||
* @param {number | Pattern} time
|
|
||||||
* @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 0 0.4>").duckdepth(1))
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
export const { duckattack } = registerControl('duckattack', 'duckatt');
|
|
||||||
|
|
||||||
export const { drive } = registerControl('drive');
|
export const { drive } = registerControl('drive');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1118,31 +985,15 @@ export const { delayfeedback, delayfb, dfb } = registerControl('delayfeedback',
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
export const { delaytime, delayt, dt } = registerControl('delaytime', 'delayt', 'dt');
|
export const { delaytime, delayt, dt } = registerControl('delaytime', 'delayt', 'dt');
|
||||||
|
/* // TODO: test
|
||||||
/**
|
|
||||||
* Sets the time of the delay effect in cycles.
|
|
||||||
*
|
|
||||||
* @name delaysync
|
|
||||||
* @param {number | Pattern} cycles delay length in cycles
|
|
||||||
* @synonyms delayt, dt
|
|
||||||
* @example
|
|
||||||
* s("bd bd").delay(.25).delaysync("<1 2 3 5>".div(8))
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
export const { delaysync } = registerControl('delaysync');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Specifies whether delaytime is calculated relative to cps.
|
* Specifies whether delaytime is calculated relative to cps.
|
||||||
*
|
*
|
||||||
* @name lock
|
* @name lock
|
||||||
* @param {number | Pattern} enable When set to 1, delaytime is a direct multiple of a cycle.
|
* @param {number | Pattern} enable When set to 1, delaytime is a direct multiple of a cycle.
|
||||||
* @superdirtOnly
|
|
||||||
* @example
|
* @example
|
||||||
* s("sd").delay().lock(1).osc()
|
* s("sd").delay().lock(1).osc()
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export const { lock } = registerControl('lock');
|
export const { lock } = registerControl('lock');
|
||||||
/**
|
/**
|
||||||
* Set detune for stacked voices of supported oscillators
|
* Set detune for stacked voices of supported oscillators
|
||||||
@@ -1694,6 +1545,18 @@ export const { density } = registerControl('density');
|
|||||||
// ['modwheel'],
|
// ['modwheel'],
|
||||||
export const { expression } = registerControl('expression');
|
export const { expression } = registerControl('expression');
|
||||||
export const { sustainpedal } = registerControl('sustainpedal');
|
export const { sustainpedal } = registerControl('sustainpedal');
|
||||||
|
/* // TODO: doesn't seem to do anything
|
||||||
|
*
|
||||||
|
* Tremolo Audio DSP effect
|
||||||
|
*
|
||||||
|
* @name tremolodepth
|
||||||
|
* @param {number | Pattern} depth between 0 and 1
|
||||||
|
* @example
|
||||||
|
* n("0,4,7").tremolodepth("<0 .3 .6 .9>").osc()
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
export const { tremolodepth, tremdp } = registerControl('tremolodepth', 'tremdp');
|
||||||
|
export const { tremolorate, tremr } = registerControl('tremolorate', 'tremr');
|
||||||
|
|
||||||
export const { fshift } = registerControl('fshift');
|
export const { fshift } = registerControl('fshift');
|
||||||
export const { fshiftnote } = registerControl('fshiftnote');
|
export const { fshiftnote } = registerControl('fshiftnote');
|
||||||
@@ -1770,6 +1633,7 @@ export const { zmod } = registerControl('zmod');
|
|||||||
// like crush but scaled differently
|
// like crush but scaled differently
|
||||||
export const { zcrush } = registerControl('zcrush');
|
export const { zcrush } = registerControl('zcrush');
|
||||||
export const { zdelay } = registerControl('zdelay');
|
export const { zdelay } = registerControl('zdelay');
|
||||||
|
export const { tremolo } = registerControl('tremolo');
|
||||||
export const { zzfx } = registerControl('zzfx');
|
export const { zzfx } = registerControl('zzfx');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ This program is free software: you can redistribute it and/or modify it under th
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import createClock from './zyklus.mjs';
|
import createClock from './zyklus.mjs';
|
||||||
import { errorLogger, logger } from './logger.mjs';
|
import { logger } from './logger.mjs';
|
||||||
|
|
||||||
export class Cyclist {
|
export class Cyclist {
|
||||||
constructor({
|
constructor({
|
||||||
@@ -67,7 +67,6 @@ export class Cyclist {
|
|||||||
// the following line is dumb and only here for backwards compatibility
|
// the following line is dumb and only here for backwards compatibility
|
||||||
// see https://codeberg.org/uzu/strudel/pulls/1004
|
// see https://codeberg.org/uzu/strudel/pulls/1004
|
||||||
const deadline = targetTime - phase;
|
const deadline = targetTime - phase;
|
||||||
// this onTrigger has another signature
|
|
||||||
onTrigger?.(hap, deadline, duration, this.cps, targetTime);
|
onTrigger?.(hap, deadline, duration, this.cps, targetTime);
|
||||||
if (hap.value.cps !== undefined && this.cps != hap.value.cps) {
|
if (hap.value.cps !== undefined && this.cps != hap.value.cps) {
|
||||||
this.cps = hap.value.cps;
|
this.cps = hap.value.cps;
|
||||||
@@ -76,7 +75,7 @@ export class Cyclist {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
errorLogger(e);
|
logger(`[cyclist] error: ${e.message}`);
|
||||||
onError?.(e);
|
onError?.(e);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -4,12 +4,6 @@ let debounce = 1000,
|
|||||||
lastMessage,
|
lastMessage,
|
||||||
lastTime;
|
lastTime;
|
||||||
|
|
||||||
export function errorLogger(e, origin = 'cyclist') {
|
|
||||||
//TODO: add some kind of debug flag that enables this while in dev mode
|
|
||||||
// console.error(e);
|
|
||||||
logger(`[${origin}] error: ${e.message}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function logger(message, type, data = {}) {
|
export function logger(message, type, data = {}) {
|
||||||
let t = performance.now();
|
let t = performance.now();
|
||||||
if (lastMessage === message && t - lastTime < debounce) {
|
if (lastMessage === message && t - lastTime < debounce) {
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ export class NeoCyclist {
|
|||||||
constructor({ onTrigger, onToggle, getTime }) {
|
constructor({ onTrigger, onToggle, getTime }) {
|
||||||
this.started = false;
|
this.started = false;
|
||||||
this.cps = 0.5;
|
this.cps = 0.5;
|
||||||
|
this.lastTick = 0; // absolute time when last tick (clock callback) happened
|
||||||
this.getTime = getTime; // get absolute time
|
this.getTime = getTime; // get absolute time
|
||||||
this.time_at_last_tick_message = 0;
|
this.time_at_last_tick_message = 0;
|
||||||
// the clock of the worker and the audio context clock can drift apart over time
|
// the clock of the worker and the audio context clock can drift apart over time
|
||||||
|
|||||||
@@ -869,31 +869,6 @@ export class Pattern {
|
|||||||
console.log(drawLine(this));
|
console.log(drawLine(this));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
|
||||||
// methods relating to breaking patterns into subcycles
|
|
||||||
|
|
||||||
// Breaks a pattern into a pattern of patterns, according to the structure of the given binary pattern.
|
|
||||||
unjoin(pieces, func = id) {
|
|
||||||
return pieces.withHap((hap) =>
|
|
||||||
hap.withValue((v) => (v ? func(this.ribbon(hap.whole.begin, hap.whole.duration)) : this)),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Breaks a pattern into pieces according to the structure of a given pattern.
|
|
||||||
* True values in the given pattern cause the corresponding subcycle of the
|
|
||||||
* source pattern to be looped, and for an (optional) given function to be
|
|
||||||
* applied. False values result in the corresponding part of the source pattern
|
|
||||||
* to be played unchanged.
|
|
||||||
* @name into
|
|
||||||
* @memberof Pattern
|
|
||||||
* @example
|
|
||||||
* sound("bd sd ht lt").into("1 0", hurry(2))
|
|
||||||
*/
|
|
||||||
into(pieces, func) {
|
|
||||||
return this.unjoin(pieces, func).innerJoin();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
@@ -2519,37 +2494,6 @@ export const { fastchunk, fastChunk } = register(
|
|||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
|
||||||
* Like `chunk`, but the function is applied to a looped subcycle of the source pattern.
|
|
||||||
* @name chunkInto
|
|
||||||
* @synonyms chunkinto
|
|
||||||
* @memberof Pattern
|
|
||||||
* @example
|
|
||||||
* sound("bd sd ht lt bd - cp lt").chunkInto(4, hurry(2))
|
|
||||||
* .bank("tr909")
|
|
||||||
*/
|
|
||||||
export const { chunkinto, chunkInto } = register(['chunkinto', 'chunkInto'], function (n, func, pat) {
|
|
||||||
return pat.into(fastcat(true, ...Array(n - 1).fill(false))._iterback(n), func);
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Like `chunkInto`, but moves backwards through the chunks.
|
|
||||||
* @name chunkBackInto
|
|
||||||
* @synonyms chunkbackinto
|
|
||||||
* @memberof Pattern
|
|
||||||
* @example
|
|
||||||
* sound("bd sd ht lt bd - cp lt").chunkInto(4, hurry(2))
|
|
||||||
* .bank("tr909")
|
|
||||||
*/
|
|
||||||
export const { chunkbackinto, chunkBackInto } = register(['chunkbackinto', 'chunkBackInto'], function (n, func, pat) {
|
|
||||||
return pat.into(
|
|
||||||
fastcat(true, ...Array(n - 1).fill(false))
|
|
||||||
._iter(n)
|
|
||||||
._early(1),
|
|
||||||
func,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
// TODO - redefine elsewhere in terms of mask
|
// TODO - redefine elsewhere in terms of mask
|
||||||
export const bypass = register(
|
export const bypass = register(
|
||||||
'bypass',
|
'bypass',
|
||||||
@@ -2565,7 +2509,7 @@ export const bypass = register(
|
|||||||
* Loops the pattern inside an `offset` for `cycles`.
|
* Loops the pattern inside an `offset` for `cycles`.
|
||||||
* If you think of the entire span of time in cycles as a ribbon, you can cut a single piece and loop it.
|
* If you think of the entire span of time in cycles as a ribbon, you can cut a single piece and loop it.
|
||||||
* @name ribbon
|
* @name ribbon
|
||||||
* @synonyms rib
|
* @synonym rib
|
||||||
* @param {number} offset start point of loop in cycles
|
* @param {number} offset start point of loop in cycles
|
||||||
* @param {number} cycles loop length in cycles
|
* @param {number} cycles loop length in cycles
|
||||||
* @example
|
* @example
|
||||||
@@ -3263,7 +3207,7 @@ export const slice = register(
|
|||||||
* s("bd!8").onTriggerTime((hap) => {console.info(hap)})
|
* s("bd!8").onTriggerTime((hap) => {console.info(hap)})
|
||||||
*/
|
*/
|
||||||
Pattern.prototype.onTriggerTime = function (func) {
|
Pattern.prototype.onTriggerTime = function (func) {
|
||||||
return this.onTrigger((hap, currentTime, _cps, targetTime) => {
|
return this.onTrigger((t_deprecate, hap, currentTime, cps = 1, targetTime) => {
|
||||||
const diff = targetTime - currentTime;
|
const diff = targetTime - currentTime;
|
||||||
window.setTimeout(() => {
|
window.setTimeout(() => {
|
||||||
func(hap);
|
func(hap);
|
||||||
|
|||||||
+5
-13
@@ -1,7 +1,7 @@
|
|||||||
import { NeoCyclist } from './neocyclist.mjs';
|
import { NeoCyclist } from './neocyclist.mjs';
|
||||||
import { Cyclist } from './cyclist.mjs';
|
import { Cyclist } from './cyclist.mjs';
|
||||||
import { evaluate as _evaluate } from './evaluate.mjs';
|
import { evaluate as _evaluate } from './evaluate.mjs';
|
||||||
import { errorLogger, logger } from './logger.mjs';
|
import { logger } from './logger.mjs';
|
||||||
import { setTime } from './time.mjs';
|
import { setTime } from './time.mjs';
|
||||||
import { evalScope } from './evaluate.mjs';
|
import { evalScope } from './evaluate.mjs';
|
||||||
import { register, Pattern, isPattern, silence, stack } from './pattern.mjs';
|
import { register, Pattern, isPattern, silence, stack } from './pattern.mjs';
|
||||||
@@ -138,9 +138,9 @@ export function repl({
|
|||||||
// allows muting a pattern x with x_ or _x
|
// allows muting a pattern x with x_ or _x
|
||||||
return silence;
|
return silence;
|
||||||
}
|
}
|
||||||
if (id.includes('$')) {
|
if (id === '$') {
|
||||||
// allows adding anonymous patterns with $:
|
// allows adding anonymous patterns with $:
|
||||||
id = `${id}${anonymousIndex}`;
|
id = `$${anonymousIndex}`;
|
||||||
anonymousIndex++;
|
anonymousIndex++;
|
||||||
}
|
}
|
||||||
pPatterns[id] = this;
|
pPatterns[id] = this;
|
||||||
@@ -201,13 +201,6 @@ 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 = Object.values(pPatterns);
|
let patterns = Object.values(pPatterns);
|
||||||
|
|
||||||
// if there are solo patterns, only use those
|
|
||||||
const soloPatterns = Object.entries(pPatterns).filter(([key]) => key.length > 1 && key.startsWith('S'));
|
|
||||||
if (soloPatterns.length) {
|
|
||||||
patterns = Object.values(Object.fromEntries(soloPatterns));
|
|
||||||
}
|
|
||||||
|
|
||||||
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));
|
||||||
@@ -252,7 +245,6 @@ export function repl({
|
|||||||
export const getTrigger =
|
export const getTrigger =
|
||||||
({ getTime, defaultOutput }) =>
|
({ getTime, defaultOutput }) =>
|
||||||
async (hap, deadline, duration, cps, t) => {
|
async (hap, deadline, duration, cps, t) => {
|
||||||
// ^ this signature is different from hap.context.onTrigger, as set by Pattern.onTrigger(onTrigger)
|
|
||||||
// TODO: get rid of deadline after https://codeberg.org/uzu/strudel/pulls/1004
|
// TODO: get rid of deadline after https://codeberg.org/uzu/strudel/pulls/1004
|
||||||
try {
|
try {
|
||||||
if (!hap.context.onTrigger || !hap.context.dominantTrigger) {
|
if (!hap.context.onTrigger || !hap.context.dominantTrigger) {
|
||||||
@@ -260,9 +252,9 @@ export const getTrigger =
|
|||||||
}
|
}
|
||||||
if (hap.context.onTrigger) {
|
if (hap.context.onTrigger) {
|
||||||
// call signature of output / onTrigger is different...
|
// call signature of output / onTrigger is different...
|
||||||
await hap.context.onTrigger(hap, getTime(), cps, t);
|
await hap.context.onTrigger(getTime() + deadline, hap, getTime(), cps, t);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
errorLogger(err, 'getTrigger');
|
logger(`[cyclist] error: ${err.message}`, 'error');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -264,7 +264,7 @@ export const randrun = (n) => {
|
|||||||
const rands = timeToRands(t.floor().add(0.5), n);
|
const rands = timeToRands(t.floor().add(0.5), n);
|
||||||
const nums = rands
|
const nums = rands
|
||||||
.map((n, i) => [n, i])
|
.map((n, i) => [n, i])
|
||||||
.sort((a, b) => (a[0] > b[0]) - (a[0] < b[0]))
|
.sort((a, b) => a[0] > b[0] - a[0] < b[0])
|
||||||
.map((x) => x[1]);
|
.map((x) => x[1]);
|
||||||
const i = t.cyclePos().mul(n).floor() % n;
|
const i = t.cyclePos().mul(n).floor() % n;
|
||||||
return nums[i];
|
return nums[i];
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ function triggerSpeech(words, lang, voice) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const speak = register('speak', function (lang, voice, pat) {
|
export const speak = register('speak', function (lang, voice, pat) {
|
||||||
return pat.onTrigger((hap) => {
|
return pat.onTrigger((_, hap) => {
|
||||||
triggerSpeech(hap.value, lang, voice);
|
triggerSpeech(hap.value, lang, voice);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1271,39 +1271,4 @@ describe('Pattern', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('unjoin', () => {
|
|
||||||
it('destructures a pattern into subcycles', () => {
|
|
||||||
sameFirst(
|
|
||||||
fastcat('a', 'b', 'c', 'd')
|
|
||||||
.unjoin(fastcat(true, fastcat(true, true)))
|
|
||||||
.fmap(fast(2))
|
|
||||||
.join(),
|
|
||||||
fastcat('a', 'b', 'a', 'b', 'c', 'c', 'd', 'd'),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
describe('into', () => {
|
|
||||||
it('applies a function to subcycles of a pattern', () => {
|
|
||||||
sameFirst(
|
|
||||||
fastcat('a', 'b', 'c', 'd').into(fastcat(fastcat('true', 'true'), 'true'), fast(2)),
|
|
||||||
fastcat('a', 'a', 'b', 'b', 'c', 'd', 'c', 'd'),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
describe('chunkinto', () => {
|
|
||||||
it('chunks into subcycles', () => {
|
|
||||||
sameFirst(
|
|
||||||
fastcat('a', 'b', 'c').chunkInto(3, fast(2)).fast(3),
|
|
||||||
fastcat(fastcat('a', 'a'), 'b', 'c', 'a', fastcat('b', 'b'), 'c', 'a', 'b', fastcat('c', 'c')),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
describe('chunkbackinto', () => {
|
|
||||||
it('chunks into subcycles backwards', () => {
|
|
||||||
sameFirst(
|
|
||||||
fastcat('a', 'b', 'c').chunkBackInto(3, fast(2)).fast(3),
|
|
||||||
fastcat('a', 'b', fastcat('c', 'c'), 'a', fastcat('b', 'b'), 'c', fastcat('a', 'a'), 'b', 'c'),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export const csound = register('csound', (instrument, pat) => {
|
|||||||
instrument = instrument || 'triangle';
|
instrument = instrument || 'triangle';
|
||||||
init(); // not async to support csound inside other patterns + to be able to call pattern methods after it
|
init(); // not async to support csound inside other patterns + to be able to call pattern methods after it
|
||||||
// TODO: find a alternative way to wait for csound to load (to wait with first time playback)
|
// TODO: find a alternative way to wait for csound to load (to wait with first time playback)
|
||||||
return pat.onTrigger((hap, currentTime, _cps, targetTime) => {
|
return pat.onTrigger((time_deprecate, hap, currentTime, _cps, targetTime) => {
|
||||||
if (!_csound) {
|
if (!_csound) {
|
||||||
logger('[csound] not loaded yet', 'warning');
|
logger('[csound] not loaded yet', 'warning');
|
||||||
return;
|
return;
|
||||||
@@ -142,7 +142,7 @@ export const csoundm = register('csoundm', (instrument, pat) => {
|
|||||||
p1 = `"${instrument}"`;
|
p1 = `"${instrument}"`;
|
||||||
}
|
}
|
||||||
init(); // not async to support csound inside other patterns + to be able to call pattern methods after it
|
init(); // not async to support csound inside other patterns + to be able to call pattern methods after it
|
||||||
return pat.onTrigger((hap, currentTime, _cps, targetTime) => {
|
return pat.onTrigger((tidal_time, hap) => {
|
||||||
if (!_csound) {
|
if (!_csound) {
|
||||||
logger('[csound] not loaded yet', 'warning');
|
logger('[csound] not loaded yet', 'warning');
|
||||||
return;
|
return;
|
||||||
@@ -151,7 +151,7 @@ export const csoundm = register('csoundm', (instrument, pat) => {
|
|||||||
throw new Error('csound only support objects as hap values');
|
throw new Error('csound only support objects as hap values');
|
||||||
}
|
}
|
||||||
// Time in seconds counting from now.
|
// Time in seconds counting from now.
|
||||||
const p2 = targetTime - currentTime;
|
const p2 = tidal_time - getAudioContext().currentTime;
|
||||||
const p3 = hap.duration.valueOf() + 0;
|
const p3 = hap.duration.valueOf() + 0;
|
||||||
const frequency = getFrequency(hap);
|
const frequency = getFrequency(hap);
|
||||||
let { gain = 1, velocity = 0.9 } = hap.value;
|
let { gain = 1, velocity = 0.9 } = hap.value;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ const OFF_MESSAGE = 0x80;
|
|||||||
const CC_MESSAGE = 0xb0;
|
const CC_MESSAGE = 0xb0;
|
||||||
|
|
||||||
Pattern.prototype.midi = function (output) {
|
Pattern.prototype.midi = function (output) {
|
||||||
return this.onTrigger((hap, currentTime, cps, targetTime) => {
|
return this.onTrigger((time_deprecate, hap, currentTime, cps, targetTime) => {
|
||||||
let { note, nrpnn, nrpv, ccn, ccv, velocity = 0.9, gain = 1 } = hap.value;
|
let { note, nrpnn, nrpv, ccn, ccv, velocity = 0.9, gain = 1 } = hap.value;
|
||||||
//magic number to get audio engine to line up, can probably be calculated somehow
|
//magic number to get audio engine to line up, can probably be calculated somehow
|
||||||
const latencyMs = 34;
|
const latencyMs = 34;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { Invoke } from './utils.mjs';
|
|||||||
|
|
||||||
const collator = new ClockCollator({});
|
const collator = new ClockCollator({});
|
||||||
|
|
||||||
export async function oscTriggerTauri(hap, currentTime, cps = 1, targetTime) {
|
export async function oscTriggerTauri(t_deprecate, hap, currentTime, cps = 1, targetTime) {
|
||||||
const controls = parseControlsFromHap(hap, cps);
|
const controls = parseControlsFromHap(hap, cps);
|
||||||
const params = [];
|
const params = [];
|
||||||
const timestamp = collator.calculateTimestamp(currentTime, targetTime);
|
const timestamp = collator.calculateTimestamp(currentTime, targetTime);
|
||||||
|
|||||||
@@ -333,7 +333,7 @@ Pattern.prototype.midi = function (midiport, options = {}) {
|
|||||||
logger(`Midi device disconnected! Available: ${getMidiDeviceNamesString(outputs)}`),
|
logger(`Midi device disconnected! Available: ${getMidiDeviceNamesString(outputs)}`),
|
||||||
});
|
});
|
||||||
|
|
||||||
return this.onTrigger((hap, currentTime, cps, targetTime) => {
|
return this.onTrigger((time_deprecate, hap, currentTime, cps, targetTime) => {
|
||||||
if (!WebMidi.enabled) {
|
if (!WebMidi.enabled) {
|
||||||
logger('Midi not enabled');
|
logger('Midi not enabled');
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ lib['%'] = pace;
|
|||||||
lib['?'] = degradeBy; // todo: default 0.5 not working..
|
lib['?'] = degradeBy; // todo: default 0.5 not working..
|
||||||
lib[':'] = tail;
|
lib[':'] = tail;
|
||||||
lib['..'] = range;
|
lib['..'] = range;
|
||||||
lib['def'] = () => silence;
|
|
||||||
lib['or'] = (...children) => chooseIn(...children); // always has structure but is cyclewise.. e.g. "s oh*8.dec[.04 | .5]"
|
lib['or'] = (...children) => chooseIn(...children); // always has structure but is cyclewise.. e.g. "s oh*8.dec[.04 | .5]"
|
||||||
//lib['or'] = (...children) => chooseOut(...children); // "s oh*8.dec[.04 | .5]" is better but "dec[.04 | .5].s oh*8" has no struct
|
//lib['or'] = (...children) => chooseOut(...children); // "s oh*8.dec[.04 | .5]" is better but "dec[.04 | .5].s oh*8" has no struct
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ 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(t_deprecate, hap, currentTime, cps = 1, targetTime) {
|
||||||
const osc = 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();
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ 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(`https://raw.githubusercontent.com/tidalcycles/uzu-drumkit/main/strudel.json`),
|
samples(`${ds}/EmuSP12.json`),
|
||||||
samples(`${ds}/vcsl.json`),
|
samples(`${ds}/vcsl.json`),
|
||||||
samples(`${ds}/mridangam.json`),
|
samples(`${ds}/mridangam.json`),
|
||||||
]);
|
]);
|
||||||
|
|||||||
@@ -537,7 +537,7 @@ export default {
|
|||||||
],
|
],
|
||||||
gm_synth_bass_1: [
|
gm_synth_bass_1: [
|
||||||
// Synth Bass 1: Bass
|
// Synth Bass 1: Bass
|
||||||
// '0380_Aspirin_sf2_file', // broken in safari https://codeberg.org/uzu/strudel/issues/1384
|
'0380_Aspirin_sf2_file',
|
||||||
'0380_Chaos_sf2_file',
|
'0380_Chaos_sf2_file',
|
||||||
'0380_FluidR3_GM_sf2_file',
|
'0380_FluidR3_GM_sf2_file',
|
||||||
// 0380_GeneralUserGS_sf2_file // laut
|
// 0380_GeneralUserGS_sf2_file // laut
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { getAudioContext, registerSound } from '@strudel/webaudio';
|
|||||||
import { loadSoundfont as _loadSoundfont, startPresetNote } from 'sfumato';
|
import { loadSoundfont as _loadSoundfont, startPresetNote } from 'sfumato';
|
||||||
|
|
||||||
Pattern.prototype.soundfont = function (sf, n = 0) {
|
Pattern.prototype.soundfont = function (sf, n = 0) {
|
||||||
return this.onTrigger((h, ct, cps, targetTime) => {
|
return this.onTrigger((time_deprecate, h, ct, cps, targetTime) => {
|
||||||
const ctx = getAudioContext();
|
const ctx = getAudioContext();
|
||||||
const note = getPlayableNoteValue(h);
|
const note = getPlayableNoteValue(h);
|
||||||
const preset = sf.presets[n % sf.presets.length];
|
const preset = sf.presets[n % sf.presets.length];
|
||||||
|
|||||||
@@ -74,6 +74,6 @@ export const dough = async (code) => {
|
|||||||
worklet.node.connect(ac.destination);
|
worklet.node.connect(ac.destination);
|
||||||
};
|
};
|
||||||
|
|
||||||
export function doughTrigger(hap, currentTime, cps, targetTime) {
|
export function doughTrigger(time_deprecate, hap, currentTime, cps, targetTime) {
|
||||||
window.postMessage({ time: targetTime, dough: hap.value, currentTime, duration: hap.duration, cps });
|
window.postMessage({ time: targetTime, dough: hap.value, currentTime, duration: hap.duration, cps });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
import { getAudioContext } from './superdough.mjs';
|
import { getAudioContext } from './superdough.mjs';
|
||||||
import { clamp, nanFallback } from './util.mjs';
|
import { clamp, nanFallback } from './util.mjs';
|
||||||
import { getNoiseBuffer } from './noise.mjs';
|
|
||||||
|
|
||||||
export const noises = ['pink', 'white', 'brown', 'crackle'];
|
|
||||||
|
|
||||||
export function gainNode(value) {
|
export function gainNode(value) {
|
||||||
const node = getAudioContext().createGain();
|
const node = getAudioContext().createGain();
|
||||||
@@ -219,17 +216,9 @@ export function webAudioTimeout(audioContext, onComplete, startTime, stopTime) {
|
|||||||
}
|
}
|
||||||
const mod = (freq, range = 1, type = 'sine') => {
|
const mod = (freq, range = 1, type = 'sine') => {
|
||||||
const ctx = getAudioContext();
|
const ctx = getAudioContext();
|
||||||
let osc;
|
const osc = ctx.createOscillator();
|
||||||
if (noises.includes(type)) {
|
osc.type = type;
|
||||||
osc = ctx.createBufferSource();
|
osc.frequency.value = freq;
|
||||||
osc.buffer = getNoiseBuffer(type, 2);
|
|
||||||
osc.loop = true;
|
|
||||||
} else {
|
|
||||||
osc = ctx.createOscillator();
|
|
||||||
osc.type = type;
|
|
||||||
osc.frequency.value = freq;
|
|
||||||
}
|
|
||||||
|
|
||||||
osc.start();
|
osc.start();
|
||||||
const g = new GainNode(ctx, { gain: range });
|
const g = new GainNode(ctx, { gain: range });
|
||||||
osc.connect(g); // -range, range
|
osc.connect(g); // -range, range
|
||||||
|
|||||||
@@ -1,11 +1,5 @@
|
|||||||
let log = (msg) => console.log(msg);
|
let log = (msg) => console.log(msg);
|
||||||
|
|
||||||
export function errorLogger(e, origin = 'cyclist') {
|
|
||||||
//TODO: add some kind of debug flag that enables this while in dev mode
|
|
||||||
// console.error(e);
|
|
||||||
logger(`[${origin}] error: ${e.message}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
export const logger = (...args) => log(...args);
|
export const logger = (...args) => log(...args);
|
||||||
|
|
||||||
export const setLogger = (fn) => {
|
export const setLogger = (fn) => {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { getAudioContext } from './superdough.mjs';
|
|||||||
let noiseCache = {};
|
let noiseCache = {};
|
||||||
|
|
||||||
// lazy generates noise buffers and keeps them forever
|
// lazy generates noise buffers and keeps them forever
|
||||||
export function getNoiseBuffer(type, density) {
|
function getNoiseBuffer(type, density) {
|
||||||
const ac = getAudioContext();
|
const ac = getAudioContext();
|
||||||
if (noiseCache[type]) {
|
if (noiseCache[type]) {
|
||||||
return noiseCache[type];
|
return noiseCache[type];
|
||||||
|
|||||||
@@ -7,11 +7,11 @@ This program is free software: you can redistribute it and/or modify it under th
|
|||||||
import './feedbackdelay.mjs';
|
import './feedbackdelay.mjs';
|
||||||
import './reverb.mjs';
|
import './reverb.mjs';
|
||||||
import './vowel.mjs';
|
import './vowel.mjs';
|
||||||
import { clamp, nanFallback, _mod, cycleToSeconds, secondsToCycle } from './util.mjs';
|
import { clamp, nanFallback, _mod } from './util.mjs';
|
||||||
import workletsUrl from './worklets.mjs?audioworklet';
|
import workletsUrl from './worklets.mjs?audioworklet';
|
||||||
import { createFilter, gainNode, getCompressor, getWorklet } from './helpers.mjs';
|
import { createFilter, gainNode, getCompressor, getWorklet } from './helpers.mjs';
|
||||||
import { map } from 'nanostores';
|
import { map } from 'nanostores';
|
||||||
import { logger, errorLogger } from './logger.mjs';
|
import { logger } from './logger.mjs';
|
||||||
import { loadBuffer } from './sampler.mjs';
|
import { loadBuffer } from './sampler.mjs';
|
||||||
|
|
||||||
export const DEFAULT_MAX_POLYPHONY = 128;
|
export const DEFAULT_MAX_POLYPHONY = 128;
|
||||||
@@ -28,13 +28,6 @@ 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 = {}) {
|
||||||
@@ -42,7 +35,7 @@ export function registerSound(key, onTrigger, data = {}) {
|
|||||||
soundMap.setKey(key, { onTrigger, data });
|
soundMap.setKey(key, { onTrigger, data });
|
||||||
}
|
}
|
||||||
|
|
||||||
let gainCurveFunc = (val) => Math.pow(val, 2);
|
let gainCurveFunc = (val) => val;
|
||||||
|
|
||||||
export function applyGainCurve(val) {
|
export function applyGainCurve(val) {
|
||||||
return gainCurveFunc(val);
|
return gainCurveFunc(val);
|
||||||
@@ -133,9 +126,9 @@ export const getAudioDevices = async () => {
|
|||||||
return devicesMap;
|
return devicesMap;
|
||||||
};
|
};
|
||||||
|
|
||||||
let defaultDefaultValues = {
|
const defaultDefaultValues = {
|
||||||
s: 'triangle',
|
s: 'triangle',
|
||||||
gain: 1,
|
gain: 0.8,
|
||||||
postgain: 1,
|
postgain: 1,
|
||||||
density: '.03',
|
density: '.03',
|
||||||
ftype: '12db',
|
ftype: '12db',
|
||||||
@@ -150,24 +143,13 @@ let defaultDefaultValues = {
|
|||||||
delay: 0,
|
delay: 0,
|
||||||
byteBeatExpression: '0',
|
byteBeatExpression: '0',
|
||||||
delayfeedback: 0.5,
|
delayfeedback: 0.5,
|
||||||
delaysync: 3 / 16,
|
delaytime: 0.25,
|
||||||
orbit: 1,
|
orbit: 1,
|
||||||
i: 1,
|
i: 1,
|
||||||
velocity: 1,
|
velocity: 1,
|
||||||
fft: 8,
|
fft: 8,
|
||||||
};
|
};
|
||||||
|
|
||||||
const defaultDefaultDefaultValues = Object.freeze({ ...defaultDefaultValues });
|
|
||||||
|
|
||||||
export function setDefault(control, value) {
|
|
||||||
// const main = getControlName(control); // we cant do this because superdough is independent of strudel/core
|
|
||||||
defaultDefaultValues[control] = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function resetDefaults() {
|
|
||||||
defaultDefaultValues = { ...defaultDefaultDefaultValues };
|
|
||||||
}
|
|
||||||
|
|
||||||
let defaultControls = new Map(Object.entries(defaultDefaultValues));
|
let defaultControls = new Map(Object.entries(defaultDefaultValues));
|
||||||
|
|
||||||
export function setDefaultValue(key, value) {
|
export function setDefaultValue(key, value) {
|
||||||
@@ -331,40 +313,30 @@ function getDelay(orbit, delaytime, delayfeedback, t, channels) {
|
|||||||
//logger(`delayfeedback was clamped to ${maxfeedback} to save your ears`);
|
//logger(`delayfeedback was clamped to ${maxfeedback} to save your ears`);
|
||||||
}
|
}
|
||||||
delayfeedback = clamp(delayfeedback, 0, 0.98);
|
delayfeedback = clamp(delayfeedback, 0, 0.98);
|
||||||
if (!orbits[orbit].delayNode) {
|
if (!delays[orbit]) {
|
||||||
const ac = getAudioContext();
|
const ac = getAudioContext();
|
||||||
const dly = ac.createFeedbackDelay(1, delaytime, delayfeedback);
|
const dly = ac.createFeedbackDelay(1, delaytime, delayfeedback);
|
||||||
dly.start?.(t); // for some reason, this throws when audion extension is installed..
|
dly.start?.(t); // for some reason, this throws when audion extension is installed..
|
||||||
connectToOrbit(dly, orbit);
|
connectToDestination(dly, channels);
|
||||||
orbits[orbit].delayNode = dly;
|
delays[orbit] = dly;
|
||||||
}
|
}
|
||||||
orbits[orbit].delayNode.delayTime.value !== delaytime &&
|
delays[orbit].delayTime.value !== delaytime && delays[orbit].delayTime.setValueAtTime(delaytime, t);
|
||||||
orbits[orbit].delayNode.delayTime.setValueAtTime(delaytime, t);
|
delays[orbit].feedback.value !== delayfeedback && delays[orbit].feedback.setValueAtTime(delayfeedback, t);
|
||||||
orbits[orbit].delayNode.feedback.value !== delayfeedback &&
|
return delays[orbit];
|
||||||
orbits[orbit].delayNode.feedback.setValueAtTime(delayfeedback, t);
|
|
||||||
return orbits[orbit].delayNode;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getLfo(audioContext, begin, end, properties = {}) {
|
export function getLfo(audioContext, time, end, properties = {}) {
|
||||||
const { shape = 0, ...props } = properties;
|
return getWorklet(audioContext, 'lfo-processor', {
|
||||||
const { dcoffset = -0.5, depth = 1 } = properties;
|
|
||||||
const lfoprops = {
|
|
||||||
frequency: 1,
|
frequency: 1,
|
||||||
depth,
|
depth: 1,
|
||||||
skew: 0.5,
|
skew: 0,
|
||||||
phaseoffset: 0,
|
phaseoffset: 0,
|
||||||
time: begin,
|
time,
|
||||||
begin,
|
|
||||||
end,
|
end,
|
||||||
shape: getModulationShapeInput(shape),
|
shape: 1,
|
||||||
dcoffset,
|
dcoffset: -0.5,
|
||||||
min: dcoffset * depth,
|
...properties,
|
||||||
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) {
|
||||||
@@ -398,67 +370,31 @@ 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 {
|
let reverbs = {};
|
||||||
// gain: number,
|
|
||||||
// reverbNode: reverbNode
|
|
||||||
// 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 }),
|
|
||||||
};
|
|
||||||
connectToDestination(orbits[orbit].gain, channels);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function duckOrbit(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;
|
|
||||||
}
|
|
||||||
orbits[target].gain.gain.cancelAndHoldAtTime(t);
|
|
||||||
const currVal = orbits[target].gain.gain.value;
|
|
||||||
orbits[target].gain.gain.setValueAtTime(currVal, t);
|
|
||||||
orbits[target].gain.gain.linearRampToValueAtTime(clamp(1 - Math.pow(duckdepth, 0.5), 0.01, currVal), t + 0.002);
|
|
||||||
orbits[target].gain.gain.exponentialRampToValueAtTime(1, t + Math.max(0.002, attacktime));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
let hasChanged = (now, before) => now !== undefined && now !== before;
|
let hasChanged = (now, before) => now !== undefined && now !== before;
|
||||||
function getReverb(orbit, duration, fade, lp, dim, ir) {
|
function getReverb(orbit, duration, fade, lp, dim, ir, channels) {
|
||||||
// If no reverb has been created for a given orbit, create one
|
// If no reverb has been created for a given orbit, create one
|
||||||
if (!orbits[orbit].reverbNode) {
|
if (!reverbs[orbit]) {
|
||||||
const ac = getAudioContext();
|
const ac = getAudioContext();
|
||||||
const reverb = ac.createReverb(duration, fade, lp, dim, ir);
|
const reverb = ac.createReverb(duration, fade, lp, dim, ir);
|
||||||
connectToOrbit(reverb, orbit);
|
connectToDestination(reverb, channels);
|
||||||
orbits[orbit].reverbNode = reverb;
|
reverbs[orbit] = reverb;
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
hasChanged(duration, orbits[orbit].reverbNode.duration) ||
|
hasChanged(duration, reverbs[orbit].duration) ||
|
||||||
hasChanged(fade, orbits[orbit].reverbNode.fade) ||
|
hasChanged(fade, reverbs[orbit].fade) ||
|
||||||
hasChanged(lp, orbits[orbit].reverbNode.lp) ||
|
hasChanged(lp, reverbs[orbit].lp) ||
|
||||||
hasChanged(dim, orbits[orbit].reverbNode.dim) ||
|
hasChanged(dim, reverbs[orbit].dim) ||
|
||||||
orbits[orbit].reverbNode.ir !== ir
|
reverbs[orbit].ir !== ir
|
||||||
) {
|
) {
|
||||||
// only regenerate when something has changed
|
// only regenerate when something has changed
|
||||||
// avoids endless regeneration on things like
|
// avoids endless regeneration on things like
|
||||||
// stack(s("a"), s("b").rsize(8)).room(.5)
|
// stack(s("a"), s("b").rsize(8)).room(.5)
|
||||||
// this only works when args may stay undefined until here
|
// this only works when args may stay undefined until here
|
||||||
// setting default values breaks this
|
// setting default values breaks this
|
||||||
orbits[orbit].reverbNode.generate(duration, fade, lp, dim, ir);
|
reverbs[orbit].generate(duration, fade, lp, dim, ir);
|
||||||
}
|
}
|
||||||
return orbits[orbit].reverbNode;
|
return reverbs[orbit];
|
||||||
}
|
}
|
||||||
|
|
||||||
export let analysers = {},
|
export let analysers = {},
|
||||||
@@ -501,7 +437,8 @@ function effectSend(input, effect, wet) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function resetGlobalEffects() {
|
export function resetGlobalEffects() {
|
||||||
orbits = {};
|
delays = {};
|
||||||
|
reverbs = {};
|
||||||
analysers = {};
|
analysers = {};
|
||||||
analysersData = {};
|
analysersData = {};
|
||||||
}
|
}
|
||||||
@@ -513,10 +450,9 @@ function mapChannelNumbers(channels) {
|
|||||||
return (Array.isArray(channels) ? channels : [channels]).map((ch) => ch - 1);
|
return (Array.isArray(channels) ? channels : [channels]).map((ch) => ch - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
export const superdough = async (value, t, hapDuration, cps = 0.5, cycle = 0.5) => {
|
export const superdough = async (value, t, hapDuration, cps) => {
|
||||||
// new: t is always expected to be the absolute target onset time
|
|
||||||
const ac = getAudioContext();
|
const ac = getAudioContext();
|
||||||
|
t = typeof t === 'string' && t.startsWith('=') ? Number(t.slice(1)) : ac.currentTime + t;
|
||||||
let { stretch } = value;
|
let { stretch } = value;
|
||||||
if (stretch != null) {
|
if (stretch != null) {
|
||||||
//account for phase vocoder latency
|
//account for phase vocoder latency
|
||||||
@@ -542,26 +478,15 @@ export const superdough = async (value, t, hapDuration, cps = 0.5, cycle = 0.5)
|
|||||||
}
|
}
|
||||||
// destructure
|
// destructure
|
||||||
let {
|
let {
|
||||||
tremolo,
|
|
||||||
tremolosync,
|
|
||||||
tremolodepth = 1,
|
|
||||||
tremoloskew,
|
|
||||||
tremolophase = 0,
|
|
||||||
tremoloshape,
|
|
||||||
s = getDefaultValue('s'),
|
s = getDefaultValue('s'),
|
||||||
bank,
|
bank,
|
||||||
source,
|
source,
|
||||||
gain = getDefaultValue('gain'),
|
gain = getDefaultValue('gain'),
|
||||||
gainlinear,
|
|
||||||
postgain = getDefaultValue('postgain'),
|
postgain = getDefaultValue('postgain'),
|
||||||
density = getDefaultValue('density'),
|
density = getDefaultValue('density'),
|
||||||
duckorbit,
|
|
||||||
duckattack,
|
|
||||||
duckdepth,
|
|
||||||
// filters
|
// filters
|
||||||
fanchor = getDefaultValue('fanchor'),
|
fanchor = getDefaultValue('fanchor'),
|
||||||
drive = 0.69,
|
drive = 0.69,
|
||||||
release = 0,
|
|
||||||
// low pass
|
// low pass
|
||||||
cutoff,
|
cutoff,
|
||||||
lpenv,
|
lpenv,
|
||||||
@@ -594,9 +519,7 @@ export const superdough = async (value, t, hapDuration, cps = 0.5, cycle = 0.5)
|
|||||||
phasercenter,
|
phasercenter,
|
||||||
//
|
//
|
||||||
coarse,
|
coarse,
|
||||||
|
|
||||||
crush,
|
crush,
|
||||||
dry,
|
|
||||||
shape,
|
shape,
|
||||||
shapevol = getDefaultValue('shapevol'),
|
shapevol = getDefaultValue('shapevol'),
|
||||||
distort,
|
distort,
|
||||||
@@ -605,8 +528,7 @@ export const superdough = async (value, t, hapDuration, cps = 0.5, cycle = 0.5)
|
|||||||
vowel,
|
vowel,
|
||||||
delay = getDefaultValue('delay'),
|
delay = getDefaultValue('delay'),
|
||||||
delayfeedback = getDefaultValue('delayfeedback'),
|
delayfeedback = getDefaultValue('delayfeedback'),
|
||||||
delaysync = getDefaultValue('delaysync'),
|
delaytime = getDefaultValue('delaytime'),
|
||||||
delaytime,
|
|
||||||
orbit = getDefaultValue('orbit'),
|
orbit = getDefaultValue('orbit'),
|
||||||
room,
|
room,
|
||||||
roomfade,
|
roomfade,
|
||||||
@@ -625,19 +547,10 @@ export const superdough = async (value, t, hapDuration, cps = 0.5, cycle = 0.5)
|
|||||||
compressorRelease,
|
compressorRelease,
|
||||||
} = value;
|
} = value;
|
||||||
|
|
||||||
delaytime = delaytime ?? cycleToSeconds(delaysync, cps);
|
|
||||||
|
|
||||||
const orbitChannels = mapChannelNumbers(
|
const orbitChannels = mapChannelNumbers(
|
||||||
multiChannelOrbits && orbit > 0 ? [orbit * 2 - 1, orbit * 2] : getDefaultValue('channels'),
|
multiChannelOrbits && orbit > 0 ? [orbit * 2 - 1, orbit * 2] : getDefaultValue('channels'),
|
||||||
);
|
);
|
||||||
|
|
||||||
const channels = value.channels != null ? mapChannelNumbers(value.channels) : orbitChannels;
|
const channels = value.channels != null ? mapChannelNumbers(value.channels) : orbitChannels;
|
||||||
setOrbit(ac, orbit, channels, t, cycle, cps);
|
|
||||||
|
|
||||||
|
|
||||||
if (duckorbit != null) {
|
|
||||||
duckOrbit(duckorbit, t, duckattack, duckdepth);
|
|
||||||
}
|
|
||||||
|
|
||||||
gain = applyGainCurve(nanFallback(gain, 1));
|
gain = applyGainCurve(nanFallback(gain, 1));
|
||||||
postgain = applyGainCurve(postgain);
|
postgain = applyGainCurve(postgain);
|
||||||
@@ -645,14 +558,8 @@ export const superdough = async (value, t, hapDuration, cps = 0.5, cycle = 0.5)
|
|||||||
distortvol = applyGainCurve(distortvol);
|
distortvol = applyGainCurve(distortvol);
|
||||||
delay = applyGainCurve(delay);
|
delay = applyGainCurve(delay);
|
||||||
velocity = applyGainCurve(velocity);
|
velocity = applyGainCurve(velocity);
|
||||||
tremolodepth = applyGainCurve(tremolodepth);
|
|
||||||
gain *= velocity; // velocity currently only multiplies with gain. it might do other things in the future
|
gain *= velocity; // velocity currently only multiplies with gain. it might do other things in the future
|
||||||
if (gainlinear != null) {
|
|
||||||
gain *= gainlinear;
|
|
||||||
}
|
|
||||||
|
|
||||||
const end = t + hapDuration;
|
|
||||||
const endWithRelease = end + release;
|
|
||||||
const chainID = Math.round(Math.random() * 1000000);
|
const chainID = Math.round(Math.random() * 1000000);
|
||||||
|
|
||||||
// oldest audio nodes will be destroyed if maximum polyphony is exceeded
|
// oldest audio nodes will be destroyed if maximum polyphony is exceeded
|
||||||
@@ -705,7 +612,7 @@ export const superdough = async (value, t, hapDuration, cps = 0.5, cycle = 0.5)
|
|||||||
logger('[webaudio] skip hap: still loading', ac.currentTime - t);
|
logger('[webaudio] skip hap: still loading', ac.currentTime - t);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let chain = []; // audio nodes that will be connected to each other sequentially
|
const chain = []; // audio nodes that will be connected to each other sequentially
|
||||||
chain.push(sourceNode);
|
chain.push(sourceNode);
|
||||||
stretch !== undefined && chain.push(getWorklet(ac, 'phase-vocoder-processor', { pitchFactor: stretch }));
|
stretch !== undefined && chain.push(getWorklet(ac, 'phase-vocoder-processor', { pitchFactor: stretch }));
|
||||||
|
|
||||||
@@ -727,7 +634,7 @@ export const superdough = async (value, t, hapDuration, cps = 0.5, cycle = 0.5)
|
|||||||
lprelease,
|
lprelease,
|
||||||
lpenv,
|
lpenv,
|
||||||
t,
|
t,
|
||||||
end,
|
t + hapDuration,
|
||||||
fanchor,
|
fanchor,
|
||||||
ftype,
|
ftype,
|
||||||
drive,
|
drive,
|
||||||
@@ -751,7 +658,7 @@ export const superdough = async (value, t, hapDuration, cps = 0.5, cycle = 0.5)
|
|||||||
hprelease,
|
hprelease,
|
||||||
hpenv,
|
hpenv,
|
||||||
t,
|
t,
|
||||||
end,
|
t + hapDuration,
|
||||||
fanchor,
|
fanchor,
|
||||||
);
|
);
|
||||||
chain.push(hp());
|
chain.push(hp());
|
||||||
@@ -762,7 +669,20 @@ export const superdough = async (value, t, hapDuration, cps = 0.5, cycle = 0.5)
|
|||||||
|
|
||||||
if (bandf !== undefined) {
|
if (bandf !== undefined) {
|
||||||
let bp = () =>
|
let bp = () =>
|
||||||
createFilter(ac, 'bandpass', bandf, bandq, bpattack, bpdecay, bpsustain, bprelease, bpenv, t, end, fanchor);
|
createFilter(
|
||||||
|
ac,
|
||||||
|
'bandpass',
|
||||||
|
bandf,
|
||||||
|
bandq,
|
||||||
|
bpattack,
|
||||||
|
bpdecay,
|
||||||
|
bpsustain,
|
||||||
|
bprelease,
|
||||||
|
bpenv,
|
||||||
|
t,
|
||||||
|
t + hapDuration,
|
||||||
|
fanchor,
|
||||||
|
);
|
||||||
chain.push(bp());
|
chain.push(bp());
|
||||||
if (ftype === '24db') {
|
if (ftype === '24db') {
|
||||||
chain.push(bp());
|
chain.push(bp());
|
||||||
@@ -780,33 +700,6 @@ export const superdough = async (value, t, hapDuration, cps = 0.5, cycle = 0.5)
|
|||||||
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(getWorklet(ac, 'distort-processor', { distort, postgain: distortvol }));
|
distort !== undefined && chain.push(getWorklet(ac, 'distort-processor', { distort, postgain: distortvol }));
|
||||||
|
|
||||||
if (tremolosync != null) {
|
|
||||||
tremolo = cps * tremolosync;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tremolo !== undefined) {
|
|
||||||
// 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
|
|
||||||
const gain = Math.max(1 - tremolodepth, 0);
|
|
||||||
const amGain = new GainNode(ac, { gain });
|
|
||||||
|
|
||||||
const time = cycle / cps;
|
|
||||||
const lfo = getLfo(ac, t, endWithRelease, {
|
|
||||||
skew: tremoloskew ?? (tremoloshape != null ? 0.5 : 1),
|
|
||||||
frequency: tremolo,
|
|
||||||
depth: tremolodepth,
|
|
||||||
time,
|
|
||||||
dcoffset: 0,
|
|
||||||
shape: tremoloshape,
|
|
||||||
phaseoffset: tremolophase,
|
|
||||||
min: 0,
|
|
||||||
max: 1,
|
|
||||||
curve: 1.5,
|
|
||||||
});
|
|
||||||
lfo.connect(amGain.gain);
|
|
||||||
chain.push(amGain);
|
|
||||||
}
|
|
||||||
|
|
||||||
compressorThreshold !== undefined &&
|
compressorThreshold !== undefined &&
|
||||||
chain.push(
|
chain.push(
|
||||||
getCompressor(ac, compressorThreshold, compressorRatio, compressorKnee, compressorAttack, compressorRelease),
|
getCompressor(ac, compressorThreshold, compressorRatio, compressorKnee, compressorAttack, compressorRelease),
|
||||||
@@ -820,19 +713,20 @@ export const superdough = async (value, t, hapDuration, cps = 0.5, cycle = 0.5)
|
|||||||
}
|
}
|
||||||
// phaser
|
// phaser
|
||||||
if (phaser !== undefined && phaserdepth > 0) {
|
if (phaser !== undefined && phaserdepth > 0) {
|
||||||
const phaserFX = getPhaser(t, endWithRelease, phaser, phaserdepth, phasercenter, phasersweep);
|
const phaserFX = getPhaser(t, t + hapDuration, phaser, phaserdepth, phasercenter, phasersweep);
|
||||||
chain.push(phaserFX);
|
chain.push(phaserFX);
|
||||||
}
|
}
|
||||||
|
|
||||||
// last gain
|
// last gain
|
||||||
const post = new GainNode(ac, { gain: postgain });
|
const post = new GainNode(ac, { gain: postgain });
|
||||||
chain.push(post);
|
chain.push(post);
|
||||||
|
connectToDestination(post, channels);
|
||||||
|
|
||||||
// delay
|
// delay
|
||||||
let delaySend;
|
let delaySend;
|
||||||
if (delay > 0 && delaytime > 0 && delayfeedback > 0) {
|
if (delay > 0 && delaytime > 0 && delayfeedback > 0) {
|
||||||
const delayNode = getDelay(orbit, delaytime, delayfeedback, t, orbitChannels);
|
const delyNode = getDelay(orbit, delaytime, delayfeedback, t, orbitChannels);
|
||||||
delaySend = effectSend(post, delayNode, delay);
|
delaySend = effectSend(post, delyNode, delay);
|
||||||
audioNodes.push(delaySend);
|
audioNodes.push(delaySend);
|
||||||
}
|
}
|
||||||
// reverb
|
// reverb
|
||||||
@@ -861,14 +755,6 @@ export const superdough = async (value, t, hapDuration, cps = 0.5, cycle = 0.5)
|
|||||||
analyserSend = effectSend(post, analyserNode, 1);
|
analyserSend = effectSend(post, analyserNode, 1);
|
||||||
audioNodes.push(analyserSend);
|
audioNodes.push(analyserSend);
|
||||||
}
|
}
|
||||||
if (dry != null) {
|
|
||||||
dry = applyGainCurve(dry);
|
|
||||||
const dryGain = new GainNode(ac, { gain: dry });
|
|
||||||
chain.push(dryGain);
|
|
||||||
connectToOrbit(dryGain, orbit);
|
|
||||||
} else {
|
|
||||||
connectToOrbit(post, orbit);
|
|
||||||
}
|
|
||||||
|
|
||||||
// connect chain elements together
|
// connect chain elements together
|
||||||
chain.slice(1).reduce((last, current) => last.connect(current), chain[0]);
|
chain.slice(1).reduce((last, current) => last.connect(current), chain[0]);
|
||||||
|
|||||||
@@ -9,13 +9,12 @@ import {
|
|||||||
getVibratoOscillator,
|
getVibratoOscillator,
|
||||||
webAudioTimeout,
|
webAudioTimeout,
|
||||||
getWorklet,
|
getWorklet,
|
||||||
noises,
|
|
||||||
} from './helpers.mjs';
|
} from './helpers.mjs';
|
||||||
import { getNoiseMix, getNoiseOscillator } from './noise.mjs';
|
import { getNoiseMix, getNoiseOscillator } from './noise.mjs';
|
||||||
|
|
||||||
const getFrequencyFromValue = (value, defaultNote = 36) => {
|
const getFrequencyFromValue = (value) => {
|
||||||
let { note, freq } = value;
|
let { note, freq } = value;
|
||||||
note = note || defaultNote;
|
note = note || 36;
|
||||||
if (typeof note === 'string') {
|
if (typeof note === 'string') {
|
||||||
note = noteToMidi(note); // e.g. c3 => 48
|
note = noteToMidi(note); // e.g. c3 => 48
|
||||||
}
|
}
|
||||||
@@ -41,17 +40,7 @@ const waveformAliases = [
|
|||||||
['saw', 'sawtooth'],
|
['saw', 'sawtooth'],
|
||||||
['sin', 'sine'],
|
['sin', 'sine'],
|
||||||
];
|
];
|
||||||
|
const noises = ['pink', 'white', 'brown', 'crackle'];
|
||||||
function makeSaturationCurve(amount, n_samples) {
|
|
||||||
const k = typeof amount === 'number' ? amount : 50;
|
|
||||||
const curve = new Float32Array(n_samples);
|
|
||||||
|
|
||||||
for (let i = 0; i < n_samples; i++) {
|
|
||||||
const x = (i * 2) / n_samples - 1;
|
|
||||||
curve[i] = Math.tanh(x * k);
|
|
||||||
}
|
|
||||||
return curve;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function registerSynthSounds() {
|
export function registerSynthSounds() {
|
||||||
[...waveforms].forEach((s) => {
|
[...waveforms].forEach((s) => {
|
||||||
@@ -95,75 +84,6 @@ export function registerSynthSounds() {
|
|||||||
{ type: 'synth', prebake: true },
|
{ type: 'synth', prebake: true },
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
registerSound(
|
|
||||||
'sbd',
|
|
||||||
(t, value, onended) => {
|
|
||||||
const { duration, decay = 0.5, pdecay = 0.5, penv = 36, clip } = value;
|
|
||||||
const ctx = getAudioContext();
|
|
||||||
const attackhold = 0.02;
|
|
||||||
const noiselvl = 1.2;
|
|
||||||
const noisedecay = 0.025;
|
|
||||||
const mixGain = 1;
|
|
||||||
|
|
||||||
const o = ctx.createOscillator();
|
|
||||||
o.type = 'triangle';
|
|
||||||
o.frequency.value = getFrequencyFromValue(value, 29);
|
|
||||||
o.detune.setValueAtTime(penv * 100, 0);
|
|
||||||
o.detune.setValueAtTime(penv * 100, t);
|
|
||||||
o.detune.exponentialRampToValueAtTime(0.001, t + pdecay);
|
|
||||||
const g = gainNode(1);
|
|
||||||
g.gain.setValueAtTime(1, t + attackhold);
|
|
||||||
g.gain.exponentialRampToValueAtTime(0.001, t + attackhold + decay);
|
|
||||||
o.start(t);
|
|
||||||
|
|
||||||
const noise = getNoiseOscillator('brown', t, 2);
|
|
||||||
const noiseGain = gainNode(1);
|
|
||||||
noiseGain.gain.setValueAtTime(noiselvl, t);
|
|
||||||
noiseGain.gain.exponentialRampToValueAtTime(0.001, t + noisedecay);
|
|
||||||
|
|
||||||
const sat = new WaveShaperNode(ctx);
|
|
||||||
// tri to sine diode shaper emulation
|
|
||||||
sat.curve = makeSaturationCurve(2, ctx.sampleRate);
|
|
||||||
|
|
||||||
const mix = gainNode(mixGain);
|
|
||||||
|
|
||||||
o.onended = () => {
|
|
||||||
o.disconnect();
|
|
||||||
g.disconnect();
|
|
||||||
sat.disconnect();
|
|
||||||
noise.node.disconnect();
|
|
||||||
noiseGain.disconnect();
|
|
||||||
mix.disconnect();
|
|
||||||
onended();
|
|
||||||
};
|
|
||||||
|
|
||||||
const node = o.connect(sat).connect(g).connect(mix);
|
|
||||||
noise.node.connect(noiseGain).connect(mix);
|
|
||||||
|
|
||||||
const holdEnd = t + decay;
|
|
||||||
let end = holdEnd + 0.01;
|
|
||||||
if (clip != null) {
|
|
||||||
end = Math.min(t + clip * duration, end);
|
|
||||||
}
|
|
||||||
|
|
||||||
// prevent clicking
|
|
||||||
mix.gain.setValueAtTime(mixGain, end - 0.01);
|
|
||||||
mix.gain.linearRampToValueAtTime(0, end);
|
|
||||||
|
|
||||||
o.stop(end);
|
|
||||||
noise.stop(end);
|
|
||||||
|
|
||||||
return {
|
|
||||||
node,
|
|
||||||
stop: (endTime) => {
|
|
||||||
o.stop(endTime);
|
|
||||||
},
|
|
||||||
};
|
|
||||||
},
|
|
||||||
{ type: 'synth', prebake: true },
|
|
||||||
);
|
|
||||||
|
|
||||||
registerSound(
|
registerSound(
|
||||||
'supersaw',
|
'supersaw',
|
||||||
(begin, value, onended) => {
|
(begin, value, onended) => {
|
||||||
@@ -201,10 +121,7 @@ export function registerSynthSounds() {
|
|||||||
const gainAdjustment = 1 / Math.sqrt(voices);
|
const gainAdjustment = 1 / Math.sqrt(voices);
|
||||||
getPitchEnvelope(o.parameters.get('detune'), value, begin, holdend);
|
getPitchEnvelope(o.parameters.get('detune'), value, begin, holdend);
|
||||||
const vibratoOscillator = getVibratoOscillator(o.parameters.get('detune'), value, begin);
|
const vibratoOscillator = getVibratoOscillator(o.parameters.get('detune'), value, begin);
|
||||||
// const fm = applyFM(o.parameters.get('frequency'), value, begin);
|
const fm = applyFM(o.parameters.get('frequency'), value, begin);
|
||||||
// https://codeberg.org/uzu/strudel/issues/1428
|
|
||||||
// if you think about re-enabling this, please test with fm > 1 first
|
|
||||||
// it's like 10x gain, so it's really dangerous
|
|
||||||
let envGain = gainNode(1);
|
let envGain = gainNode(1);
|
||||||
envGain = o.connect(envGain);
|
envGain = o.connect(envGain);
|
||||||
|
|
||||||
@@ -216,7 +133,7 @@ export function registerSynthSounds() {
|
|||||||
destroyAudioWorkletNode(o);
|
destroyAudioWorkletNode(o);
|
||||||
envGain.disconnect();
|
envGain.disconnect();
|
||||||
onended();
|
onended();
|
||||||
// fm?.stop();
|
fm?.stop();
|
||||||
vibratoOscillator?.stop();
|
vibratoOscillator?.stop();
|
||||||
},
|
},
|
||||||
begin,
|
begin,
|
||||||
|
|||||||
@@ -68,11 +68,3 @@ export const _mod = (n, m) => ((n % m) + m) % m;
|
|||||||
export const getSoundIndex = (n, numSounds) => {
|
export const getSoundIndex = (n, numSounds) => {
|
||||||
return _mod(Math.round(nanFallback(n, 0)), numSounds);
|
return _mod(Math.round(nanFallback(n, 0)), numSounds);
|
||||||
};
|
};
|
||||||
|
|
||||||
export function cycleToSeconds(cycle, cps) {
|
|
||||||
return cycle / cps;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function secondsToCycle(t, cps) {
|
|
||||||
return t * cps;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ function polyBlep(phase, dt) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// The order is important for dough integration
|
|
||||||
const waveshapes = {
|
const waveshapes = {
|
||||||
tri(phase, skew = 0.5) {
|
tri(phase, skew = 0.5) {
|
||||||
const x = 1 - skew;
|
const x = 1 - skew;
|
||||||
@@ -81,12 +81,10 @@ function getParamValue(block, param) {
|
|||||||
}
|
}
|
||||||
return param[0];
|
return param[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
const waveShapeNames = Object.keys(waveshapes);
|
const waveShapeNames = Object.keys(waveshapes);
|
||||||
class LFOProcessor extends AudioWorkletProcessor {
|
class LFOProcessor extends AudioWorkletProcessor {
|
||||||
static get parameterDescriptors() {
|
static get parameterDescriptors() {
|
||||||
return [
|
return [
|
||||||
{ name: 'begin', defaultValue: 0 },
|
|
||||||
{ name: 'time', defaultValue: 0 },
|
{ name: 'time', defaultValue: 0 },
|
||||||
{ name: 'end', defaultValue: 0 },
|
{ name: 'end', defaultValue: 0 },
|
||||||
{ name: 'frequency', defaultValue: 0.5 },
|
{ name: 'frequency', defaultValue: 0.5 },
|
||||||
@@ -94,10 +92,7 @@ class LFOProcessor extends AudioWorkletProcessor {
|
|||||||
{ name: 'depth', defaultValue: 1 },
|
{ name: 'depth', defaultValue: 1 },
|
||||||
{ name: 'phaseoffset', defaultValue: 0 },
|
{ name: 'phaseoffset', defaultValue: 0 },
|
||||||
{ name: 'shape', defaultValue: 0 },
|
{ name: 'shape', defaultValue: 0 },
|
||||||
{ name: 'curve', defaultValue: 1 },
|
|
||||||
{ name: 'dcoffset', defaultValue: 0 },
|
{ name: 'dcoffset', defaultValue: 0 },
|
||||||
{ name: 'min', defaultValue: 0 },
|
|
||||||
{ name: 'max', defaultValue: 1 },
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,14 +109,10 @@ class LFOProcessor extends AudioWorkletProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
process(inputs, outputs, parameters) {
|
process(inputs, outputs, parameters) {
|
||||||
const begin = parameters['begin'][0];
|
|
||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
if (currentTime >= parameters.end[0]) {
|
if (currentTime >= parameters.end[0]) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (currentTime <= begin) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
const output = outputs[0];
|
const output = outputs[0];
|
||||||
const frequency = parameters['frequency'][0];
|
const frequency = parameters['frequency'][0];
|
||||||
@@ -131,11 +122,7 @@ class LFOProcessor extends AudioWorkletProcessor {
|
|||||||
const skew = parameters['skew'][0];
|
const skew = parameters['skew'][0];
|
||||||
const phaseoffset = parameters['phaseoffset'][0];
|
const phaseoffset = parameters['phaseoffset'][0];
|
||||||
|
|
||||||
const curve = parameters['curve'][0];
|
|
||||||
|
|
||||||
const dcoffset = parameters['dcoffset'][0];
|
const dcoffset = parameters['dcoffset'][0];
|
||||||
const min = parameters['min'][0];
|
|
||||||
const max = parameters['max'][0];
|
|
||||||
const shape = waveShapeNames[parameters['shape'][0]];
|
const shape = waveShapeNames[parameters['shape'][0]];
|
||||||
|
|
||||||
const blockSize = output[0].length ?? 0;
|
const blockSize = output[0].length ?? 0;
|
||||||
@@ -147,9 +134,8 @@ class LFOProcessor extends AudioWorkletProcessor {
|
|||||||
const dt = frequency / sampleRate;
|
const dt = frequency / sampleRate;
|
||||||
for (let n = 0; n < blockSize; n++) {
|
for (let n = 0; n < blockSize; n++) {
|
||||||
for (let i = 0; i < output.length; i++) {
|
for (let i = 0; i < output.length; i++) {
|
||||||
let modval = (waveshapes[shape](this.phase, skew) + dcoffset) * depth;
|
const modval = (waveshapes[shape](this.phase, skew) + dcoffset) * depth;
|
||||||
modval = Math.pow(modval, curve);
|
output[i][n] = modval;
|
||||||
output[i][n] = clamp(modval, min, max);
|
|
||||||
}
|
}
|
||||||
this.incrementPhase(dt);
|
this.incrementPhase(dt);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,10 +15,13 @@ const hap2value = (hap) => {
|
|||||||
return hap.value;
|
return hap.value;
|
||||||
};
|
};
|
||||||
|
|
||||||
// uses more precise, absolute t if available, see https://github.com/tidalcycles/strudel/pull/1004
|
export const webaudioOutputTrigger = (t, hap, ct, cps) => superdough(hap2value(hap), t - ct, hap.duration / cps, cps);
|
||||||
// TODO: refactor output callbacks to eliminate deadline
|
// uses more precise, absolute t if available, see https://codeberg.org/uzu/strudel/pulls/1004
|
||||||
export const webaudioOutput = (hap, _deadline, hapDuration, cps, t) => {
|
export const webaudioOutput = (hap, deadline, hapDuration, cps, t) =>
|
||||||
return superdough(hap2value(hap), t, hapDuration, cps, hap.whole?.begin.valueOf());
|
superdough(hap2value(hap), t ? `=${t}` : deadline, hapDuration);
|
||||||
|
|
||||||
|
Pattern.prototype.webaudio = function () {
|
||||||
|
return this.onTrigger(webaudioOutputTrigger);
|
||||||
};
|
};
|
||||||
|
|
||||||
export function webaudioRepl(options = {}) {
|
export function webaudioRepl(options = {}) {
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -359,6 +359,28 @@ stack(
|
|||||||
"[~ [0 ~]] 0 [~ [4 ~]] 4".sub(7).restart(scales).scale(scales).early(.25)
|
"[~ [0 ~]] 0 [~ [4 ~]] 4".sub(7).restart(scales).scale(scales).early(.25)
|
||||||
).note().piano().slow(2)`;
|
).note().piano().slow(2)`;
|
||||||
|
|
||||||
|
/*
|
||||||
|
export const customTrigger = `// licensed with CC BY-NC-SA 4.0 https://creativecommons.org/licenses/by-nc-sa/4.0/
|
||||||
|
// by Felix Roos
|
||||||
|
stack(
|
||||||
|
freq("55 [110,165] 110 [220,275]".mul("<1 <3/4 2/3>>").struct("x(3,8)").layer(x=>x.mul("1.006,.995"))),
|
||||||
|
freq("440(5,8)".clip(.18).mul("<1 3/4 2 2/3>")).gain(perlin.range(.2,.8))
|
||||||
|
).s("<sawtooth square>/2")
|
||||||
|
.onTrigger((t,hap,ct)=>{
|
||||||
|
const ac = Tone.getContext().rawContext;
|
||||||
|
t = ac.currentTime + t - ct;
|
||||||
|
const { freq, s, gain = 1 } = hap.value;
|
||||||
|
const master = ac.createGain();
|
||||||
|
master.gain.value = 0.1 * gain;
|
||||||
|
master.connect(ac.destination);
|
||||||
|
const o = ac.createOscillator();
|
||||||
|
o.type = s || 'triangle';
|
||||||
|
o.frequency.value = Number(freq);
|
||||||
|
o.connect(master);
|
||||||
|
o.start(t);
|
||||||
|
o.stop(t + hap.duration);
|
||||||
|
}).stack(s("bd(3,8),hh*4,~ sd").webdirt())`; */
|
||||||
|
|
||||||
export const swimmingWithSoundfonts = `// Koji Kondo - Swimming (Super Mario World)
|
export const swimmingWithSoundfonts = `// Koji Kondo - Swimming (Super Mario World)
|
||||||
stack(
|
stack(
|
||||||
n(
|
n(
|
||||||
|
|||||||
@@ -647,6 +647,7 @@
|
|||||||
"evaluate"
|
"evaluate"
|
||||||
],
|
],
|
||||||
"/packages/webaudio/webaudio.mjs": [
|
"/packages/webaudio/webaudio.mjs": [
|
||||||
|
"webaudioOutputTrigger",
|
||||||
"webaudioOutput",
|
"webaudioOutput",
|
||||||
"webaudioRepl"
|
"webaudioRepl"
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"_base": "https://raw.githubusercontent.com/ritchse/tidal-drum-machines/main/machines/EmuSP12/",
|
||||||
|
"bd": ["emusp12-bd/Bassdrum-01.wav","emusp12-bd/Bassdrum-02.wav","emusp12-bd/Bassdrum-03.wav","emusp12-bd/Bassdrum-04.wav","emusp12-bd/Bassdrum-05.wav","emusp12-bd/Bassdrum-06.wav","emusp12-bd/Bassdrum-07.wav","emusp12-bd/Bassdrum-08.wav","emusp12-bd/Bassdrum-09.wav","emusp12-bd/Bassdrum-10.wav","emusp12-bd/Bassdrum-11.wav","emusp12-bd/Bassdrum-12.wav","emusp12-bd/Bassdrum-13.wav","emusp12-bd/Bassdrum-14.wav"],
|
||||||
|
"cb": ["emusp12-cb/Cowbell.wav"],
|
||||||
|
"cp": ["emusp12-cp/Clap.wav"],
|
||||||
|
"cr": ["emusp12-cr/Crash.wav"],
|
||||||
|
"hh": ["emusp12-hh/Hat Closed-01.wav","emusp12-hh/Hat Closed-02.wav"],
|
||||||
|
"ht": ["emusp12-ht/Tom H-01.wav","emusp12-ht/Tom H-02.wav","emusp12-ht/Tom H-03.wav","emusp12-ht/Tom H-04.wav","emusp12-ht/Tom H-05.wav","emusp12-ht/Tom H-06.wav"],
|
||||||
|
"lt": ["emusp12-lt/Tom L-01.wav","emusp12-lt/Tom L-02.wav","emusp12-lt/Tom L-03.wav","emusp12-lt/Tom L-04.wav","emusp12-lt/Tom L-05.wav","emusp12-lt/Tom L-06.wav"],
|
||||||
|
"misc": ["emusp12-misc/Metal-01.wav","emusp12-misc/Metal-02.wav","emusp12-misc/Metal-03.wav","emusp12-misc/Scratch.wav","emusp12-misc/Shot-01.wav","emusp12-misc/Shot-02.wav","emusp12-misc/Shot-03.wav"],
|
||||||
|
"mt": ["emusp12-mt/Tom M-01.wav","emusp12-mt/Tom M-02.wav","emusp12-mt/Tom M-03.wav","emusp12-mt/Tom M-05.wav"],
|
||||||
|
"oh": ["emusp12-oh/Hhopen1.wav"],
|
||||||
|
"perc": ["emusp12-perc/Blow1.wav"],
|
||||||
|
"rd": ["emusp12-rd/Ride.wav"],
|
||||||
|
"rim": ["emusp12-rim/zRim Shot-01.wav","emusp12-rim/zRim Shot-02.wav"],
|
||||||
|
"sd": ["emusp12-sd/Snaredrum-01.wav","emusp12-sd/Snaredrum-02.wav","emusp12-sd/Snaredrum-03.wav","emusp12-sd/Snaredrum-04.wav","emusp12-sd/Snaredrum-05.wav","emusp12-sd/Snaredrum-06.wav","emusp12-sd/Snaredrum-07.wav","emusp12-sd/Snaredrum-08.wav","emusp12-sd/Snaredrum-09.wav","emusp12-sd/Snaredrum-10.wav","emusp12-sd/Snaredrum-11.wav","emusp12-sd/Snaredrum-12.wav","emusp12-sd/Snaredrum-13.wav","emusp12-sd/Snaredrum-14.wav","emusp12-sd/Snaredrum-15.wav","emusp12-sd/Snaredrum-16.wav","emusp12-sd/Snaredrum-17.wav","emusp12-sd/Snaredrum-18.wav","emusp12-sd/Snaredrum-19.wav","emusp12-sd/Snaredrum-20.wav","emusp12-sd/Snaredrum-21.wav"]
|
||||||
|
}
|
||||||
@@ -1,317 +0,0 @@
|
|||||||
---
|
|
||||||
title: 'Release Notes v1.1.0'
|
|
||||||
description: ''
|
|
||||||
date: '2024-06-02'
|
|
||||||
tags: ['meta']
|
|
||||||
author: froos
|
|
||||||
---
|
|
||||||
|
|
||||||
These are the release notes for Strudel 1.1.0 aka "Bananensplit".
|
|
||||||
|
|
||||||
The last release was over 19 weeks ago, so a lot of things have happened!
|
|
||||||
|
|
||||||
First, here's a little demo, teasing some of the new features:
|
|
||||||
|
|
||||||
import { Youtube } from '@src/components/Youtube';
|
|
||||||
|
|
||||||
<Youtube client:only="react" id="2Qu5lMHruio" />
|
|
||||||
|
|
||||||
Let's write up some of the highlights:
|
|
||||||
|
|
||||||
## New DSP Features
|
|
||||||
|
|
||||||
### Stereo Supersaw
|
|
||||||
|
|
||||||
with spread, unison, and detune parameters
|
|
||||||
|
|
||||||
```plaintext
|
|
||||||
note("d f a a# a d3").fast(2)
|
|
||||||
.s("supersaw").spread(".8").detune(.3).unison("2 7")
|
|
||||||
```
|
|
||||||
|
|
||||||
### Analog "ladder" filter type
|
|
||||||
|
|
||||||
works great for acid basslines and vibey tones
|
|
||||||
|
|
||||||
```plaintext
|
|
||||||
note("{d d d a a# d3 f4}%16".sub(12)).gain(1).s("sawtooth")
|
|
||||||
.lpf(200).lpenv(slider(1.36,0,8)).lpq(7).distort("1.5:.7")`
|
|
||||||
.ftype('ladder')
|
|
||||||
```
|
|
||||||
|
|
||||||
### stereo distortion effect
|
|
||||||
|
|
||||||
```plaintext
|
|
||||||
note("{g g a# g g4}%8".add("{0 7 12 0}%8")).lpf(500)
|
|
||||||
.s("supersaw").dist("4:.2")
|
|
||||||
```
|
|
||||||
|
|
||||||
## Editor Features
|
|
||||||
|
|
||||||
### inline viz
|
|
||||||
|
|
||||||
The editor now supports multiple visuals within the code, using the `_` prefix for viz functions:
|
|
||||||
|
|
||||||
<img
|
|
||||||
width="595"
|
|
||||||
alt="Screenshot 2024-06-01 at 01 23 51"
|
|
||||||
src="https://codeberg.org/uzu/strudel/assets/12023032/978fee85-e533-4da6-a245-d20d0083f57e"
|
|
||||||
/>
|
|
||||||
|
|
||||||
- `._pianoroll()`: inline pianoroll
|
|
||||||
- `._punchcard()`: inline punchcard
|
|
||||||
- `._scope()`: inline scope
|
|
||||||
- `._pitchwheel()`: inline pitchwheel
|
|
||||||
|
|
||||||
For more info, check out the new [Visual Feedback Page](https://strudel.cc/learn/visual-feedback/)
|
|
||||||
|
|
||||||
### label notation
|
|
||||||
|
|
||||||
This new notation simplifies writing patterns at the top level:
|
|
||||||
|
|
||||||
```plaintext
|
|
||||||
d1: s("bd*4")
|
|
||||||
d2: s("[- hh]*4")
|
|
||||||
```
|
|
||||||
|
|
||||||
This is equivalent to:
|
|
||||||
|
|
||||||
```plaintext
|
|
||||||
stack(
|
|
||||||
s("bd*4"),
|
|
||||||
s("[- hh]*4")
|
|
||||||
)
|
|
||||||
```
|
|
||||||
|
|
||||||
The labels you choose are arbitrary, the above `d1` and `d2` are a typical thing you'd write in tidal, for example `d1 $ s "bd*4"`.
|
|
||||||
If the same label is used multiple times, the last one wins:
|
|
||||||
|
|
||||||
```plaintext
|
|
||||||
d1: s("bd*4")
|
|
||||||
d1: s("[- hh]*4") // <-- only this plays
|
|
||||||
```
|
|
||||||
|
|
||||||
There is a special label anonymous label `$`, which can appear multiple times without overriding itself:
|
|
||||||
|
|
||||||
```plaintext
|
|
||||||
// both of these will play:
|
|
||||||
$: s("bd*4")
|
|
||||||
$: s("[- hh]*4")
|
|
||||||
```
|
|
||||||
|
|
||||||
You can mute a pattern by prefixing `_`:
|
|
||||||
|
|
||||||
```plaintext
|
|
||||||
_$: s("bd*4") // <-- this one is muted
|
|
||||||
$: s("[- hh]*4")
|
|
||||||
```
|
|
||||||
|
|
||||||
To run a transformation on all patterns, you can use `all`:
|
|
||||||
|
|
||||||
```plaintext
|
|
||||||
$: s("bd*4")
|
|
||||||
$: s("[- hh]*4")
|
|
||||||
all(x=>x.room(.5))
|
|
||||||
```
|
|
||||||
|
|
||||||
This notation is now the recommended way to [play patterns in parallel](https://strudel.cc/workshop/first-notes/#playing-multiple-patterns)
|
|
||||||
|
|
||||||
### Clock sync between multiple instances
|
|
||||||
|
|
||||||
timing has received a major overhaul, and is now much more accurate on all browsers. Additionally, you can now sync timing across multiple windows.
|
|
||||||

|
|
||||||
|
|
||||||
### Better sample upload support
|
|
||||||
|
|
||||||
you can now upload large amounts of samples much faster across all browsers including on IOS devices. supported filetypes now include: ogg flac mp3 wav aac m4a
|
|
||||||
|
|
||||||
### experimental tidal syntax
|
|
||||||
|
|
||||||
The new `tidal` function allows you to write strudel patterns in tidal syntax:
|
|
||||||
|
|
||||||
```plaintext
|
|
||||||
await initTidal()
|
|
||||||
|
|
||||||
tidal`
|
|
||||||
d1 $ s "bd*4"
|
|
||||||
|
|
||||||
d2 $ s "[- hh]*4"
|
|
||||||
`
|
|
||||||
```
|
|
||||||
|
|
||||||
As we're looking to improve compatibility with tidal, we're happy to hear feedback.
|
|
||||||
|
|
||||||
## breaking changes
|
|
||||||
|
|
||||||
This release comes with a bunch of breaking changes. If you find your patterns to sound different, check out the PRs below for guidance on how to update them. Most of these changes shouldn't affect a lot of patterns.
|
|
||||||
In case of doubt, add the line `// @version 1.0` to your old pattern.
|
|
||||||
If you're having problems, please let us know!
|
|
||||||
|
|
||||||
- remove legacy legato + duration implementations by @felixroos in https://codeberg.org/uzu/strudel/pull/965
|
|
||||||
- Velocity in value by @felixroos in https://codeberg.org/uzu/strudel/pull/974
|
|
||||||
- use ireal as default voicing dict by @felixroos https://codeberg.org/uzu/strudel/pull/967
|
|
||||||
- Color in hap value by @felixroos https://codeberg.org/uzu/strudel/pull/1007
|
|
||||||
- rename trig -> reset, trigzero -> restart by @felixroos https://codeberg.org/uzu/strudel/pull/1010
|
|
||||||
- remove dangerous arithmetic feature by @felixroos https://codeberg.org/uzu/strudel/pull/1030
|
|
||||||
- change fanchor to 0 by @daslyfe https://codeberg.org/uzu/strudel/pull/1107
|
|
||||||
|
|
||||||
## superdough features
|
|
||||||
|
|
||||||
- replace shape with distort in learn doc by @daslyfe https://codeberg.org/uzu/strudel/pull/982
|
|
||||||
- Worklet Improvents / fixes by @daslyfe https://codeberg.org/uzu/strudel/pull/963
|
|
||||||
- supersaw oscillator by @daslyfe https://codeberg.org/uzu/strudel/pull/978
|
|
||||||
- Add analog-style ladder filter by @daslyfe https://codeberg.org/uzu/strudel/pull/1103
|
|
||||||
- Calculate phaser modulation phase based on time by @daslyfe https://codeberg.org/uzu/strudel/pull/1110
|
|
||||||
- rollback phaser by @daslyfe https://codeberg.org/uzu/strudel/pull/1113
|
|
||||||
|
|
||||||
## editor / ui features
|
|
||||||
|
|
||||||
- 'Enable Bracket Matching' option in Codemirror by @eefano https://codeberg.org/uzu/strudel/pull/956
|
|
||||||
- REPL sync between windows by @daslyfe https://codeberg.org/uzu/strudel/pull/900
|
|
||||||
- inline viz / widgets package by @felixroos https://codeberg.org/uzu/strudel/pull/989
|
|
||||||
- Inline punchcard + spiral by @felixroos https://codeberg.org/uzu/strudel/pull/1008
|
|
||||||
- More fonts by @felixroos https://codeberg.org/uzu/strudel/pull/1023
|
|
||||||
- better theme integration for visuals + various fixes by @felixroos https://codeberg.org/uzu/strudel/pull/1024
|
|
||||||
- add setting for sync flag by @felixroos https://codeberg.org/uzu/strudel/pull/1025
|
|
||||||
- add closeBrackets setting by @felixroos https://codeberg.org/uzu/strudel/pull/1031
|
|
||||||
- add font file types to offline cache by @felixroos https://codeberg.org/uzu/strudel/pull/1032
|
|
||||||
- pitchwheel visual by @felixroos https://codeberg.org/uzu/strudel/pull/1041
|
|
||||||
- repl: set document.title from @title by @kasparsj https://codeberg.org/uzu/strudel/pull/1090
|
|
||||||
- Samples tab improvements by @daslyfe https://codeberg.org/uzu/strudel/pull/1102
|
|
||||||
|
|
||||||
## language features
|
|
||||||
|
|
||||||
- pickOut(), pickRestart(), pickReset() by @eefano https://codeberg.org/uzu/strudel/pull/950
|
|
||||||
- Auto await samples by @felixroos https://codeberg.org/uzu/strudel/pull/955
|
|
||||||
- feat: can now invert euclid pulses with negative numbers by @felixroos https://codeberg.org/uzu/strudel/pull/959
|
|
||||||
- Nested controls by @felixroos https://codeberg.org/uzu/strudel/pull/973
|
|
||||||
- alias - for ~ by @yaxu https://codeberg.org/uzu/strudel/pull/981
|
|
||||||
- Beat-oriented functionality by @yaxu https://codeberg.org/uzu/strudel/pull/976
|
|
||||||
- Labeled statements by @felixroos https://codeberg.org/uzu/strudel/pull/991
|
|
||||||
- accidentals in scale degrees by @eefano https://codeberg.org/uzu/strudel/pull/1000
|
|
||||||
- Feature: tactus marking by @yaxu https://codeberg.org/uzu/strudel/pull/1021
|
|
||||||
- Tactus tidy by @yaxu https://codeberg.org/uzu/strudel/pull/1027
|
|
||||||
- Wax, wane, taper and taperlist by @yaxu https://codeberg.org/uzu/strudel/pull/1042
|
|
||||||
- transpose: support all combinations of numbers and strings for notes and intervals by @felixroos https://codeberg.org/uzu/strudel/pull/1048
|
|
||||||
- anonymous patterns + muting by @felixroos https://codeberg.org/uzu/strudel/pull/1059
|
|
||||||
- add swing + swingBy by @felixroos https://codeberg.org/uzu/strudel/pull/1038
|
|
||||||
- Stepwise functions from Tidal by @yaxu https://codeberg.org/uzu/strudel/pull/1060
|
|
||||||
- Tactus tweaks - fixes for maintaining tactus and highlight locations by @yaxu https://codeberg.org/uzu/strudel/pull/1065
|
|
||||||
- Fix stepjoin by @yaxu https://codeberg.org/uzu/strudel/pull/1067
|
|
||||||
- More tactus tidying by @yaxu https://codeberg.org/uzu/strudel/pull/1071
|
|
||||||
- Tactus calculation toggle and breaking change to tactus calculation in fast/slow/hurry by @yaxu https://codeberg.org/uzu/strudel/pull/1081
|
|
||||||
- hs2js package / tidal parser by @felixroos https://codeberg.org/uzu/strudel/pull/870
|
|
||||||
- Add the mousex and mousey signal by @Enelg52 https://codeberg.org/uzu/strudel/pull/1112
|
|
||||||
- can now access strudelMirror from repl by @felixroos https://codeberg.org/uzu/strudel/pull/1117
|
|
||||||
|
|
||||||
## sampler
|
|
||||||
|
|
||||||
If you have nodejs installed on your system, you can now use [@strudel/sampler](https://www.npmjs.com/package/@strudel/sampler) to serve samples from disk to the REPL or flok.
|
|
||||||
|
|
||||||
- local sample server cli by @felixroos https://codeberg.org/uzu/strudel/pull/1033
|
|
||||||
- Fix sampler paths by @felixroos https://codeberg.org/uzu/strudel/pull/1034
|
|
||||||
- Fix sampler windows by @felixroos https://codeberg.org/uzu/strudel/pull/1108
|
|
||||||
- fix sampler on windows by @geikha https://codeberg.org/uzu/strudel/pull/1109
|
|
||||||
|
|
||||||
## docs
|
|
||||||
|
|
||||||
- V1 release notes by @felixroos https://codeberg.org/uzu/strudel/pull/935
|
|
||||||
- Minor documentation error: Update first-sounds.mdx by @mhetrick https://codeberg.org/uzu/strudel/pull/941
|
|
||||||
- Update synths.mdx by @andresgottlieb https://codeberg.org/uzu/strudel/pull/984
|
|
||||||
- using strudel in your project guide + cleanup examples by @felixroos https://codeberg.org/uzu/strudel/pull/1006
|
|
||||||
- Document signals by @ilesinge https://codeberg.org/uzu/strudel/pull/1015
|
|
||||||
- improve tutorial + custom samples doc by @felixroos https://codeberg.org/uzu/strudel/pull/1053
|
|
||||||
- fix cr typo on first-sounds.mdx by @cleary https://codeberg.org/uzu/strudel/pull/1068
|
|
||||||
- fix first sounds typo by @cleary https://codeberg.org/uzu/strudel/pull/1069
|
|
||||||
- add `<...>` to first-sounds.mdx recap by @cleary https://codeberg.org/uzu/strudel/pull/1070
|
|
||||||
- add nesting to `off` example variation in pattern-effects.mdx by @cleary https://codeberg.org/uzu/strudel/pull/1075
|
|
||||||
- fix translation issue in first-effects.mdx by @cleary https://codeberg.org/uzu/strudel/pull/1072
|
|
||||||
- add signals to recap in first-effects.mdx by @cleary https://codeberg.org/uzu/strudel/pull/1073
|
|
||||||
- fix docs on alignment.mdx by @diegodorado https://codeberg.org/uzu/strudel/pull/1076
|
|
||||||
- fix little dub tune example by @lukad https://codeberg.org/uzu/strudel/pull/1104
|
|
||||||
- clarify `off` in pattern-effects.mdx by @cleary https://codeberg.org/uzu/strudel/pull/1074
|
|
||||||
- Fixes drawPianoroll import in codemirror example by @giohappy https://codeberg.org/uzu/strudel/pull/1116
|
|
||||||
- Migrate tutorial fanchor by @felixroos https://codeberg.org/uzu/strudel/pull/1122
|
|
||||||
|
|
||||||
## internals
|
|
||||||
|
|
||||||
- remove cjs builds by @felixroos https://codeberg.org/uzu/strudel/pull/945
|
|
||||||
- controls refactoring: simplify exports by @felixroos https://codeberg.org/uzu/strudel/pull/962
|
|
||||||
- move canvas related helpers from core to new draw package by @felixroos https://codeberg.org/uzu/strudel/pull/971
|
|
||||||
- remove canvas, externalize samples, delete junk by @felixroos https://codeberg.org/uzu/strudel/pull/1003
|
|
||||||
- Improve performance of ! (replicate) by @yaxu https://codeberg.org/uzu/strudel/pull/1084
|
|
||||||
- Benchmarks by @yaxu https://codeberg.org/uzu/strudel/pull/1079
|
|
||||||
|
|
||||||
## fixes
|
|
||||||
|
|
||||||
- fix midi issue on firefox and added quote error by @Enelg52 https://codeberg.org/uzu/strudel/pull/936
|
|
||||||
- fix: pianoroll sorting by @felixroos https://codeberg.org/uzu/strudel/pull/938
|
|
||||||
- account for cps in midi time duration by @daslyfe https://codeberg.org/uzu/strudel/pull/954
|
|
||||||
- fix script importable packages (web + repl) by @felixroos https://codeberg.org/uzu/strudel/pull/957
|
|
||||||
- fix: reset global fx on pattern change by @felixroos https://codeberg.org/uzu/strudel/pull/960
|
|
||||||
- add debounce to logger by @felixroos https://codeberg.org/uzu/strudel/pull/968
|
|
||||||
- fix for transpose(): preserve hap value object structure by @eefano https://codeberg.org/uzu/strudel/pull/966
|
|
||||||
- fix: clear hydra on reset by @felixroos https://codeberg.org/uzu/strudel/pull/983
|
|
||||||
- little fix for withVal by @eefano https://codeberg.org/uzu/strudel/pull/980
|
|
||||||
- fix: share now shares what's visible instead of active by @felixroos https://codeberg.org/uzu/strudel/pull/985
|
|
||||||
- Fix pure mini highlight by @yaxu https://codeberg.org/uzu/strudel/pull/994
|
|
||||||
- fix: await injectPatternMethods by @felixroos https://codeberg.org/uzu/strudel/pull/1012
|
|
||||||
- update undocumented script by @felixroos https://codeberg.org/uzu/strudel/pull/1013
|
|
||||||
- eliminate chromium clock jitter by @felixroos https://codeberg.org/uzu/strudel/pull/1004
|
|
||||||
- Repl sync fixes by @daslyfe https://codeberg.org/uzu/strudel/pull/1014
|
|
||||||
- hotfix for 1017 by @daslyfe https://codeberg.org/uzu/strudel/pull/1020
|
|
||||||
- fix cyclist fizzling out by @felixroos https://codeberg.org/uzu/strudel/pull/1046
|
|
||||||
- Midi Time hotfix for scheduler updates by @daslyfe https://codeberg.org/uzu/strudel/pull/1047
|
|
||||||
- fix: do not reset cc input values on each eval by @felixroos https://codeberg.org/uzu/strudel/pull/1054
|
|
||||||
- Fix wchooseCycles not picking the whole pattern by @ilesinge https://codeberg.org/uzu/strudel/pull/1061
|
|
||||||
- fix OSC timing for recent scheduler updates by @daslyfe https://codeberg.org/uzu/strudel/pull/1062
|
|
||||||
- clarify license by @yaxu https://codeberg.org/uzu/strudel/pull/1064
|
|
||||||
- fix failing format test by @daslyfe https://codeberg.org/uzu/strudel/pull/1077
|
|
||||||
- fix: url parsing with extra params by @felixroos https://codeberg.org/uzu/strudel/pull/1083
|
|
||||||
- fix: csound + dough timing by @felixroos https://codeberg.org/uzu/strudel/pull/1086
|
|
||||||
- fix: missing events due to premature worklet cleanup by @felixroos https://codeberg.org/uzu/strudel/pull/1089
|
|
||||||
- Use sessionStorage for viewingPatternData and activePattern by @kasparsj https://codeberg.org/uzu/strudel/pull/1091
|
|
||||||
- osc: couple of fixes by @kasparsj https://codeberg.org/uzu/strudel/pull/1093
|
|
||||||
- web package fixes by @felixroos https://codeberg.org/uzu/strudel/pull/1044
|
|
||||||
- Fix audio worklets by @daslyfe https://codeberg.org/uzu/strudel/pull/1114
|
|
||||||
- fix: use full repl in web package by @felixroos https://codeberg.org/uzu/strudel/pull/1119
|
|
||||||
- [BUG FIX] Audio worklets sometimes dont load by @daslyfe https://codeberg.org/uzu/strudel/pull/1121
|
|
||||||
|
|
||||||
## New Contributors
|
|
||||||
|
|
||||||
- @mhetrick made their first contribution https://codeberg.org/uzu/strudel/pull/941
|
|
||||||
- @eefano made their first contribution https://codeberg.org/uzu/strudel/pull/956
|
|
||||||
- @Enelg52 made their first contribution https://codeberg.org/uzu/strudel/pull/936
|
|
||||||
- @andresgottlieb made their first contribution https://codeberg.org/uzu/strudel/pull/984
|
|
||||||
- @cleary made their first contribution https://codeberg.org/uzu/strudel/pull/1068
|
|
||||||
- @diegodorado made their first contribution https://codeberg.org/uzu/strudel/pull/1076
|
|
||||||
- @lukad made their first contribution https://codeberg.org/uzu/strudel/pull/1104
|
|
||||||
- @giohappy made their first contribution https://codeberg.org/uzu/strudel/pull/1116
|
|
||||||
|
|
||||||
A huge thanks to all contributors!!!
|
|
||||||
|
|
||||||
## Packages
|
|
||||||
|
|
||||||
- @strudel/codemirror@1.1.0
|
|
||||||
- @strudel/core@1.1.0
|
|
||||||
- @strudel/csound@1.1.0
|
|
||||||
- @strudel/draw@1.1.0
|
|
||||||
- @strudel/embed@1.1.0
|
|
||||||
- hs2js@0.1.0
|
|
||||||
- @strudel/hydra@1.1.0
|
|
||||||
- @strudel/midi@1.1.0
|
|
||||||
- @strudel/mini@1.1.0
|
|
||||||
- @strudel/osc@1.1.0
|
|
||||||
- @strudel/repl@1.1.0
|
|
||||||
- @strudel/sampler@0.1.0
|
|
||||||
- @strudel/serial@1.1.0
|
|
||||||
- @strudel/soundfonts@1.1.0
|
|
||||||
- superdough@1.1.0
|
|
||||||
- @strudel/tidal@0.1.0
|
|
||||||
- @strudel/tonal@1.1.0
|
|
||||||
- @strudel/transpiler@1.1.0
|
|
||||||
- @strudel/web@1.1.0
|
|
||||||
- @strudel/webaudio@1.1.0
|
|
||||||
- @strudel/xen@1.1.0
|
|
||||||
|
|
||||||
**Full Changelog**: https://codeberg.org/uzu/strudel/compare/v1.0.0...v1.1.0
|
|
||||||
@@ -1,186 +0,0 @@
|
|||||||
---
|
|
||||||
title: 'Release Notes v1.2.0'
|
|
||||||
description: ''
|
|
||||||
date: '2025-05-01'
|
|
||||||
tags: ['meta']
|
|
||||||
author: froos
|
|
||||||
---
|
|
||||||
|
|
||||||
## What's Changed
|
|
||||||
|
|
||||||
## highlights
|
|
||||||
|
|
||||||
- [stepwise functions](https://strudel.cc/learn/stepwise/) ([PR](https://github.com/tidalcycles/strudel/pull/1262))
|
|
||||||
- [midimaps](https://strudel.cc/learn/input-output/#midimaps) ([PR](https://github.com/tidalcycles/strudel/pull/1274))
|
|
||||||
- [spectrum](https://strudel.cc/learn/visual-feedback/#spectrum) ([PR](https://github.com/tidalcycles/strudel/pull/1213))
|
|
||||||
- [mqtt](https://strudel.cc/learn/input-output/#mqtt) ([PR](https://github.com/tidalcycles/strudel/pull/1224))
|
|
||||||
- pulse oscillator (todo: https://github.com/tidalcycles/strudel/issues/1336) ([PR](https://github.com/tidalcycles/strudel/pull/1304))
|
|
||||||
- theme improvements
|
|
||||||
|
|
||||||
## breaking changes
|
|
||||||
|
|
||||||
- [breaking change] Sample signals from query onset, rather than midpoint by @yaxu in https://github.com/tidalcycles/strudel/pull/1278
|
|
||||||
- change behaviour of polymeter, and remove polymeterSteps by @yaxu in https://github.com/tidalcycles/strudel/pull/1302
|
|
||||||
- Polish, rename, and document stepwise functions by @yaxu in https://github.com/tidalcycles/strudel/pull/1262
|
|
||||||
|
|
||||||
### superdough
|
|
||||||
|
|
||||||
- feat: Create Pulse Oscillator with variable PWM by @daslyfe in https://github.com/tidalcycles/strudel/pull/1304
|
|
||||||
- add num samples (edited numbers) by @yaxu in https://github.com/tidalcycles/strudel/pull/1309
|
|
||||||
- Add num samples from 0 up to 20 by @yaxu in https://github.com/tidalcycles/strudel/pull/1310
|
|
||||||
- feat: add max polyphony feature for superdough by @daslyfe in https://github.com/tidalcycles/strudel/pull/1317
|
|
||||||
|
|
||||||
### docs
|
|
||||||
|
|
||||||
- doc: visual functions + refactor onPaint by @felixroos in https://github.com/tidalcycles/strudel/pull/1125
|
|
||||||
- Labeled statements doc by @felixroos in https://github.com/tidalcycles/strudel/pull/1126
|
|
||||||
- Correct spelling mistakes by @EdwardBetts in https://github.com/tidalcycles/strudel/pull/1183
|
|
||||||
- remove redundant example for cat, update snapshot by @kdiab in https://github.com/tidalcycles/strudel/pull/1189
|
|
||||||
- chore: Edit run locally instructions in README.md by @ChinoUkaegbu in https://github.com/tidalcycles/strudel/pull/1206
|
|
||||||
- suggested changes to voicings.mdx by @bwagner in https://github.com/tidalcycles/strudel/pull/1231
|
|
||||||
- Documentation for all/each, and bugfix for each by @yaxu in https://github.com/tidalcycles/strudel/pull/1233
|
|
||||||
- Update documentation for param value modification by @gillespi314 in https://github.com/tidalcycles/strudel/pull/1238
|
|
||||||
- fix docs for beat function by @daslyfe in https://github.com/tidalcycles/strudel/pull/1248
|
|
||||||
- understand voicings page by @felixroos in https://github.com/tidalcycles/strudel/pull/1230
|
|
||||||
- add reference package by @felixroos in https://github.com/tidalcycles/strudel/pull/1252
|
|
||||||
- Stepwise documentation tweaks, with mridangam samples by @yaxu in https://github.com/tidalcycles/strudel/pull/1275
|
|
||||||
- showcase tweaks by @yaxu in https://github.com/tidalcycles/strudel/pull/1291
|
|
||||||
- Signpost licenses for source code and samples a bit more, ref #1277 by @yaxu in https://github.com/tidalcycles/strudel/pull/1289
|
|
||||||
- Fix misplaced ending sentence by @makmanalp in https://github.com/tidalcycles/strudel/pull/1296
|
|
||||||
- Fix typo pattnr by @ReneNyffenegger in https://github.com/tidalcycles/strudel/pull/1316
|
|
||||||
- update docs to reflect import sounds tab change by @hpunq in https://github.com/tidalcycles/strudel/pull/1332
|
|
||||||
|
|
||||||
### ui improvements
|
|
||||||
|
|
||||||
- Udels (MultiFrame Strudel) Revisited by @daslyfe in https://github.com/tidalcycles/strudel/pull/1132
|
|
||||||
- Create audio target selector for OSC/Superdirt by @daslyfe in https://github.com/tidalcycles/strudel/pull/1160
|
|
||||||
- Add a search bar to the REPL Reference tab by @netux in https://github.com/tidalcycles/strudel/pull/1165
|
|
||||||
- Adding search bar (soundtab.jsx) by @Bubobubobubobubo in https://github.com/tidalcycles/strudel/pull/1185
|
|
||||||
- add 2 new ui settings by @felixroos in https://github.com/tidalcycles/strudel/pull/1200
|
|
||||||
- Theme glowup by @felixroos in https://github.com/tidalcycles/strudel/pull/1268
|
|
||||||
- Create Pattern Page Pagination by @daslyfe in https://github.com/tidalcycles/strudel/pull/1287
|
|
||||||
- feat: Theme improvements by @daslyfe in https://github.com/tidalcycles/strudel/pull/1295
|
|
||||||
- feat: new themes + theme improvements by @daslyfe in https://github.com/tidalcycles/strudel/pull/1326
|
|
||||||
- Add new "import-sounds" tab with explanation on folder import by @hpunq in https://github.com/tidalcycles/strudel/pull/1329
|
|
||||||
- Add Icon to import sample button by @daslyfe in https://github.com/tidalcycles/strudel/pull/1331
|
|
||||||
- better spacing in zen mode by @felixroos in https://github.com/tidalcycles/strudel/pull/1147
|
|
||||||
- Screenreader improvements by @yaxu in https://github.com/tidalcycles/strudel/pull/1158
|
|
||||||
- colorize console + tweak header by @felixroos in https://github.com/tidalcycles/strudel/pull/1203
|
|
||||||
- Menu Panel Improvements! by @daslyfe in https://github.com/tidalcycles/strudel/pull/1193
|
|
||||||
- Make panel hover behavior optional by @daslyfe in https://github.com/tidalcycles/strudel/pull/1199
|
|
||||||
- REPL: solo and sync configuration by @bthj in https://github.com/tidalcycles/strudel/pull/1214
|
|
||||||
- enhancement: make error messages easier to read by @daslyfe in https://github.com/tidalcycles/strudel/pull/1315
|
|
||||||
|
|
||||||
### mqtt
|
|
||||||
|
|
||||||
- MQTT support by @yaxu in https://github.com/tidalcycles/strudel/pull/1224
|
|
||||||
- MQTT - if password isn't provided, prompt for one by @yaxu in https://github.com/tidalcycles/strudel/pull/1249
|
|
||||||
- MQTT - support adding hap duration and cps metadata to JSON messages by @yaxu in https://github.com/tidalcycles/strudel/pull/1279
|
|
||||||
- make mqtt topic patternable by @yaxu in https://github.com/tidalcycles/strudel/pull/1280
|
|
||||||
- Bugfix: update mqtt connections dictionary by @yaxu in https://github.com/tidalcycles/strudel/pull/1281
|
|
||||||
- mqtt bugfix - connection check by @yaxu in https://github.com/tidalcycles/strudel/pull/1282
|
|
||||||
|
|
||||||
### new functions
|
|
||||||
|
|
||||||
- Add scramble and shuffle by @yaxu in https://github.com/tidalcycles/strudel/pull/1167
|
|
||||||
- polyJoin by @yaxu in https://github.com/tidalcycles/strudel/pull/1168
|
|
||||||
- Add seqPLoop from Tidal by @yaxu in https://github.com/tidalcycles/strudel/pull/1182
|
|
||||||
- add filter + filterWhen + within by @felixroos in https://github.com/tidalcycles/strudel/pull/1039
|
|
||||||
- Add bite function by @yaxu in https://github.com/tidalcycles/strudel/pull/1187
|
|
||||||
- markcss by @felixroos in https://github.com/tidalcycles/strudel/pull/1202
|
|
||||||
- "beat" function for "step sequencer" style rhythm notation by @daslyfe in https://github.com/tidalcycles/strudel/pull/1237
|
|
||||||
- Add s_zip for 'cat'-ing patterns together step-by-step, bugfix `steps` by @yaxu in https://github.com/tidalcycles/strudel/pull/1208
|
|
||||||
- "stretch" function (phase vocoder) by @daslyfe in https://github.com/tidalcycles/strudel/pull/1130
|
|
||||||
- add basic spectrum function by @felixroos in https://github.com/tidalcycles/strudel/pull/1213
|
|
||||||
- Add onKey function for custom key commands for patterns by @daslyfe in https://github.com/tidalcycles/strudel/pull/1235
|
|
||||||
- Add binary and binaryN by @heerman in https://github.com/tidalcycles/strudel/pull/1226
|
|
||||||
- midimaps by @felixroos in https://github.com/tidalcycles/strudel/pull/1274
|
|
||||||
- small feat: Add alias for segment and ribbon by @daslyfe in https://github.com/tidalcycles/strudel/pull/1314
|
|
||||||
- feat: Create scrub function for scrubbing an audio file by @daslyfe in https://github.com/tidalcycles/strudel/pull/1321
|
|
||||||
- feat: Improve gain curve by @daslyfe in https://github.com/tidalcycles/strudel/pull/1318
|
|
||||||
- Chop chop by @yaxu in https://github.com/tidalcycles/strudel/pull/1078
|
|
||||||
|
|
||||||
### more
|
|
||||||
|
|
||||||
- Make `all()` post-stack again, and add `each()` for pre-stack by @yaxu in https://github.com/tidalcycles/strudel/pull/1229
|
|
||||||
- Add stepBind, and some toplevel aliases for binds and withValue by @yaxu in https://github.com/tidalcycles/strudel/pull/1241
|
|
||||||
- Make cps patternable by @eefano in https://github.com/tidalcycles/strudel/pull/1001
|
|
||||||
- Allow wchooseCycles probabilities to be patterned by @yaxu in https://github.com/tidalcycles/strudel/pull/1292
|
|
||||||
- @strudel/sampler improvements by @felixroos in https://github.com/tidalcycles/strudel/pull/1288
|
|
||||||
|
|
||||||
### refactor
|
|
||||||
|
|
||||||
- expose comment commands by @felixroos in https://github.com/tidalcycles/strudel/pull/1136
|
|
||||||
- containerize/seperate out boolean checks for repl types/Repl logic into bespoke components. by @daslyfe in https://github.com/tidalcycles/strudel/pull/1163
|
|
||||||
- Improve + simplify neocyclist timing by @daslyfe in https://github.com/tidalcycles/strudel/pull/1164
|
|
||||||
- Make phaser control consistent with superdirt by @daslyfe in https://github.com/tidalcycles/strudel/pull/1178
|
|
||||||
- Revert "Make phaser control consistent with superdirt" by @daslyfe in https://github.com/tidalcycles/strudel/pull/1179
|
|
||||||
- make phaser control match superdirt by @daslyfe in https://github.com/tidalcycles/strudel/pull/1180
|
|
||||||
- refactor sampler by @felixroos in https://github.com/tidalcycles/strudel/pull/1101
|
|
||||||
- update lockfile + minor versions by @felixroos in https://github.com/tidalcycles/strudel/pull/1198
|
|
||||||
- Preserve tactus for 'degrade' and friends, and tidy up 'pick' and friends by @yaxu in https://github.com/tidalcycles/strudel/pull/1205
|
|
||||||
- Apply `all` function to individual patterns rather than final stack by @yaxu in https://github.com/tidalcycles/strudel/pull/1209
|
|
||||||
- Revert "Fix sometimes" by @yaxu in https://github.com/tidalcycles/strudel/pull/1267
|
|
||||||
- patchday by @felixroos in https://github.com/tidalcycles/strudel/pull/1264
|
|
||||||
- Rename repeat back to extend by @yaxu in https://github.com/tidalcycles/strudel/pull/1285
|
|
||||||
- Send delta in OSC message in seconds, to match tidal/superdirt by @yaxu in https://github.com/tidalcycles/strudel/pull/1323
|
|
||||||
|
|
||||||
### fixes
|
|
||||||
|
|
||||||
- Fix clock worker dependency path in module builds by @matthewkaney in https://github.com/tidalcycles/strudel/pull/1129
|
|
||||||
- Fix bug in Fraction.lcm by @yaxu in https://github.com/tidalcycles/strudel/pull/1133
|
|
||||||
- Fix tactus marking in mininotation by @yaxu in https://github.com/tidalcycles/strudel/pull/1144
|
|
||||||
- Fix loopAt tactus by @yaxu in https://github.com/tidalcycles/strudel/pull/1145
|
|
||||||
- Fix OSC clock jitter by @daslyfe in https://github.com/tidalcycles/strudel/pull/1157
|
|
||||||
- [CORS HOTFIX] by @daslyfe in https://github.com/tidalcycles/strudel/pull/1162
|
|
||||||
- Fixes fit so it works after a chop or slice by @yaxu in https://github.com/tidalcycles/strudel/pull/1171
|
|
||||||
- fix sample speed when using splice and fit with superdirt by @daslyfe in https://github.com/tidalcycles/strudel/pull/1172
|
|
||||||
- handle midin device not found error by @felixroos in https://github.com/tidalcycles/strudel/pull/1146
|
|
||||||
- Fix serial timing by @yaxu in https://github.com/tidalcycles/strudel/pull/1188
|
|
||||||
- Fix regression for d1, p1, p(n) by @yaxu in https://github.com/tidalcycles/strudel/pull/1227
|
|
||||||
- Fix sometimes by @yaxu in https://github.com/tidalcycles/strudel/pull/1243
|
|
||||||
- Fix sf2 timing by @felixroos in https://github.com/tidalcycles/strudel/pull/1272
|
|
||||||
- Fix "squeezejoin" and functions using it, including "bite" by @yaxu in https://github.com/tidalcycles/strudel/pull/1286
|
|
||||||
- Fixes inverted triangle wave by renaming it to "itri", making non-inverted "tri" by @yaxu in https://github.com/tidalcycles/strudel/pull/1283
|
|
||||||
- Hotfix: prevent undefined pattern code from crashing strudel on load by @daslyfe in https://github.com/tidalcycles/strudel/pull/1297
|
|
||||||
- Fix test error #1297 by @nkymut in https://github.com/tidalcycles/strudel/pull/1298
|
|
||||||
- bugfix zoom stepcount by @yaxu in https://github.com/tidalcycles/strudel/pull/1301
|
|
||||||
- bugfix: Allow single param to be used in the as function by @daslyfe in https://github.com/tidalcycles/strudel/pull/1312
|
|
||||||
- fix: replace empty spaces in registered sound keys by @daslyfe in https://github.com/tidalcycles/strudel/pull/1319
|
|
||||||
- FIX: Multichannel Audio by @daslyfe in https://github.com/tidalcycles/strudel/pull/1322
|
|
||||||
- fix: udels header by @daslyfe in https://github.com/tidalcycles/strudel/pull/1325
|
|
||||||
- fix: disable astro toolbar by default by @daslyfe in https://github.com/tidalcycles/strudel/pull/1324
|
|
||||||
- FIX: sound import order by @daslyfe in https://github.com/tidalcycles/strudel/pull/1333`
|
|
||||||
|
|
||||||
## New Contributors
|
|
||||||
|
|
||||||
- @EdwardBetts made their first contribution in https://github.com/tidalcycles/strudel/pull/1183
|
|
||||||
- @netux made their first contribution in https://github.com/tidalcycles/strudel/pull/1165
|
|
||||||
- @kdiab made their first contribution in https://github.com/tidalcycles/strudel/pull/1189
|
|
||||||
|
|
||||||
**Full Changelog**: https://github.com/tidalcycles/strudel/compare/v1.1.0...v1.1.1
|
|
||||||
|
|
||||||
## packages
|
|
||||||
|
|
||||||
- @strudel/codemirror@1.2.0
|
|
||||||
- @strudel/core@1.2.0
|
|
||||||
- @strudel/csound@1.2.0
|
|
||||||
- @strudel/draw@1.2.0
|
|
||||||
- @strudel/gamepad@1.2.0
|
|
||||||
- @strudel/hydra@1.2.0
|
|
||||||
- @strudel/midi@1.2.0
|
|
||||||
- @strudel/mini@1.2.0
|
|
||||||
- @strudel/motion@1.2.0
|
|
||||||
- @strudel/mqtt@1.2.0
|
|
||||||
- @strudel/osc@1.2.0
|
|
||||||
- @strudel/reference@1.2.0
|
|
||||||
- @strudel/repl@1.2.0
|
|
||||||
- @strudel/sampler@0.2.0
|
|
||||||
- @strudel/serial@1.2.0
|
|
||||||
- @strudel/soundfonts@1.2.0
|
|
||||||
- superdough@1.2.0
|
|
||||||
- @strudel/tonal@1.2.0
|
|
||||||
- @strudel/transpiler@1.2.0
|
|
||||||
- @strudel/web@1.2.0
|
|
||||||
- @strudel/webaudio@1.2.0
|
|
||||||
- @strudel/xen@1.2.0
|
|
||||||
@@ -95,7 +95,7 @@ Diese Kombinationen von Buchstaben stehen für verschiedene Teile eines Schlagze
|
|||||||
- `mt` = **m**iddle tom
|
- `mt` = **m**iddle tom
|
||||||
- `ht` = **h**igh tom
|
- `ht` = **h**igh tom
|
||||||
- `rd` = **r**i**d**e cymbal
|
- `rd` = **r**i**d**e cymbal
|
||||||
- `cr` = **cr**ash cymbal
|
- `rd` = **cr**ash cymbal
|
||||||
|
|
||||||
Probier verschiedene Sounds aus!
|
Probier verschiedene Sounds aus!
|
||||||
|
|
||||||
|
|||||||
@@ -57,34 +57,6 @@ Each filter has 2 parameters:
|
|||||||
|
|
||||||
<JsDoc client:idle name="vowel" h={0} />
|
<JsDoc client:idle name="vowel" h={0} />
|
||||||
|
|
||||||
# Amplitude Modulation
|
|
||||||
|
|
||||||
Amplitude modulation changes the amplitude (gain) periodically over time.
|
|
||||||
|
|
||||||
## am
|
|
||||||
|
|
||||||
<JsDoc client:idle name="am" h={0} />
|
|
||||||
|
|
||||||
## tremolosync
|
|
||||||
|
|
||||||
<JsDoc client:idle name="tremolosync" h={0} />
|
|
||||||
|
|
||||||
## tremolodepth
|
|
||||||
|
|
||||||
<JsDoc client:idle name="tremolodepth" h={0} />
|
|
||||||
|
|
||||||
## tremoloskew
|
|
||||||
|
|
||||||
<JsDoc client:idle name="tremoloskew" h={0} />
|
|
||||||
|
|
||||||
## tremolophase
|
|
||||||
|
|
||||||
<JsDoc client:idle name="tremolophase" h={0} />
|
|
||||||
|
|
||||||
## tremoloshape
|
|
||||||
|
|
||||||
<JsDoc client:idle name="tremoloshape" h={0} />
|
|
||||||
|
|
||||||
# Amplitude Envelope
|
# Amplitude Envelope
|
||||||
|
|
||||||
The amplitude [envelope](<https://en.wikipedia.org/wiki/Envelope_(music)>) controls the dynamic contour of a sound.
|
The amplitude [envelope](<https://en.wikipedia.org/wiki/Envelope_(music)>) controls the dynamic contour of a sound.
|
||||||
|
|||||||
@@ -176,16 +176,3 @@ $ chord <Dm9!3 Db7> # voicing
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
The `$` sign is an alias for `,` so it will create a stack behind the scenes.
|
The `$` sign is an alias for `,` so it will create a stack behind the scenes.
|
||||||
|
|
||||||
## variables
|
|
||||||
|
|
||||||
using the `def` keyword, you can define variables:
|
|
||||||
|
|
||||||
<MiniRepl
|
|
||||||
client:idle
|
|
||||||
mondo
|
|
||||||
tune={`
|
|
||||||
$ def melody [0 1 2 3]
|
|
||||||
$ n melody # scale C:minor
|
|
||||||
`}
|
|
||||||
/>
|
|
||||||
|
|||||||
@@ -163,21 +163,6 @@ The last section could be written as:
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Please note that browsers will often cache `strudel.json` on first load, and keep using the cached
|
|
||||||
version even if the orginal has been updated. If this bites you (for example while developing a new
|
|
||||||
sample pack), you can force the browser to download a new copy by i.e. changing capitalization of one
|
|
||||||
character in the URL, or adding a URL attribute, such as:
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
samples('https://raw.githubusercontent.com/tidalcycles/Dirt-Samples/master/strudel.json?version=2');
|
|
||||||
```
|
|
||||||
|
|
||||||
that gets ignored by GitHub (but changes the URL, forcing the browser to reload every time we increase
|
|
||||||
the version number).
|
|
||||||
|
|
||||||
It is also possible, of course, to just remove it from cache (deleting cache in browser Privacy settings,
|
|
||||||
or from the dev console if you're technically minded, or by using a cache deleting extension).
|
|
||||||
|
|
||||||
## Github Shortcut
|
## Github Shortcut
|
||||||
|
|
||||||
Because loading samples from github is common, there is a shortcut:
|
Because loading samples from github is common, there is a shortcut:
|
||||||
|
|||||||
@@ -67,8 +67,6 @@ Or using 2 beats per cycle:
|
|||||||
s("bd sd, hh*4")`}
|
s("bd sd, hh*4")`}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
You can use the `setcps` method to set the global tempo in cycles per second. `setcpm(x)` is the same as `setcps(x / 60)`.
|
|
||||||
|
|
||||||
<Box>
|
<Box>
|
||||||
|
|
||||||
To set a specific bpm, use `setcpm(bpm/bpc)`
|
To set a specific bpm, use `setcpm(bpm/bpc)`
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ function UserPatterns({ context }) {
|
|||||||
style={{ display: 'none' }}
|
style={{ display: 'none' }}
|
||||||
type="file"
|
type="file"
|
||||||
multiple
|
multiple
|
||||||
accept="text/plain,text/x-markdown,application/json"
|
accept="text/plain,application/json"
|
||||||
onChange={(e) => importPatterns(e.target.files)}
|
onChange={(e) => importPatterns(e.target.files)}
|
||||||
/>
|
/>
|
||||||
import
|
import
|
||||||
|
|||||||
@@ -21,11 +21,7 @@ export function Reference() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const lowCaseSearch = search.toLowerCase();
|
return entry.name.includes(search) || (entry.synonyms?.some((s) => s.includes(search)) ?? false);
|
||||||
return (
|
|
||||||
entry.name.toLowerCase().includes(lowCaseSearch) ||
|
|
||||||
(entry.synonyms?.some((s) => s.includes(lowCaseSearch)) ?? false)
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
}, [search]);
|
}, [search]);
|
||||||
|
|
||||||
|
|||||||
@@ -109,8 +109,6 @@ export function SettingsTab({ started }) {
|
|||||||
togglePanelTrigger,
|
togglePanelTrigger,
|
||||||
maxPolyphony,
|
maxPolyphony,
|
||||||
multiChannelOrbits,
|
multiChannelOrbits,
|
||||||
isTabIndentationEnabled,
|
|
||||||
isMultiCursorEnabled,
|
|
||||||
} = useSettings();
|
} = useSettings();
|
||||||
const shouldAlwaysSync = isUdels();
|
const shouldAlwaysSync = isUdels();
|
||||||
const canChangeAudioDevice = AudioContext.prototype.setSinkId != null;
|
const canChangeAudioDevice = AudioContext.prototype.setSinkId != null;
|
||||||
@@ -264,16 +262,6 @@ export function SettingsTab({ started }) {
|
|||||||
onChange={(cbEvent) => settingsMap.setKey('isLineWrappingEnabled', cbEvent.target.checked)}
|
onChange={(cbEvent) => settingsMap.setKey('isLineWrappingEnabled', cbEvent.target.checked)}
|
||||||
value={isLineWrappingEnabled}
|
value={isLineWrappingEnabled}
|
||||||
/>
|
/>
|
||||||
<Checkbox
|
|
||||||
label="Enable Tab indentation"
|
|
||||||
onChange={(cbEvent) => settingsMap.setKey('isTabIndentationEnabled', cbEvent.target.checked)}
|
|
||||||
value={isTabIndentationEnabled}
|
|
||||||
/>
|
|
||||||
<Checkbox
|
|
||||||
label="Enable Multi-Cursor (Cmd/Ctrl+Click)"
|
|
||||||
onChange={(cbEvent) => settingsMap.setKey('isMultiCursorEnabled', cbEvent.target.checked)}
|
|
||||||
value={isMultiCursorEnabled}
|
|
||||||
/>
|
|
||||||
<Checkbox
|
<Checkbox
|
||||||
label="Enable flashing on evaluation"
|
label="Enable flashing on evaluation"
|
||||||
onChange={(cbEvent) => settingsMap.setKey('isFlashEnabled', cbEvent.target.checked)}
|
onChange={(cbEvent) => settingsMap.setKey('isFlashEnabled', cbEvent.target.checked)}
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
import { createInterface } from 'node:readline';
|
||||||
|
import * as fs from 'node:fs';
|
||||||
|
|
||||||
|
const validFileTypes = new Set(['.wav', '.mp3', '.aac', '.m4a']);
|
||||||
|
/** For automatically creating the strudel JSON that for samples hosted in a remote repo */
|
||||||
|
async function writeStrudelJson(subpath, hosturl) {
|
||||||
|
const children = await fs.promises.readdir(subpath, { recursive: true });
|
||||||
|
const name = subpath.split('/').slice(-1)[0];
|
||||||
|
const tree = { name, children };
|
||||||
|
let samples = {
|
||||||
|
_base: hosturl,
|
||||||
|
};
|
||||||
|
|
||||||
|
const files = tree.children
|
||||||
|
.filter((path) => {
|
||||||
|
const extension = path.match(/\.[0-9a-z]+$/i)?.[0];
|
||||||
|
return validFileTypes.has(extension);
|
||||||
|
})
|
||||||
|
.sort((a, b) => a.localeCompare(b));
|
||||||
|
|
||||||
|
files.forEach((path) => {
|
||||||
|
const groupName = path.match(/([^/]+)\/[^/]+$/)[1];
|
||||||
|
samples[groupName] = samples[groupName] ?? [];
|
||||||
|
samples[groupName].push(path);
|
||||||
|
});
|
||||||
|
const json = JSON.stringify(samples, null, 2);
|
||||||
|
const filepath = subpath + '/strudel.json';
|
||||||
|
await fs.promises.writeFile(filepath, json);
|
||||||
|
console.log(`wrote strudel.json with ${files.length} samples to ${subpath}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const rl = createInterface({
|
||||||
|
input: process.stdin,
|
||||||
|
output: process.stdout,
|
||||||
|
});
|
||||||
|
|
||||||
|
rl.question(`enter sample folder path: `, async (path) => {
|
||||||
|
rl.question(`enter hosted URL: `, async (hosturl) => {
|
||||||
|
const githubregex = /github\.com\/([^/]+)\/([^/]+)/;
|
||||||
|
const githubparams = hosturl.match(githubregex);
|
||||||
|
if (githubparams) {
|
||||||
|
const username = githubparams[1];
|
||||||
|
const repo = githubparams[2];
|
||||||
|
|
||||||
|
hosturl = `https://raw.githubusercontent.com/${username}/${repo}/main/`;
|
||||||
|
console.log('reformatting github URL to: ', hosturl);
|
||||||
|
}
|
||||||
|
|
||||||
|
await writeStrudelJson(path, hosturl);
|
||||||
|
rl.close();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -33,7 +33,7 @@ async function loadStrudelJson(subpath) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function writeStrudelJson(subpath) {
|
export async function writeStrudelJson(subpath) {
|
||||||
const children = await readDir(subpath, { dir, recursive: true });
|
const children = await readDir(subpath, { dir, recursive: true });
|
||||||
const name = subpath.split('/').slice(-1)[0];
|
const name = subpath.split('/').slice(-1)[0];
|
||||||
const tree = { name, children };
|
const tree = { name, children };
|
||||||
@@ -41,7 +41,7 @@ async function writeStrudelJson(subpath) {
|
|||||||
let samples = {};
|
let samples = {};
|
||||||
let count = 0;
|
let count = 0;
|
||||||
walkFileTree(tree, (entry, parent) => {
|
walkFileTree(tree, (entry, parent) => {
|
||||||
if (['wav', 'mp3'].includes(entry.name.split('.').slice(-1)[0])) {
|
if (['wav', 'mp3', 'aac', 'm4a'].includes(entry.name.split('.').slice(-1)[0])) {
|
||||||
samples[parent.name] = samples[parent.name] || [];
|
samples[parent.name] = samples[parent.name] || [];
|
||||||
count += 1;
|
count += 1;
|
||||||
samples[parent.name].push(entry.subpath.slice(1).concat([entry.name]).join('/'));
|
samples[parent.name].push(entry.subpath.slice(1).concat([entry.name]).join('/'));
|
||||||
|
|||||||
@@ -28,10 +28,7 @@ export async function prebake() {
|
|||||||
prebake: true,
|
prebake: true,
|
||||||
tag: 'drum-machines',
|
tag: 'drum-machines',
|
||||||
}),
|
}),
|
||||||
samples(`https://raw.githubusercontent.com/tidalcycles/uzu-drumkit/main/strudel.json`, undefined, {
|
samples(`${baseNoTrailing}/EmuSP12.json`, undefined, { prebake: true, tag: 'drum-machines' }),
|
||||||
prebake: true,
|
|
||||||
tag: 'drum-machines',
|
|
||||||
}),
|
|
||||||
samples(`${baseNoTrailing}/mridangam.json`, undefined, { prebake: true, tag: 'drum-machines' }),
|
samples(`${baseNoTrailing}/mridangam.json`, undefined, { prebake: true, tag: 'drum-machines' }),
|
||||||
samples(
|
samples(
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import {
|
|||||||
resetGlobalEffects,
|
resetGlobalEffects,
|
||||||
resetLoadedSounds,
|
resetLoadedSounds,
|
||||||
initAudioOnFirstClick,
|
initAudioOnFirstClick,
|
||||||
resetDefaults,
|
|
||||||
} from '@strudel/webaudio';
|
} from '@strudel/webaudio';
|
||||||
import { setVersionDefaultsFrom } from './util.mjs';
|
import { setVersionDefaultsFrom } from './util.mjs';
|
||||||
import { StrudelMirror, defaultSettings } from '@strudel/codemirror';
|
import { StrudelMirror, defaultSettings } from '@strudel/codemirror';
|
||||||
@@ -182,7 +181,6 @@ export function useReplContext() {
|
|||||||
|
|
||||||
const resetEditor = async () => {
|
const resetEditor = async () => {
|
||||||
(await getModule('@strudel/tonal'))?.resetVoicings();
|
(await getModule('@strudel/tonal'))?.resetVoicings();
|
||||||
resetDefaults();
|
|
||||||
resetGlobalEffects();
|
resetGlobalEffects();
|
||||||
clearCanvas();
|
clearCanvas();
|
||||||
clearHydra();
|
clearHydra();
|
||||||
|
|||||||
@@ -21,8 +21,6 @@ export const defaultSettings = {
|
|||||||
isSyncEnabled: false,
|
isSyncEnabled: false,
|
||||||
isLineWrappingEnabled: false,
|
isLineWrappingEnabled: false,
|
||||||
isPatternHighlightingEnabled: true,
|
isPatternHighlightingEnabled: true,
|
||||||
isTabIndentationEnabled: false,
|
|
||||||
isMultiCursorEnabled: false,
|
|
||||||
theme: 'strudelTheme',
|
theme: 'strudelTheme',
|
||||||
fontFamily: 'monospace',
|
fontFamily: 'monospace',
|
||||||
fontSize: 18,
|
fontSize: 18,
|
||||||
@@ -79,8 +77,6 @@ export function useSettings() {
|
|||||||
isLineWrappingEnabled: parseBoolean(state.isLineWrappingEnabled),
|
isLineWrappingEnabled: parseBoolean(state.isLineWrappingEnabled),
|
||||||
isFlashEnabled: parseBoolean(state.isFlashEnabled),
|
isFlashEnabled: parseBoolean(state.isFlashEnabled),
|
||||||
isSyncEnabled: isUdels() ? true : parseBoolean(state.isSyncEnabled),
|
isSyncEnabled: isUdels() ? true : parseBoolean(state.isSyncEnabled),
|
||||||
isTabIndentationEnabled: parseBoolean(state.isTabIndentationEnabled),
|
|
||||||
isMultiCursorEnabled: parseBoolean(state.isMultiCursorEnabled),
|
|
||||||
fontSize: Number(state.fontSize),
|
fontSize: Number(state.fontSize),
|
||||||
panelPosition: state.activeFooter !== '' && !isUdels() ? state.panelPosition : 'bottom', // <-- keep this 'bottom' where it is!
|
panelPosition: state.activeFooter !== '' && !isUdels() ? state.panelPosition : 'bottom', // <-- keep this 'bottom' where it is!
|
||||||
isPanelPinned: parseBoolean(state.isPanelPinned),
|
isPanelPinned: parseBoolean(state.isPanelPinned),
|
||||||
|
|||||||
@@ -197,7 +197,7 @@ export async function importPatterns(fileList) {
|
|||||||
if (file.type === 'application/json') {
|
if (file.type === 'application/json') {
|
||||||
const userPatterns = userPattern.getAll();
|
const userPatterns = userPattern.getAll();
|
||||||
setUserPatterns({ ...userPatterns, ...parseJSON(content) });
|
setUserPatterns({ ...userPatterns, ...parseJSON(content) });
|
||||||
} else if (["text/x-markdown", 'text/plain'].includes(file.type)) {
|
} else if (file.type === 'text/plain') {
|
||||||
const id = file.name.replace(/\.[^/.]+$/, '');
|
const id = file.name.replace(/\.[^/.]+$/, '');
|
||||||
userPattern.update(id, { code: content });
|
userPattern.update(id, { code: content });
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user