From 3185e267a7a814cccc65a43a103618464ba181f8 Mon Sep 17 00:00:00 2001 From: Joris Date: Sun, 18 Aug 2024 14:06:59 +0200 Subject: Apply chord shift to both chord and its base --- public/main.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'public/main.js') 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) -- cgit v1.2.3