diff options
author | Brian Cully <bjc@spork.org> | 2025-03-10 11:22:33 -0400 |
---|---|---|
committer | Brian Cully <bjc@spork.org> | 2025-03-10 11:22:33 -0400 |
commit | b9ce8b8c04c4e530d1eccb0e09bc182fd914117b (patch) | |
tree | cb46895ae09140acd8f5367d30fc586b4f071107 | |
parent | 82b5ae6deb3057b53e40a6c378709a03020e00c3 (diff) | |
download | chords-b9ce8b8c04c4e530d1eccb0e09bc182fd914117b.tar.gz chords-b9ce8b8c04c4e530d1eccb0e09bc182fd914117b.zip |
scale: throw when we can't calculate scale.
-rw-r--r-- | scale.mjs | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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]; |