add delta
This commit is contained in:
parent
3608f1ca25
commit
c6e0f0533e
2 changed files with 62 additions and 0 deletions
|
|
@ -882,3 +882,12 @@ export const whenKey = register('whenKey', function (input, func, pat) {
|
||||||
export const keyDown = register('keyDown', function (pat) {
|
export const keyDown = register('keyDown', function (pat) {
|
||||||
return pat.fmap(_keyDown);
|
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`] = `
|
exports[`runs examples > example "density" example index 0 1`] = `
|
||||||
[
|
[
|
||||||
"[ 0/1 → 1/4 | s:crackle density:0.01 ]",
|
"[ 0/1 → 1/4 | s:crackle density:0.01 ]",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue