Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #411 #501

Merged
merged 3 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@
const decimalFractionDigits = ref(5);
const showVirtualQwerty = ref(false);
const midiOctaveOffset = ref(-1);
const intervalMatrixIndexing = ref(0);

// Special keyboard codes also from local storage.
const deactivationCode = ref("Backquote");
Expand Down Expand Up @@ -783,7 +784,11 @@
if ("midiOctaveOffset" in storage) {
midiOctaveOffset.value = parseInt(storage.getItem("midiOctaveOffset")!);
}

if ("intervalMatrixIndexing" in storage) {
intervalMatrixIndexing.value = parseInt(
storage.getItem("intervalMatrixIndexing") ?? "0", 10

Check warning on line 789 in src/App.vue

View workflow job for this annotation

GitHub Actions / build (17.x)

Insert `⏎·····`
);
}
// Fetch special key map
if ("deactivationCode" in storage) {
deactivationCode.value = storage.getItem("deactivationCode")!;
Expand Down Expand Up @@ -968,6 +973,9 @@
watch(midiOctaveOffset, (newValue) =>
window.localStorage.setItem("midiOctaveOffset", newValue.toString())
);
watch(intervalMatrixIndexing, (newValue) =>
window.localStorage.setItem("intervalMatrixIndexing", newValue.toString())
);
// Store keymaps
watch(deactivationCode, (newValue) =>
window.localStorage.setItem("deactivationCode", newValue)
Expand Down Expand Up @@ -1069,6 +1077,7 @@
:keyboardMapping="keyboardMapping"
:showVirtualQwerty="showVirtualQwerty"
:midiOctaveOffset="midiOctaveOffset"
:intervalMatrixIndexing="intervalMatrixIndexing"
@update:audioDelay="audioDelay = $event"
@update:mainVolume="mainVolume = $event"
@update:scaleName="scaleName = $event"
Expand All @@ -1095,6 +1104,7 @@
@update:decimalFractionDigits="decimalFractionDigits = $event"
@update:showVirtualQwerty="showVirtualQwerty = $event"
@update:midiOctaveOffset="midiOctaveOffset = $event"
@update:intervalMatrixIndexing="intervalMatrixIndexing = $event"
@update:deactivationCode="deactivationCode = $event"
@update:equaveUpCode="equaveUpCode = $event"
@update:equaveDownCode="equaveDownCode = $event"
Expand Down
4 changes: 2 additions & 2 deletions src/analysis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ export function utonalFundamental(frequencies: number[], maxDivisor = 23) {
// Interval matrix a.k.a the modes of a scale
export function intervalMatrix(scale: Scale) {
const result = [];
const degrees = [...Array(scale.size + 1).keys()];
const columns = [...Array(scale.size + 1).keys()];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A little unrelated, but OK...

for (let i = 0; i < scale.size; ++i) {
const mode = scale.rotate(i);
result.push(degrees.map((j) => mode.getInterval(j)));
result.push(columns.map((j) => mode.getInterval(j)));
}
return result;
}
1 change: 1 addition & 0 deletions src/views/AboutView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
Lajos Mészáros - <i>developer</i><br />
Forrest Cahoon - <i>developer</i> <br />
Videco - <i>developer</i> <br />
Inthar - <i>developer</i> <br />
Kraig Grady - <i>lattice advisor</i>
</p>
</div>
Expand Down
35 changes: 33 additions & 2 deletions src/views/AnalysisView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,17 @@ const props = defineProps<{
scale: Scale;
virtualSynth: VirtualSynth;
colorScheme: "light" | "dark";
intervalMatrixIndexing: number;
}>();

const emit = defineEmits(["update:intervalMatrixIndexing"]);

const intervalMatrixIndexing = computed({
get: () => props.intervalMatrixIndexing,
set: (newValue: string) =>
emit("update:intervalMatrixIndexing", parseInt(newValue, 10)),
});

const cellFormat = ref<"best" | "cents" | "decimal">("best");
const trailLongevity = ref(70);
const maxOtonalRoot = ref(16);
Expand Down Expand Up @@ -100,9 +109,9 @@ const matrix = computed(() => {
<tr>
<th></th>
<th v-for="i of Math.min(scale.size, MAX_SCALE_SIZE)" :key="i">
{{ i }}
{{ i - 1 + intervalMatrixIndexing }}
</th>
<th>({{ scale.size + 1 }})</th>
<th>({{ scale.size + intervalMatrixIndexing }})</th>
</tr>
<tr v-for="(row, i) of matrix" :key="i">
<th>{{ formatMatrixCell(scale.getInterval(i)) }}</th>
Expand Down Expand Up @@ -143,6 +152,28 @@ const matrix = computed(() => {
<label for="format-decimal"> Decimal ratio </label>
</span>
</div>
<div class="control radio-group">
<label>Interval indexing</label>
<span>
<input
type="radio"
id="indexing-zero"
value="0"
v-model="intervalMatrixIndexing"
/>
<label for="indexing-zero"> 0-indexing (default) </label>
</span>

<span>
<input
type="radio"
id="indexing-one"
value="1"
v-model="intervalMatrixIndexing"
/>
<label for="indexing-one"> 1-indexing </label>
</span>
</div>
</div>
<div class="columns-container">
<div class="column">
Expand Down