diff options
author | C.K. Rooke <ckrooke@cro.wtf> | 2023-12-10 02:49:28 +0000 |
---|---|---|
committer | C.K. Rooke <ckrooke@cro.wtf> | 2023-12-10 02:49:28 +0000 |
commit | 1504f1ae2f1bc5005881ba80f51397320c8eaced (patch) | |
tree | f8c1e1d334ffbe66ddde146bddfd8072df80e3b5 /exp/practool.js |
Diffstat (limited to 'exp/practool.js')
-rw-r--r-- | exp/practool.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/exp/practool.js b/exp/practool.js new file mode 100644 index 0000000..782b992 --- /dev/null +++ b/exp/practool.js @@ -0,0 +1,20 @@ +let body = document.body; +let doc = {}; +body.querySelectorAll('[id]').forEach(e => doc[e.id] = e); + +let rand = x => Math.floor(Math.random() * x); +let arand = a => a[rand(a.length)] + +let roots = [ + "A", "B", "C", "D", "E", "F", "G", + "A#", "C#", "D#", "F#", "G#", + "Ab", "Bb", "Db", "Eb", "Gb", +]; +let modes = [ + "major", + "natural minor", "harmonic minor", "melodic minor", +]; +let random_scale = () => `${arand(roots)} ${arand(modes)}`; + +doc.scale_btn.onclick = () => doc.scale.innerHTML = random_scale(); +doc.scale_btn.onclick(); |