From b9ce8b8c04c4e530d1eccb0e09bc182fd914117b Mon Sep 17 00:00:00 2001 From: Brian Cully Date: Mon, 10 Mar 2025 11:22:33 -0400 Subject: scale: throw when we can't calculate scale. --- scale.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scale.mjs b/scale.mjs index 5341413..485d0c5 100644 --- a/scale.mjs +++ b/scale.mjs @@ -18,11 +18,11 @@ function notesBetween(a, b) { } } +// todo: handle tonics with a flat ‘♭’, so we can deal with [BE]♭. function scaleFromIntervals(tonic, intervals) { const scaleIndex = chromaticScale.indexOf(tonic); if (scaleIndex < 0) { - console.error('tonic not found in scale', tonic, chromaticScale); - return undefined; + throw new Error(`tonic ${tonic} not found in scale ${chromaticScale.toString()}`); } let scale = [tonic]; -- cgit v1.2.3