Open yaxu opened 3 months ago
From discussion here: https://discord.com/channels/779427371270275082/937365093082079272/1086643898652311582
Pattern.prototype.enumerate = function () { const pat = this.sortHapsByPart() return new Pattern(state => { const haps = pat.query(state.withSpan(span => span.begin.wholeCycle())) const chunks = haps.length return haps.map((hap, i) => new Hap(hap.whole, hap.part.intersection(state.span), [hap.value, i, chunks]) ).filter(hap => hap.part != undefined) }).splitQueries() } Pattern.prototype.warp = function (tpat) { const pat = this; return tpat.enumerate().withValue(v => pat.zoom(Fraction(v[1]).div(v[2]), Fraction(v[1]).add(1).div(v[2])) ).outerJoin() }
From discussion here: https://discord.com/channels/779427371270275082/937365093082079272/1086643898652311582