summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Cully <bjc@spork.org>2025-03-10 11:22:33 -0400
committerBrian Cully <bjc@spork.org>2025-03-10 11:22:33 -0400
commitb9ce8b8c04c4e530d1eccb0e09bc182fd914117b (patch)
treecb46895ae09140acd8f5367d30fc586b4f071107
parent82b5ae6deb3057b53e40a6c378709a03020e00c3 (diff)
downloadchords-b9ce8b8c04c4e530d1eccb0e09bc182fd914117b.tar.gz
chords-b9ce8b8c04c4e530d1eccb0e09bc182fd914117b.zip
scale: throw when we can't calculate scale.
-rw-r--r--scale.mjs4
1 files 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];