Przeglądaj źródła

Resolve 10ths/12ths->3rds/5ths, disable construct

Tenths and twelfths are now considered major 3rds and perfect fifths
because they are similar in function.

constructChord has been commented out for now due to incomplete
dictionary (which will be generated and provided differently through a
script).
master
TheoryOfNekomata 1 rok temu
rodzic
commit
448400f3fd
3 zmienionych plików z 11 dodań i 14 usunięć
  1. +4
    -3
      src/analyze.ts
  2. +0
    -4
      src/common.ts
  3. +7
    -7
      test/index.test.ts

+ 4
- 3
src/analyze.ts Wyświetl plik

@@ -25,10 +25,10 @@ const INTERVAL_COMPONENT_MAPPING = {
[Interval.MINOR_NINTH]: ChordComponent.NINTH,
[Interval.MAJOR_NINTH]: ChordComponent.NINTH,
[Interval.AUGMENTED_NINTH]: ChordComponent.NINTH,
[Interval.TENTH]: ChordComponent.TENTH,
[Interval.TENTH]: ChordComponent.THIRD,
[Interval.MINOR_ELEVENTH]: ChordComponent.ELEVENTH,
[Interval.MAJOR_ELEVENTH]: ChordComponent.ELEVENTH,
[Interval.TWELFTH]: ChordComponent.TWELFTH,
[Interval.TWELFTH]: ChordComponent.FIFTH,
[Interval.MINOR_THIRTEENTH]: ChordComponent.THIRTEENTH,
[Interval.MAJOR_THIRTEENTH]: ChordComponent.THIRTEENTH,
[Interval.AUGMENTED_THIRTEENTH]: ChordComponent.THIRTEENTH,
@@ -53,6 +53,7 @@ const getChordBase = (normalizedIntervals: Interval[]) => {
base: fifth === Interval.DIMINISHED_FIFTH ? ChordBase.DIMINISHED : ChordBase.MINOR,
};
case Interval.MAJOR_THIRD:
case Interval.TENTH:
if (fifth === Interval.AUGMENTED_FIFTH) {
return {
base: ChordBase.AUGMENTED,
@@ -145,7 +146,7 @@ const getChordSeventh = (
let newBase: ChordBase | undefined;
if (third === Interval.MINOR_THIRD) {
newBase = ChordBase.MINOR;
} else if (third === Interval.MAJOR_THIRD) {
} else if (third === Interval.MAJOR_THIRD || third === Interval.TENTH) {
newBase = ChordBase.MAJOR;
} else {
newBase = oldBase;


+ 0
- 4
src/common.ts Wyświetl plik

@@ -54,9 +54,7 @@ export enum ChordComponent {
SIXTH = 'SIXTH',
SEVENTH = 'SEVENTH',
NINTH = 'NINTH',
TENTH = 'TENTH',
ELEVENTH = 'ELEVENTH',
TWELFTH = 'TWELFTH',
THIRTEENTH = 'THIRTEENTH',
}

@@ -69,9 +67,7 @@ export const CHORD_COMPONENT_ORDERS = [
ChordComponent.SIXTH,
ChordComponent.SEVENTH,
ChordComponent.NINTH,
ChordComponent.TENTH,
ChordComponent.ELEVENTH,
ChordComponent.TWELFTH,
ChordComponent.THIRTEENTH,
];



+ 7
- 7
test/index.test.ts Wyświetl plik

@@ -9,16 +9,16 @@ import {
ChordComponent,
ChordExtensionType,
ChordModificationType,
constructChord,
// constructChord,
analyzeIntervals, getChordName,
} from '../src';

describe('constructChord', () => {
it('works', () => {
const chord = constructChord({ pitchClass: 0 });
expect(chord).toEqual([0, 4, 7]);
});
});
// describe('constructChord', () => {
// it('works', () => {
// const chord = constructChord({ pitchClass: 0 });
// expect(chord).toEqual([0, 4, 7]);
// });
// });

describe('analyzeChord', () => {
describe('building', () => {


Ładowanie…
Anuluj
Zapisz