diff --git a/src/__tests__/scale.spec.ts b/src/__tests__/scale.spec.ts index 3b81a36..6773219 100644 --- a/src/__tests__/scale.spec.ts +++ b/src/__tests__/scale.spec.ts @@ -531,6 +531,20 @@ describe('Scale', () => { expect(scale.getMonzo(5).strictEquals(octave.monzo)).toBeTruthy(); }); + it('can generate rank 2 (down)', () => { + const fifth = new Interval( + ExtendedMonzo.fromFraction(new Fraction(3, 2), 2), + 'ratio' + ); + const octave = new Interval( + ExtendedMonzo.fromFraction(new Fraction(2), 3), + 'ratio' + ); + const scale = Scale.fromRank2(fifth, octave, 7, 1, 1); + expect([...Array(8).keys()].map(i => scale.getCents(i).toFixed(1))).toEqual( + ['0.0', '203.9', '407.8', '498.0', '702.0', '905.9', '1109.8', '1200.0'] + ); + }); it('can generate rank 2 (multiple periods per equave)', () => { const fifth = new Interval( ExtendedMonzo.fromFraction(new Fraction(3, 2), 2), diff --git a/src/scale.ts b/src/scale.ts index 459f187..9e8a1ef 100644 --- a/src/scale.ts +++ b/src/scale.ts @@ -178,7 +178,7 @@ export class Scale { intervals.push(generator.mul(i - down).mmod(period)); } const result = new Scale(intervals, period, baseFrequency); - result.sortInPlace(); + result.sortInPlace(false); return result.repeat(numPeriods); }