diff options
author | Joris | 2024-08-18 14:06:59 +0200 |
---|---|---|
committer | Joris | 2024-08-18 14:06:59 +0200 |
commit | 3185e267a7a814cccc65a43a103618464ba181f8 (patch) | |
tree | feb20cda24a3b4b05fbfe6eef0749c8851eb86d2 | |
parent | 9660cb0eac5377caefacd3af94375331b9501a1d (diff) |
Apply chord shift to both chord and its base
-rw-r--r-- | public/main.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/public/main.js b/public/main.js index 46ce5e0..bfbc65a 100644 --- a/public/main.js +++ b/public/main.js @@ -30,6 +30,15 @@ function getShift(t1, t2) { } function applyShift(tonalities, t1, s) { + const xs = t1.split('/') + if (xs.length > 1) { + return `${applyShiftChord(tonalities, xs[0], s)}/${applyShiftChord(tonalities, xs[1], s)}` + } else { + return applyShiftChord(tonalities, t1, s) + } +} + +function applyShiftChord(tonalities, t1, s) { let root = getRoot(t1) const mode = t1.substring(root.length) const index = tonalities_b.indexOf(root) > -1 ? tonalities_b.indexOf(root) : tonalities_s.indexOf(root) |