Skip to content

Commit

Permalink
Admit cents as the equave when generating equal temperaments
Browse files Browse the repository at this point in the history
ref #803
  • Loading branch information
frostburn committed Aug 14, 2024
1 parent 0f3c370 commit ce94f17
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Change log

## 3.0.2
* Bug fix: Admit cents as the equave when generating equal temperaments [#803](https://github.com/xenharmonic-devs/scale-workshop/issues/803)

## 3.0.1
* Feature: Apply CS margin to variety signature on Analysis tab [#796](https://github.com/xenharmonic-devs/scale-workshop/issues/796)
* Feature: Approximate Tenney-tall fractions on Analysis tab [#796](https://github.com/xenharmonic-devs/scale-workshop/issues/796)
Expand Down
16 changes: 15 additions & 1 deletion cypress/e2e/basic.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,18 @@ describe("Scale generation/modification", () => {
cy.get("button").contains("Done").click();
cy.get("#scale-data").should("contain.value", "8/7");
});
});

it("generates and displays 5 equal divisions of 1234.5 cents", () => {
cy.visit("/");

cy.get("a").contains("New scale").click();
cy.get("a").contains("Equal temperament").click();
cy.get("#equave").clear();
cy.get("#equave").type('1234.5');
cy.get("button").contains("OK").click();
cy.get("#scale-data").should("contain.value", "1\\5 ed 1234.5");

// This is how SonicWeave formats "3\5 ed 1234.5"
cy.get('.tuning-table').should("contain", "2469\\4000");
})
});
12 changes: 9 additions & 3 deletions src/components/modals/generation/EqualTemperament.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,17 @@ function generate(expand = true) {
}
} else {
const ed = modal.divisions
const ji = modal.equave.toString()
if (expand || !modal.simpleEd) {
source = modal.degrees.map((steps) => `${steps}\\${ed}<${ji}>`).join('\n')
try {
// Prefer restricted 7\13<3> form
const ji = modal.equave.toFraction().toFraction()
source = modal.degrees.map((steps) => `${steps}\\${ed}<${ji}>`).join('\n')
} catch {
// Fall back to generic 7\13 ed 1912.3456 form
source = modal.degrees.map((steps) => `${steps}\\${ed} ed ${modal.equave}`).join('\n')
}
} else {
source = `tet(${ed}, ${ji})`
source = `tet(${ed}, ${modal.equave})`
}
}
emit('update:source', source)
Expand Down

0 comments on commit ce94f17

Please sign in to comment.