diff --git a/packages/tonal/test/tonal.test.mjs b/packages/tonal/test/tonal.test.mjs index 7459ce3d..0db68404 100644 --- a/packages/tonal/test/tonal.test.mjs +++ b/packages/tonal/test/tonal.test.mjs @@ -30,4 +30,11 @@ describe('tonal', () => { .firstCycleValues.map((h) => h.note), ).toEqual(['C3', 'D3', 'E3']); }); + it('scale with colon', () => { + expect( + n(0, 1, 2) + .scale('C:major') + .firstCycleValues.map((h) => h.note), + ).toEqual(['C3', 'D3', 'E3']); + }); }); diff --git a/packages/tonal/tonal.mjs b/packages/tonal/tonal.mjs index 206ea840..9a6c16bb 100644 --- a/packages/tonal/tonal.mjs +++ b/packages/tonal/tonal.mjs @@ -146,6 +146,7 @@ export const scale = register('scale', function (scale /* : string */, pat) { let note = isObject ? hap.value.n : hap.value; const asNumber = Number(note); if (!isNaN(asNumber)) { + scale = scale.replaceAll(':', ' '); let [tonic, scaleName] = Scale.tokenize(scale); const { pc, oct = 3 } = Note.get(tonic); note = scaleOffset(pc + ' ' + scaleName, asNumber, pc + oct);