mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-22 02:58:32 +00:00
compress
This commit is contained in:
parent
0df67fa920
commit
ca4bffe5a1
@ -657,15 +657,17 @@ class Pattern {
|
|||||||
return this.withQuerySpan(qf).withEventSpan(ef)._splitQueries();
|
return this.withQuerySpan(qf).withEventSpan(ef)._splitQueries();
|
||||||
}
|
}
|
||||||
|
|
||||||
_compressSpan(span) {
|
_compress(b, e) {
|
||||||
const b = span.begin;
|
|
||||||
const e = span.end;
|
|
||||||
if (b > e || b > 1 || e > 1 || b < 0 || e < 0) {
|
if (b > e || b > 1 || e > 1 || b < 0 || e < 0) {
|
||||||
return silence;
|
return silence;
|
||||||
}
|
}
|
||||||
return this._fastGap(Fraction(1).div(e.sub(b)))._late(b);
|
return this._fastGap(Fraction(1).div(e.sub(b)))._late(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_compressSpan(span) {
|
||||||
|
return this._compress(span.begin, span.end);
|
||||||
|
}
|
||||||
|
|
||||||
_fast(factor) {
|
_fast(factor) {
|
||||||
const fastQuery = this.withQueryTime((t) => t.mul(factor));
|
const fastQuery = this.withQueryTime((t) => t.mul(factor));
|
||||||
return fastQuery.withEventTime((t) => t.div(factor));
|
return fastQuery.withEventTime((t) => t.div(factor));
|
||||||
@ -1041,7 +1043,7 @@ function timeCat(...timepats) {
|
|||||||
const pats = [];
|
const pats = [];
|
||||||
for (const [time, pat] of timepats) {
|
for (const [time, pat] of timepats) {
|
||||||
const end = begin.add(time);
|
const end = begin.add(time);
|
||||||
pats.push(reify(pat)._compressSpan(new TimeSpan(begin.div(total), end.div(total))));
|
pats.push(reify(pat)._compress(begin.div(total), end.div(total)));
|
||||||
begin = end;
|
begin = end;
|
||||||
}
|
}
|
||||||
return stack(...pats);
|
return stack(...pats);
|
||||||
@ -1201,6 +1203,10 @@ Pattern.prototype.zoom = function (...args) {
|
|||||||
args = args.map(reify);
|
args = args.map(reify);
|
||||||
return patternify2(Pattern.prototype._zoom)(...args, this);
|
return patternify2(Pattern.prototype._zoom)(...args, this);
|
||||||
}
|
}
|
||||||
|
Pattern.prototype.compress = function (...args) {
|
||||||
|
args = args.map(reify);
|
||||||
|
return patternify2(Pattern.prototype._compress)(...args, this);
|
||||||
|
}
|
||||||
|
|
||||||
// call this after all Patter.prototype.define calls have been executed! (right before evaluate)
|
// call this after all Patter.prototype.define calls have been executed! (right before evaluate)
|
||||||
Pattern.prototype.bootstrap = function () {
|
Pattern.prototype.bootstrap = function () {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user