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

Support for combinations, e.g. Amaj7sus2 #114

Open
hyvyys opened this issue Oct 4, 2019 · 4 comments
Open

Support for combinations, e.g. Amaj7sus2 #114

hyvyys opened this issue Oct 4, 2019 · 4 comments

Comments

@hyvyys
Copy link

hyvyys commented Oct 4, 2019

Currently it seems there's not support for advanced chords like Amaj7sus2, C6add2, etc.

@hyvyys
Copy link
Author

hyvyys commented Oct 7, 2019

I checked out /packages/chord-dictionary/data.ts. I thought that tonal uses an algorithmic approach, not a dictionary. In see there's some heavy-weight music theory. In that case I'm not sure my chords qualify as proper real chords, but I swear I am able to play them on my guitar and even use in some songs ;D

Also, is (b5) on its own a valid chord, e.g. F(b5)?

@hyvyys
Copy link
Author

hyvyys commented Oct 7, 2019

Also, it would be nice to have an extra field in the chord object requiredNotes, typically the same as notes but often with omitted 5P.

@hyvyys
Copy link
Author

hyvyys commented Oct 7, 2019

From https://en.wikibooks.org/wiki/Music_Theory/Complete_List_of_Chord_Patterns#Alterations

The table below shows common altered chords:
....

The table itself only contains examples.

BTW I would not trust a wikipedia article to be complete, especially if its title says so. ;)

The required notes I was talking about would omit the steps that are parenthesized in the article.

@bitworking
Copy link

Hey, I found this issue because I'm developing a MIDI chord detection program. I also try to use this chord data from the wiki article. What I've done to allow these optional notes is to encode it as bitmasks and use bitwise operations. Maybe it's interesting for you:

const chordData = {
  // 1 3 (5) 7
  name: 'maj7',
  mask: 0b111111101111,
  bits: 0b100010000001,
};

// create integer from string bit representation, in this case 1 3 7

const chordBits = parseInt('100010000001', 2);

// compare to data

if ((chordBits & chordData.mask) === chordData.bits) {
  // matched
}

Nevertheless, I will probably no longer pursue this approach and switch to an algorithmic approach, because it would be very hard to implement inversion and slash chords in this way. The best library for inspiration that I've found is this: https://github.com/t-bre/MIDIAnalyser/blob/master/MIDIAnalyser_2-0-0/MIDIAnalyser/ChordAnalyser/ChordAnalyser.swift

It gets the intervals from the chord and find the tonality and all extensions by that. It also processes all inversions and it seems it works with slashed chords, too. But I don't know how good the namings are in the end or if these chords all make sense.

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

No branches or pull requests

2 participants