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

Incorrect chord recognition if the notes are in a non-rotated order #73

Open
adamnemecek opened this issue Dec 14, 2021 · 2 comments
Open

Comments

@adamnemecek
Copy link

adamnemecek commented Dec 14, 2021

I ran into this issue. If you try to recognize a say cmaj like so

ch = find_chords_from_notes(["C", "E", "G"])

It works correctly.

However, if i reorder the notes in a way that is not a rotation of the chord

ch = find_chords_from_notes(["C", "G", "E"])

finds nothing.

Would sorting the nodes before recognizing the chord help?

@yuma-m
Copy link
Owner

yuma-m commented Dec 19, 2021

Hi @adamnemecek,

Thank you for raising this. PyChord supports slash chords that just rotated the original order.

find_chords_from_notes(["C", "E", "G"])
[<Chord: C>]
find_chords_from_notes(["E", "G", "C"])
[<Chord: C/E>]
find_chords_from_notes(["G", "C", "E"])
[<Chord: C/G>]

However, it doesn't support various inversion.

find_chords_from_notes(["C", "G", "E"])  ## Should return "C"?
[]
find_chords_from_notes(["G", "C", "E", "Bb"])  ## Should return "C7/G"
[]

Sorting the components will work for some cases but it may change the original chord. I have no quick solution for this issue, but let me consider how PyChord can cope with this.

@yuma-m
Copy link
Owner

yuma-m commented Dec 19, 2021

A quick workaround for this issue is to add some Qualities using QualityManager.

from pychord import QualityManager
quality_manager = QualityManager()
quality_manager.set_quality("(inv)", (0, 7, 16))
find_chords_from_notes(["C", "G", "E"])
[<Chord: C(inv)>]

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