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

getting four notes for a triad inversion #33

Open
eyaler opened this issue Sep 17, 2019 · 3 comments
Open

getting four notes for a triad inversion #33

eyaler opened this issue Sep 17, 2019 · 3 comments

Comments

@eyaler
Copy link

eyaler commented Sep 17, 2019

from pychord import Chord
print(Chord('A/C#').components())
['C#', 'A', 'C#', 'E'] #not sure why C# should appear twice?

@eyaler eyaler changed the title getting four notes for an inversion getting four notes for a triad inversion Sep 20, 2019
@yuma-m
Copy link
Owner

yuma-m commented Sep 29, 2019

Hello @eyaler

It is because, A/C# just means "C# root note" and "A major chord" in PyChrod.

A/C# -> C# + [A, C#, E]
Am7/G -> G + [A, C, E, G]

You can remove duplicated note in components by using set:set(Chord('A/C#').components()), but do you need another method which returns notes without duplication?

>>> Chord('A/C#').non_duplicated_components()
["C#", "A", "E"]  # or ["C#", "E", "A"] ?

@eyaler
Copy link
Author

eyaler commented Sep 29, 2019

thanks! i am not an expert on music theory but afaiu a/c# means inversion not doubling, when the new root is also part of the original chord. also in some other cases i do not see doubling in pychord

@eyaler
Copy link
Author

eyaler commented Sep 29, 2019

by the way, the issue with set() is that it doesn't preserve order of course. this would be a separate issue, but one can think of different logic depending on if you care about voicing (order and octaves) or not.

when i do not care about voicing i use: sorted(set([n%12 for n in components]))

you could have: letters, numbers, letters unique+sorted, numbers mod%12+unique+sorted

and i would use more intuitive name than "visible". eg: notes, numbers, notes_ignore_voicing, numbers_ignore voiceing, respectively for the above

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