mirror of
https://codeberg.org/uzu/strudel
synced 2026-07-27 15:29:18 -04:00
Merge pull request 'Add delta signal for representing the duration of events in patterns that are combined with it' (#1831) from delta into main
Reviewed-on: https://codeberg.org/uzu/strudel/pulls/1831
This commit is contained in:
@@ -882,3 +882,12 @@ export const whenKey = register('whenKey', function (input, func, pat) {
|
||||
export const keyDown = register('keyDown', function (pat) {
|
||||
return pat.fmap(_keyDown);
|
||||
});
|
||||
|
||||
/**
|
||||
* A pattern that gives the duration of events that are combined with it.
|
||||
* @example
|
||||
* sound("bd sd [bd bd] sd*4 [- sd] [bd [bd bd]]").note(delta.withValue(x => 1/x + 20))
|
||||
*/
|
||||
export const delta = new Pattern(function (state) {
|
||||
return [new Hap(undefined, state.span, state.span.duration)];
|
||||
});
|
||||
|
||||
@@ -2784,6 +2784,59 @@ exports[`runs examples > example "delaysync" example index 0 1`] = `
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`runs examples > example "delta" example index 0 1`] = `
|
||||
[
|
||||
"[ 0/1 → 1/6 | s:bd note:26 ]",
|
||||
"[ 1/6 → 1/3 | s:sd note:26 ]",
|
||||
"[ 1/3 → 5/12 | s:bd note:32 ]",
|
||||
"[ 5/12 → 1/2 | s:bd note:32 ]",
|
||||
"[ 1/2 → 13/24 | s:sd note:44 ]",
|
||||
"[ 13/24 → 7/12 | s:sd note:44 ]",
|
||||
"[ 7/12 → 5/8 | s:sd note:44 ]",
|
||||
"[ 5/8 → 2/3 | s:sd note:44 ]",
|
||||
"[ 3/4 → 5/6 | s:sd note:32 ]",
|
||||
"[ 5/6 → 11/12 | s:bd note:32 ]",
|
||||
"[ 11/12 → 23/24 | s:bd note:44 ]",
|
||||
"[ 23/24 → 1/1 | s:bd note:44 ]",
|
||||
"[ 1/1 → 7/6 | s:bd note:26 ]",
|
||||
"[ 7/6 → 4/3 | s:sd note:26 ]",
|
||||
"[ 4/3 → 17/12 | s:bd note:32 ]",
|
||||
"[ 17/12 → 3/2 | s:bd note:32 ]",
|
||||
"[ 3/2 → 37/24 | s:sd note:44 ]",
|
||||
"[ 37/24 → 19/12 | s:sd note:44 ]",
|
||||
"[ 19/12 → 13/8 | s:sd note:44 ]",
|
||||
"[ 13/8 → 5/3 | s:sd note:44 ]",
|
||||
"[ 7/4 → 11/6 | s:sd note:32 ]",
|
||||
"[ 11/6 → 23/12 | s:bd note:32 ]",
|
||||
"[ 23/12 → 47/24 | s:bd note:44 ]",
|
||||
"[ 47/24 → 2/1 | s:bd note:44 ]",
|
||||
"[ 2/1 → 13/6 | s:bd note:26 ]",
|
||||
"[ 13/6 → 7/3 | s:sd note:26 ]",
|
||||
"[ 7/3 → 29/12 | s:bd note:32 ]",
|
||||
"[ 29/12 → 5/2 | s:bd note:32 ]",
|
||||
"[ 5/2 → 61/24 | s:sd note:44 ]",
|
||||
"[ 61/24 → 31/12 | s:sd note:44 ]",
|
||||
"[ 31/12 → 21/8 | s:sd note:44 ]",
|
||||
"[ 21/8 → 8/3 | s:sd note:44 ]",
|
||||
"[ 11/4 → 17/6 | s:sd note:32 ]",
|
||||
"[ 17/6 → 35/12 | s:bd note:32 ]",
|
||||
"[ 35/12 → 71/24 | s:bd note:44 ]",
|
||||
"[ 71/24 → 3/1 | s:bd note:44 ]",
|
||||
"[ 3/1 → 19/6 | s:bd note:26 ]",
|
||||
"[ 19/6 → 10/3 | s:sd note:26 ]",
|
||||
"[ 10/3 → 41/12 | s:bd note:32 ]",
|
||||
"[ 41/12 → 7/2 | s:bd note:32 ]",
|
||||
"[ 7/2 → 85/24 | s:sd note:44 ]",
|
||||
"[ 85/24 → 43/12 | s:sd note:44 ]",
|
||||
"[ 43/12 → 29/8 | s:sd note:44 ]",
|
||||
"[ 29/8 → 11/3 | s:sd note:44 ]",
|
||||
"[ 15/4 → 23/6 | s:sd note:32 ]",
|
||||
"[ 23/6 → 47/12 | s:bd note:32 ]",
|
||||
"[ 47/12 → 95/24 | s:bd note:44 ]",
|
||||
"[ 95/24 → 4/1 | s:bd note:44 ]",
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`runs examples > example "density" example index 0 1`] = `
|
||||
[
|
||||
"[ 0/1 → 1/4 | s:crackle density:0.01 ]",
|
||||
|
||||
Reference in New Issue
Block a user