UNPKG

@typedin/music-utilities

Version:

A set of resources and modules I use to develop music applications.

46 lines 1.7 kB
import { getNextAlteration, getPreviousAlteration } from "../helpers/index.js"; import { getAlterationForAugmentedInterval } from "./getAlteration.js"; import { getAlterationForPerfectInterval } from "./getAlterationForPerfectInterval.js"; import { getName } from "./getName.js"; import { getNoteOctave } from "./getNoteOctave.js"; const specialCases = { up: [], down: [], }; const notesThatMakeOctaveChange = { up: ["C", "D", "E", "F", "G", "A", "B"], down: ["C", "D", "E", "F", "G", "A", "B"], }; const semitones = { special: { up: 12, down: 12, }, normal: { up: 12, down: 12, }, }; function DiminishedOctave(note, direction = "up") { return { name: getName(note, direction, semitones, specialCases), alteration: direction == "up" ? getPreviousAlteration(note.alteration) : getNextAlteration(note.alteration), octave: getNoteOctave(note, notesThatMakeOctaveChange[direction], direction), }; } function PerfectOctave(note, direction = "up") { return { name: getName(note, direction, semitones, specialCases), alteration: getAlterationForPerfectInterval(note, direction, specialCases), octave: getNoteOctave(note, notesThatMakeOctaveChange[direction], direction), }; } function AugmentedOctave(note, direction = "up") { return { name: getName(note, direction, semitones, specialCases), alteration: getAlterationForAugmentedInterval(note, direction, specialCases), octave: getNoteOctave(note, notesThatMakeOctaveChange[direction], direction), }; } export { DiminishedOctave, PerfectOctave, AugmentedOctave }; //# sourceMappingURL=Octave.js.map