Skip to content

Commit

Permalink
Use MIDI octave offset while exporting
Browse files Browse the repository at this point in the history
ref #401
  • Loading branch information
frostburn committed Nov 26, 2023
1 parent 4c36ca7 commit ec8c2f2
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/components/ScaleBuilder.vue
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ function doExport(exporter: ExporterKey) {
scale: props.scale,
filename: sanitizeFilename(props.scaleName),
baseMidiNote: props.baseMidiNote,
midiOctaveOffset: props.midiOctaveOffset,
description: props.scaleName,
lines: props.scaleLines,
appTitle: APP_TITLE,
Expand Down
1 change: 1 addition & 0 deletions src/exporters/__tests__/test-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export function getTestData(appTitle: string) {
appTitle,
description: "A scale for testing if the exporter works",
baseMidiNote: 69,
midiOctaveOffset: 0,
lines: [
"100.",
"4\\5",
Expand Down
1 change: 1 addition & 0 deletions src/exporters/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export type ExporterParams = {
scale: Scale;
filename: string;
baseMidiNote: number;
midiOctaveOffset: number;
name?: string;
scaleUrl?: string;
description?: string;
Expand Down
2 changes: 1 addition & 1 deletion src/exporters/deflemask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default class DeflemaskExporter extends BaseExporter {
continue;

// convert note number to note name
let name = midiNoteNumberToName(noteNumber);
let name = midiNoteNumberToName(noteNumber, this.params.midiOctaveOffset);
name = name.length == 2 ? name.slice(0, 1) + "-" + name.slice(1) : name;

// convert cents offset to hex where -100c=00, 0c=80, 100c=FF
Expand Down
2 changes: 1 addition & 1 deletion src/exporters/kontakt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default class KontaktExporter extends BaseExporter {
"MIDI note " +
baseMidiNote.toString() +
" (" +
midiNoteNumberToName(baseMidiNote) +
midiNoteNumberToName(baseMidiNote, this.params.midiOctaveOffset) +
") = " +
this.params.scale.baseFrequency.toString() +
" Hz" +
Expand Down

0 comments on commit ec8c2f2

Please sign in to comment.