mirror of
https://github.com/eliasstepanik/strudel.git
synced 2026-01-11 05:38:35 +00:00
Merge pull request #1314 from daslyfe/jade/alias
small feat: Add alias for segment and ribbon
This commit is contained in:
commit
9b4574c7b0
@ -2105,11 +2105,13 @@ export const linger = register(
|
||||
|
||||
/**
|
||||
* Samples the pattern at a rate of n events per cycle. Useful for turning a continuous pattern into a discrete one.
|
||||
* @name segment
|
||||
* @synonyms seg
|
||||
* @param {number} segments number of segments per cycle
|
||||
* @example
|
||||
* note(saw.range(40,52).segment(24))
|
||||
*/
|
||||
export const segment = register('segment', function (rate, pat) {
|
||||
export const { segment, seg } = register(['segment', 'seg'], function (rate, pat) {
|
||||
return pat.struct(pure(true)._fast(rate)).setSteps(rate);
|
||||
});
|
||||
|
||||
@ -2485,16 +2487,24 @@ export const bypass = register(
|
||||
);
|
||||
|
||||
/**
|
||||
* Loops the pattern inside at `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.
|
||||
* @name ribbon
|
||||
* @synonym rib
|
||||
* @param {number} offset start point of loop in cycles
|
||||
* @param {number} cycles loop length in cycles
|
||||
* @example
|
||||
* note("<c d e f>").ribbon(1, 2).fast(2)
|
||||
* note("<c d e f>").ribbon(1, 2)
|
||||
* @example
|
||||
* // Looping a portion of randomness
|
||||
* note(irand(8).segment(4).scale('C3 minor')).ribbon(1337, 2)
|
||||
* n(irand(8).segment(4)).scale("c:pentatonic").ribbon(1337, 2)
|
||||
* @example
|
||||
* // rhythm generator
|
||||
* s("bd!16?").ribbon(29,.5)
|
||||
*/
|
||||
export const ribbon = register('ribbon', (offset, cycles, pat) => pat.early(offset).restart(pure(1).slow(cycles)));
|
||||
export const { ribbon, rib } = register(['ribbon', 'rib'], (offset, cycles, pat) =>
|
||||
pat.early(offset).restart(pure(1).slow(cycles)),
|
||||
);
|
||||
|
||||
export const hsla = register('hsla', (h, s, l, a, pat) => {
|
||||
return pat.color(`hsla(${h}turn,${s * 100}%,${l * 100}%,${a})`);
|
||||
|
||||
@ -526,6 +526,9 @@ export const degradeByWith = register(
|
||||
* s("hh*8").degradeBy(0.2)
|
||||
* @example
|
||||
* s("[hh?0.2]*8")
|
||||
* @example
|
||||
* //beat generator
|
||||
* s("bd").segment(16).degradeBy(.5).ribbon(16,1)
|
||||
*/
|
||||
export const degradeBy = register(
|
||||
'degradeBy',
|
||||
|
||||
@ -2322,6 +2322,39 @@ exports[`runs examples > example "degradeBy" example index 1 1`] = `
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`runs examples > example "degradeBy" example index 2 1`] = `
|
||||
[
|
||||
"[ 1/8 → 3/16 | s:bd ]",
|
||||
"[ 1/4 → 5/16 | s:bd ]",
|
||||
"[ 5/16 → 3/8 | s:bd ]",
|
||||
"[ 1/2 → 9/16 | s:bd ]",
|
||||
"[ 9/16 → 5/8 | s:bd ]",
|
||||
"[ 11/16 → 3/4 | s:bd ]",
|
||||
"[ 15/16 → 1/1 | s:bd ]",
|
||||
"[ 9/8 → 19/16 | s:bd ]",
|
||||
"[ 5/4 → 21/16 | s:bd ]",
|
||||
"[ 21/16 → 11/8 | s:bd ]",
|
||||
"[ 3/2 → 25/16 | s:bd ]",
|
||||
"[ 25/16 → 13/8 | s:bd ]",
|
||||
"[ 27/16 → 7/4 | s:bd ]",
|
||||
"[ 31/16 → 2/1 | s:bd ]",
|
||||
"[ 17/8 → 35/16 | s:bd ]",
|
||||
"[ 9/4 → 37/16 | s:bd ]",
|
||||
"[ 37/16 → 19/8 | s:bd ]",
|
||||
"[ 5/2 → 41/16 | s:bd ]",
|
||||
"[ 41/16 → 21/8 | s:bd ]",
|
||||
"[ 43/16 → 11/4 | s:bd ]",
|
||||
"[ 47/16 → 3/1 | s:bd ]",
|
||||
"[ 25/8 → 51/16 | s:bd ]",
|
||||
"[ 13/4 → 53/16 | s:bd ]",
|
||||
"[ 53/16 → 27/8 | s:bd ]",
|
||||
"[ 7/2 → 57/16 | s:bd ]",
|
||||
"[ 57/16 → 29/8 | s:bd ]",
|
||||
"[ 59/16 → 15/4 | s:bd ]",
|
||||
"[ 63/16 → 4/1 | s:bd ]",
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`runs examples > example "delay" example index 0 1`] = `
|
||||
[
|
||||
"[ 0/1 → 1/2 | s:bd delay:0 ]",
|
||||
@ -7123,35 +7156,76 @@ exports[`runs examples > example "rev" example index 0 1`] = `
|
||||
|
||||
exports[`runs examples > example "ribbon" example index 0 1`] = `
|
||||
[
|
||||
"[ 0/1 → 1/2 | note:d ]",
|
||||
"[ 1/2 → 1/1 | note:e ]",
|
||||
"[ 1/1 → 3/2 | note:d ]",
|
||||
"[ 3/2 → 2/1 | note:e ]",
|
||||
"[ 2/1 → 5/2 | note:d ]",
|
||||
"[ 5/2 → 3/1 | note:e ]",
|
||||
"[ 3/1 → 7/2 | note:d ]",
|
||||
"[ 7/2 → 4/1 | note:e ]",
|
||||
"[ 0/1 → 1/1 | note:d ]",
|
||||
"[ 1/1 → 2/1 | note:e ]",
|
||||
"[ 2/1 → 3/1 | note:d ]",
|
||||
"[ 3/1 → 4/1 | note:e ]",
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`runs examples > example "ribbon" example index 1 1`] = `
|
||||
[
|
||||
"[ 0/1 → 1/4 | note:G3 ]",
|
||||
"[ 0/1 → 1/4 | note:A3 ]",
|
||||
"[ 1/4 → 1/2 | note:C3 ]",
|
||||
"[ 1/2 → 3/4 | note:D3 ]",
|
||||
"[ 3/4 → 1/1 | note:F3 ]",
|
||||
"[ 1/1 → 5/4 | note:Eb3 ]",
|
||||
"[ 5/4 → 3/2 | note:Ab3 ]",
|
||||
"[ 3/2 → 7/4 | note:G3 ]",
|
||||
"[ 7/4 → 2/1 | note:C4 ]",
|
||||
"[ 2/1 → 9/4 | note:G3 ]",
|
||||
"[ 3/4 → 1/1 | note:G3 ]",
|
||||
"[ 1/1 → 5/4 | note:E3 ]",
|
||||
"[ 5/4 → 3/2 | note:C4 ]",
|
||||
"[ 3/2 → 7/4 | note:A3 ]",
|
||||
"[ 7/4 → 2/1 | note:E4 ]",
|
||||
"[ 2/1 → 9/4 | note:A3 ]",
|
||||
"[ 9/4 → 5/2 | note:C3 ]",
|
||||
"[ 5/2 → 11/4 | note:D3 ]",
|
||||
"[ 11/4 → 3/1 | note:F3 ]",
|
||||
"[ 3/1 → 13/4 | note:Eb3 ]",
|
||||
"[ 13/4 → 7/2 | note:Ab3 ]",
|
||||
"[ 7/2 → 15/4 | note:G3 ]",
|
||||
"[ 15/4 → 4/1 | note:C4 ]",
|
||||
"[ 11/4 → 3/1 | note:G3 ]",
|
||||
"[ 3/1 → 13/4 | note:E3 ]",
|
||||
"[ 13/4 → 7/2 | note:C4 ]",
|
||||
"[ 7/2 → 15/4 | note:A3 ]",
|
||||
"[ 15/4 → 4/1 | note:E4 ]",
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`runs examples > example "ribbon" example index 2 1`] = `
|
||||
[
|
||||
"[ 1/16 → 1/8 | s:bd ]",
|
||||
"[ 1/8 → 3/16 | s:bd ]",
|
||||
"[ 3/16 → 1/4 | s:bd ]",
|
||||
"[ 1/4 → 5/16 | s:bd ]",
|
||||
"[ 3/8 → 7/16 | s:bd ]",
|
||||
"[ 9/16 → 5/8 | s:bd ]",
|
||||
"[ 5/8 → 11/16 | s:bd ]",
|
||||
"[ 11/16 → 3/4 | s:bd ]",
|
||||
"[ 3/4 → 13/16 | s:bd ]",
|
||||
"[ 7/8 → 15/16 | s:bd ]",
|
||||
"[ 17/16 → 9/8 | s:bd ]",
|
||||
"[ 9/8 → 19/16 | s:bd ]",
|
||||
"[ 19/16 → 5/4 | s:bd ]",
|
||||
"[ 5/4 → 21/16 | s:bd ]",
|
||||
"[ 11/8 → 23/16 | s:bd ]",
|
||||
"[ 25/16 → 13/8 | s:bd ]",
|
||||
"[ 13/8 → 27/16 | s:bd ]",
|
||||
"[ 27/16 → 7/4 | s:bd ]",
|
||||
"[ 7/4 → 29/16 | s:bd ]",
|
||||
"[ 15/8 → 31/16 | s:bd ]",
|
||||
"[ 33/16 → 17/8 | s:bd ]",
|
||||
"[ 17/8 → 35/16 | s:bd ]",
|
||||
"[ 35/16 → 9/4 | s:bd ]",
|
||||
"[ 9/4 → 37/16 | s:bd ]",
|
||||
"[ 19/8 → 39/16 | s:bd ]",
|
||||
"[ 41/16 → 21/8 | s:bd ]",
|
||||
"[ 21/8 → 43/16 | s:bd ]",
|
||||
"[ 43/16 → 11/4 | s:bd ]",
|
||||
"[ 11/4 → 45/16 | s:bd ]",
|
||||
"[ 23/8 → 47/16 | s:bd ]",
|
||||
"[ 49/16 → 25/8 | s:bd ]",
|
||||
"[ 25/8 → 51/16 | s:bd ]",
|
||||
"[ 51/16 → 13/4 | s:bd ]",
|
||||
"[ 13/4 → 53/16 | s:bd ]",
|
||||
"[ 27/8 → 55/16 | s:bd ]",
|
||||
"[ 57/16 → 29/8 | s:bd ]",
|
||||
"[ 29/8 → 59/16 | s:bd ]",
|
||||
"[ 59/16 → 15/4 | s:bd ]",
|
||||
"[ 15/4 → 61/16 | s:bd ]",
|
||||
"[ 31/8 → 63/16 | s:bd ]",
|
||||
]
|
||||
`;
|
||||
|
||||
|
||||
@ -179,25 +179,7 @@ export function SettingsTab({ started }) {
|
||||
value={togglePanelTrigger}
|
||||
onChange={(value) => settingsMap.setKey('togglePanelTrigger', value)}
|
||||
items={{ click: 'Click', hover: 'Hover' }}
|
||||
></ButtonGroup>
|
||||
{/* <Checkbox
|
||||
label="Click"
|
||||
onChange={(cbEvent) => {
|
||||
if (cbEvent.target.checked) {
|
||||
settingsMap.setKey('togglePanelTrigger', 'click');
|
||||
}
|
||||
}}
|
||||
value={togglePanelTrigger != 'hover'}
|
||||
/>
|
||||
<Checkbox
|
||||
label="Hover"
|
||||
onChange={(cbEvent) => {
|
||||
if (cbEvent.target.checked) {
|
||||
settingsMap.setKey('togglePanelTrigger', 'hover');
|
||||
}
|
||||
}}
|
||||
value={togglePanelTrigger == 'hover'}
|
||||
/> */}
|
||||
</FormItem>
|
||||
<FormItem label="More Settings">
|
||||
<Checkbox
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user