From 448400f3fdb4b70368c70f8eac5764153f7b52db Mon Sep 17 00:00:00 2001 From: TheoryOfNekomata Date: Tue, 4 Apr 2023 20:07:36 +0800 Subject: [PATCH] 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). --- src/analyze.ts | 7 ++++--- src/common.ts | 4 ---- test/index.test.ts | 14 +++++++------- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/analyze.ts b/src/analyze.ts index 254ad82..98c8d6b 100644 --- a/src/analyze.ts +++ b/src/analyze.ts @@ -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; diff --git a/src/common.ts b/src/common.ts index 883d2dd..c844d90 100644 --- a/src/common.ts +++ b/src/common.ts @@ -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, ]; diff --git a/test/index.test.ts b/test/index.test.ts index 933e646..299adae 100644 --- a/test/index.test.ts +++ b/test/index.test.ts @@ -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', () => {