Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Improved Chord dictionary & Chord detection #21

Merged
merged 12 commits into from
Nov 7, 2023
Merged

Conversation

ArTiSTiX
Copy link
Contributor

@ArTiSTiX ArTiSTiX commented Nov 7, 2023

Upgraded to tonal v5, which normally implements detecting chords assuming perfect Fifths.
But the tonal dictionary is incomplete and chord notation is not consistent.

So until tonal is updated, MIDI Jar will use a custom chord dictionary (more complete and indicating intervals that can be omitted), and a detection feature that allows omissions in chords.

It would let me fixing and completing the chord dictionary to update tonal.

Added:

  • Chord display now can display chords in different notation "flavours" - long, short or symbol.
  • Chord display can now display a full name of chord.
  • Chord display allow detecting chords with omitted intervals
  • Chord quiz also can do such.

NOTE:
Chord Quiz will by improved later to have more custom gameplay like allowing omissions too, being more strict, or even asking for a specific bass note / inversion.

@@ -78,6 +65,19 @@
const i = chord.notes.findIndex((note) => Note.chroma(note) === Note.chroma(pc));
if (i < 0) return '';

return chord.intervals[i];
return chord.intervals[i].replace('*', '');

Check failure

Code scanning / CodeQL

Incomplete string escaping or encoding

This replaces only the first occurrence of '*'.
});
}

export function removeIntervalWildcards(intervals: string[]) {
return intervals.map((interval) => interval.replace('*', ''));

Check failure

Code scanning / CodeQL

Incomplete string escaping or encoding

This replaces only the first occurrence of '*'.
@ArTiSTiX ArTiSTiX changed the title feat: Improved Chord dictionary & Chord Detection feat: Improved Chord dictionary & Chord detection Nov 7, 2023
@ArTiSTiX ArTiSTiX merged commit 1a24d64 into main Nov 7, 2023
@ArTiSTiX ArTiSTiX deleted the feat/chord-dict branch November 7, 2023 07:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant