Skip to content

Commit

Permalink
Change M to m for medium step in line with aberrismic theory
Browse files Browse the repository at this point in the history
  • Loading branch information
inthar-raven committed Sep 8, 2024
1 parent 4fea422 commit 56bbc56
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 31 deletions.
10 changes: 5 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -472,8 +472,8 @@ <h1>Ternary scale properties</h1>
<tr>
<td>
<p>
Enter a specific ternary scale word using L, M, and s (use capital
M for medium):
Enter a specific ternary scale word using L, m, and s (use
lowercase m for medium):
</p>
</td>
</tr>
Expand All @@ -492,7 +492,7 @@ <h1>Ternary scale properties</h1>
<p>
Enter the numbers of step sizes as steps get smaller, as
positive numbers separated by spaces. For example, "3 2 2" means
3L2M2s.
3L2m2s.
</p>
</td>
</tr>
Expand Down Expand Up @@ -541,15 +541,15 @@ <h1>Ternary scale properties</h1>
name="monotone-lm"
value="on"
/>
<label for="monotone-lm">L = M</label>
<label for="monotone-lm">L = m</label>
<br />
<input
type="checkbox"
id="monotone-ms"
name="monotone-ms"
value="on"
/>
<label for="monotone-ms-on">M = s</label>
<label for="monotone-ms-on">m = s</label>
<br />
<input
type="checkbox"
Expand Down
18 changes: 9 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const statusElement = document.getElementById("status");

function displayStepVector(vector) {
const keys = [...Object.keys(vector)];
const sizeIdentifiers = ["L", "M", "s"];
const sizeIdentifiers = ["L", "m", "s"];
if (keys.length === 0) {
return "0";
}
Expand Down Expand Up @@ -293,7 +293,7 @@ import("./pkg").then((wasm) => {
case "L":
++sig[0];
break;
case "M":
case "m":
++sig[1];
break;
case "s":
Expand Down Expand Up @@ -348,12 +348,12 @@ import("./pkg").then((wasm) => {
let currentX = ORIGIN_X;
let currentY = ORIGIN_Y;
for (let deg = 0; deg < n; ++deg) {
svgTag.innerHTML += `<circle
svgTag.innerHTML += `<circle
cx="${currentX}"
cy="${currentY}"
r="${UNOCCUPIED_DOT_RADIUS}"
color="white"
stroke="black"
stroke="black"
stroke-width="1"
/>
<text
Expand All @@ -367,7 +367,7 @@ import("./pkg").then((wasm) => {
currentX += L_x * SPACING_X;
currentY += L_y * SPACING_Y; // SPACING_Y is negative since we represented y as positive.
break;
case "M":
case "m":
currentX += M_x * SPACING_X;
currentY += M_y * SPACING_Y;
break;
Expand Down Expand Up @@ -447,7 +447,7 @@ import("./pkg").then((wasm) => {
codeblock.innerHTML =
arity === 3
? `let L = ${currentTuning[0]}
let M = ${currentTuning[1]}
let m = ${currentTuning[1]}
let s = ${currentTuning[2]}
${arr.join(";")};
stack()`
Expand Down Expand Up @@ -488,8 +488,8 @@ stack()`
el.innerHTML += `Multiplicity ${JSON.stringify(structure["multiplicity"])}<br/>`; // TODO prettify
el.innerHTML += `Complexity ${JSON.stringify(structure["complexity"])}<br/><br/>`; // TODO prettify
el.innerHTML += `<b>Monotone MOS properties</b><br/>`;
el.innerHTML += currentProfile["lm"] ? `L = M<br/>` : "";
el.innerHTML += currentProfile["ms"] ? `M = s<br/>` : "";
el.innerHTML += currentProfile["lm"] ? `L = m<br/>` : "";
el.innerHTML += currentProfile["ms"] ? `m = s<br/>` : "";
el.innerHTML += currentProfile["s0"] ? `s = 0<br/>` : "";
if (
!currentProfile["lm"] &&
Expand Down Expand Up @@ -578,7 +578,7 @@ stack()`

document.getElementById("tables").innerHTML = `
<hr /><h2>Tables</h2>
<table>
<tr>
<td>
Expand Down
1 change: 0 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 19 additions & 16 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,30 @@ use words::{Chirality, Letter};
#[wasm_bindgen]
extern "C" {
fn alert(s: &str);
// Use `js_namespace` here to bind `console.log(..)` instead of just
// `log(..)`
#[wasm_bindgen(js_namespace = console)]
fn log(s: &str);
}

macro_rules! console_log {
// Note that this is using the `log` function imported above during
// `bare_bones`
($($t:tt)*) => (log(&format_args!($($t)*).to_string()))
}

const STEP_LETTERS: [&str; 12] = [
"", // 0
"X", // 1
"Ls", // 2
"LMs", // 3
"LMns", // 4
"HLMns", // 5
"HLMnst", // 6
"BHLMnst", // 7
"BHLMnstw", // 8
"BCHLMnstw", // 9
"BCHLMnpstw", // 10
"Lms", // 3
"Lmns", // 4
"HLmns", // 5
"HLmnst", // 6
"BHLmnst", // 7
"BHLmnstw", // 8
"BCHLmnstw", // 9
"BCHLmnpstw", // 10
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", // >= 11
];

Expand All @@ -53,14 +63,6 @@ pub const EDO_BOUND: i32 = 53;
pub const S_LOWER_BOUND: f64 = 20.0;
pub const S_UPPER_BOUND: f64 = 200.0;

#[wasm_bindgen]
extern "C" {
// Use `js_namespace` here to bind `console.log(..)` instead of just
// `log(..)`
#[wasm_bindgen(js_namespace = console)]
fn log(s: &str);
}

fn det3(v0: &[u8], v1: &[u8], v2: &[u8]) -> i16 {
v0[0] as i16 * v1[1] as i16 * v2[2] as i16
+ v0[1] as i16 * v1[2] as i16 * v2[0] as i16
Expand Down Expand Up @@ -321,6 +323,7 @@ pub fn word_to_profile(query: &[usize]) -> ScaleProfile {
&string_to_numbers(&brightest),
&step_sig,
) {
console_log!("{:?}: {:?}", query, guide_frames(query));
let (lattice_basis, structure) = pair;
ScaleProfile {
word: brightest,
Expand Down

0 comments on commit 56bbc56

Please sign in to comment.