Browse Source

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 year ago
parent
commit
448400f3fd
3 changed files with 11 additions and 14 deletions
  1. +4
    -3
      src/analyze.ts
  2. +0
    -4
      src/common.ts
  3. +7
    -7
      test/index.test.ts

+ 4
- 3
src/analyze.ts View File

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


+ 0
- 4
src/common.ts View File

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


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




+ 7
- 7
test/index.test.ts View File

@@ -9,16 +9,16 @@ import {
ChordComponent, ChordComponent,
ChordExtensionType, ChordExtensionType,
ChordModificationType, ChordModificationType,
constructChord,
// constructChord,
analyzeIntervals, getChordName, analyzeIntervals, getChordName,
} from '../src'; } 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('analyzeChord', () => {
describe('building', () => { describe('building', () => {


Loading…
Cancel
Save