mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-19 09:38:38 +00:00
implement "?" operator in minilanguage (for degradeBy)
this will require update to krill-parser.js (aggregated in later commit) to work properly
This commit is contained in:
parent
8244ba7754
commit
964ee68974
@ -102,7 +102,7 @@ slice = step / sub_cycle / timeline
|
|||||||
|
|
||||||
// slice modifier affects the timing/size of a slice (e.g. [a b c]@3)
|
// slice modifier affects the timing/size of a slice (e.g. [a b c]@3)
|
||||||
// at this point, we assume we can represent them as regular sequence operators
|
// at this point, we assume we can represent them as regular sequence operators
|
||||||
slice_modifier = slice_weight / slice_bjorklund / slice_slow / slice_fast / slice_fixed_step / slice_replicate
|
slice_modifier = slice_weight / slice_bjorklund / slice_slow / slice_fast / slice_fixed_step / slice_replicate / slice_degrade
|
||||||
|
|
||||||
slice_weight = "@" a:number
|
slice_weight = "@" a:number
|
||||||
{ return { weight: a} }
|
{ return { weight: a} }
|
||||||
@ -122,6 +122,9 @@ slice_fast = "*"a:number
|
|||||||
slice_fixed_step = "%"a:number
|
slice_fixed_step = "%"a:number
|
||||||
{ return { operator : { type_: "fixed-step", arguments_ :{ amount:a } } } }
|
{ return { operator : { type_: "fixed-step", arguments_ :{ amount:a } } } }
|
||||||
|
|
||||||
|
slice_degrade = "?"a:number?
|
||||||
|
{ return { operator : { type_: "degradeBy", arguments_ :{ amount:(a? a : 0.5) } } } }
|
||||||
|
|
||||||
// a slice with an modifier applied i.e [bd@4 sd@3]@2 hh]
|
// a slice with an modifier applied i.e [bd@4 sd@3]@2 hh]
|
||||||
slice_with_modifier = s:slice o:slice_modifier?
|
slice_with_modifier = s:slice o:slice_modifier?
|
||||||
{ return new ElementStub(s, o);}
|
{ return new ElementStub(s, o);}
|
||||||
|
|||||||
@ -21,6 +21,8 @@ const applyOptions = (parent) => (pat, i) => {
|
|||||||
return reify(pat).fast(speed);
|
return reify(pat).fast(speed);
|
||||||
case 'bjorklund':
|
case 'bjorklund':
|
||||||
return pat.euclid(operator.arguments_.pulse, operator.arguments_.step, operator.arguments_.rotation);
|
return pat.euclid(operator.arguments_.pulse, operator.arguments_.step, operator.arguments_.rotation);
|
||||||
|
case 'degradeBy':
|
||||||
|
return reify(pat)._degradeByWith(strudel.rand.early(0.0001 * _nextSeed()).segment(1), operator.arguments_.amount);
|
||||||
// TODO: case 'fixed-step': "%"
|
// TODO: case 'fixed-step': "%"
|
||||||
}
|
}
|
||||||
console.warn(`operator "${operator.type_}" not implemented`);
|
console.warn(`operator "${operator.type_}" not implemented`);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user