diff --git a/packages/core/strudel.mjs b/packages/core/strudel.mjs index 1180ad6d..cd9c3b25 100644 --- a/packages/core/strudel.mjs +++ b/packages/core/strudel.mjs @@ -706,6 +706,8 @@ class Pattern { } _zoom(s, e) { + e = Fraction(e) + s = Fraction(s) const d = e.sub(s); return this.withQuerySpan((span) => span.withCycle((t) => t.mul(d).add(s))) .withEventSpan((span) => span.withCycle((t) => t.sub(s).div(d))) diff --git a/packages/core/test/pattern.test.mjs b/packages/core/test/pattern.test.mjs index afe6bf77..26450b2e 100644 --- a/packages/core/test/pattern.test.mjs +++ b/packages/core/test/pattern.test.mjs @@ -1,6 +1,6 @@ import Fraction from 'fraction.js'; -import { strict as assert } from 'assert'; +import { deepStrictEqual, strict as assert } from 'assert'; import { TimeSpan, @@ -656,4 +656,12 @@ describe('Pattern', function () { ); }); }); + describe('linger', () => { + it('Can linger on the first quarter of a cycle', () => { + assert.deepStrictEqual( + sequence(0, 1, 2, 3, 4, 5, 6, 7).linger(0.25).firstCycle(), + sequence(0, 1, 0, 1, 0, 1, 0, 1).firstCycle(), + ); + }); + }); });