diff options
| author | julian laplace <julescarbon@gmail.com> | 2025-07-13 16:40:29 +0200 |
|---|---|---|
| committer | julian laplace <julescarbon@gmail.com> | 2025-07-13 16:40:29 +0200 |
| commit | edaae6d07fa1abb1e3a9ae8e113bddd663c89c5b (patch) | |
| tree | b1be07cc75587726926038d48777a58617c7f109 /bundle.js | |
| parent | fa85c6c0dfdb074fe7638566bd0cd71d7aaa37c6 (diff) | |
add hyperbolic scale mode
Diffstat (limited to 'bundle.js')
| -rw-r--r-- | bundle.js | 35 |
1 files changed, 28 insertions, 7 deletions
@@ -38148,6 +38148,11 @@ var scales = exports.scales = [{ name: "natural", get: function get(i, j) { get: function get(ii, jj, i, j) { return [a[i], b[j]]; } +}, { + name: "hyperbolic", + get: function get(ii, jj, i, j, x, y) { + return [1 + i * (x + 1) / (y + 1), 1 + j * (x + 1) / (y + 1)]; + } }, // { // name: "triangle", @@ -38809,9 +38814,21 @@ function add(i, j) { } var a_inv = a * denominator; var b_inv = b * numerator; - var ba_gcd = (0, _computeGcd2.default)(a_inv, b_inv); - var a_disp = a_inv / ba_gcd; - var b_disp = b_inv / ba_gcd; + var a_disp = void 0, + b_disp = void 0; + if (scale.name === "hyperbolic") { + a_inv *= Math.round(base_y) + 1; + b_inv *= Math.round(base_y) + 1; + var ba_gcd = (0, _computeGcd2.default)(Math.round(a_inv), Math.round(b_inv)); + a_disp = Math.round(a_inv / ba_gcd); + b_disp = Math.round(b_inv / ba_gcd); + // a_disp = Math.round(a_inv); + // b_disp = Math.round(b_inv); + } else { + var _ba_gcd = (0, _computeGcd2.default)(a_inv, b_inv); + a_disp = a_inv / _ba_gcd; + b_disp = b_inv / _ba_gcd; + } frac = Math.log2(isEqualTemperament ? interval : aa / bb) % 1; @@ -38938,11 +38955,15 @@ function bind() { document.querySelector("#help-button").addEventListener("click", function () { return document.querySelector("#help").classList.toggle("visible"); }); - document.querySelector("#pythagorean").addEventListener("click", function () { - scaleMode = _scales.scales.findIndex(function (scale) { - return scale.name === "pythagorean"; + Array.from(document.querySelectorAll(".mode")).forEach(function (el) { + console.log(el.getAttribute("name")); + el.addEventListener("click", function (event) { + var name = el.getAttribute("name"); + scaleMode = _scales.scales.findIndex(function (scale) { + return scale.name === name; + }); + rebuild(); }); - rebuild(); }); // Wheel to scroll |
