patternify slow, early and late
This commit is contained in:
parent
de7b67f085
commit
988e81670d
1 changed files with 13 additions and 3 deletions
16
strudel.mjs
16
strudel.mjs
|
|
@ -444,20 +444,30 @@ class Pattern {
|
||||||
_slow(factor) {
|
_slow(factor) {
|
||||||
return this._fast(1/factor)
|
return this._fast(1/factor)
|
||||||
}
|
}
|
||||||
// slow = _patternify(_slow)
|
|
||||||
|
slow(factor) {
|
||||||
|
return this._patternify(Pattern.prototype._slow)(factor)
|
||||||
|
}
|
||||||
|
|
||||||
_early(offset) {
|
_early(offset) {
|
||||||
// Equivalent of Tidal's <~ operator
|
// Equivalent of Tidal's <~ operator
|
||||||
offset = Fraction(offset)
|
offset = Fraction(offset)
|
||||||
return this.withQueryTime(t => t.add(offset)).withEventTime(t => t.sub(offset))
|
return this.withQueryTime(t => t.add(offset)).withEventTime(t => t.sub(offset))
|
||||||
}
|
}
|
||||||
// early = _patternify(_early)
|
|
||||||
|
early(factor) {
|
||||||
|
return this._patternify(Pattern.prototype._early)(factor)
|
||||||
|
}
|
||||||
|
|
||||||
_late(offset) {
|
_late(offset) {
|
||||||
// Equivalent of Tidal's ~> operator
|
// Equivalent of Tidal's ~> operator
|
||||||
return this._early(0-offset)
|
return this._early(0-offset)
|
||||||
}
|
}
|
||||||
// late = _patternify(_late)
|
|
||||||
|
|
||||||
|
late(factor) {
|
||||||
|
return this._patternify(Pattern.prototype._late)(factor)
|
||||||
|
}
|
||||||
|
|
||||||
when(binary_pat, func) {
|
when(binary_pat, func) {
|
||||||
//binary_pat = sequence(binary_pat)
|
//binary_pat = sequence(binary_pat)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue