diff --git a/packages/core/pattern.mjs b/packages/core/pattern.mjs index b755d095..4f0d3576 100644 --- a/packages/core/pattern.mjs +++ b/packages/core/pattern.mjs @@ -1820,7 +1820,10 @@ export const { fastGap, fastgap } = register(['fastGap', 'fastgap'], function (f export const focus = register('focus', function (b, e, pat) { b = Fraction(b); e = Fraction(e); - return pat._fast(Fraction(1).div(e.sub(b))).late(b.cyclePos()); + return pat + ._early(b.sam()) + ._fast(Fraction(1).div(e.sub(b))) + ._late(b); }); export const { focusSpan, focusspan } = register(['focusSpan', 'focusspan'], function (span, pat) { diff --git a/packages/core/test/pattern.test.mjs b/packages/core/test/pattern.test.mjs index 0696f0e5..0b72d08a 100644 --- a/packages/core/test/pattern.test.mjs +++ b/packages/core/test/pattern.test.mjs @@ -1265,4 +1265,14 @@ describe('Pattern', () => { expect(s('bev').chop(8).loopAt(2)._steps).toStrictEqual(Fraction(4)); }); }); + describe('bite', () => { + it('works with uneven patterns', () => { + sameFirst( + fastcat(slowcat('a', 'b', 'c', 'd', 'e'), slowcat(1, 2, 3, 4, 5)) + .bite(2, stepcat(pure(0), pure(1).expand(2))) + .fast(5), + stepcat(slowcat('a', 'b', 'c', 'd', 'e'), slowcat(1, 2, 3, 4, 5).expand(2)).fast(5), + ); + }); + }); });