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

Chord encoding always adds root note even if not annotated #304

Open
fdlm opened this issue Jan 13, 2019 · 4 comments
Open

Chord encoding always adds root note even if not annotated #304

fdlm opened this issue Jan 13, 2019 · 4 comments
Labels

Comments

@fdlm
Copy link
Contributor

fdlm commented Jan 13, 2019

Currently, the root of the chord is always added to the semitone bitmap. The encoding thus does not distinguish between, e.g., C:maj (or, C:(1,3,5)) and C:(3,5):

>>> mir_eval.chord.encode('C:maj')
(0, array([1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0]), 0)
>>> mir_eval.chord.encode('C:(3,5)')
(0, array([1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0]), 0)

According to Harte's format definition (see his dissertation, page 100), the two should be treated differently:

This syntax also allows for the case where we have a chord with an
implied root note (such as the C major chord in the example from the
second bar in Figure 4.6). In the example of the C major chord where the
root is not voiced (Figure 4.7d) we can represent it in this way:
C:(3,5)

@craffel
Copy link
Owner

craffel commented Jan 13, 2019

@ejhumphrey @bmcfee

@bmcfee
Copy link
Collaborator

bmcfee commented Jan 14, 2019

I see what you mean, but I think the example that Harte gives is inconsistent with the general semantics of added / suppressed notes. My understanding, which may diverge from Harte's, is that notes in parenthesis are added or suppressed relative to the stated quality, and that the default quality (absent an explicit name) is a major triad. In that sense, a rootless C:maj could be encoded as C:(*1), where the 3 and 5 are left in by default. I would expect C:(3,5) to be a no-op on C:maj since those notes are already present.

If we do not take the above interpretation, then the consistent alternative is that when parentheses are used, all notes must be explicitly coded. I don't think that's how most people use this notation, but I'm willing to be convinced otherwise.

@fdlm
Copy link
Contributor Author

fdlm commented Jan 14, 2019

In Harte's definition, parentheses are not used to denote added/suspended notes. Instead, they directly define the chord intervals. According to Harte, the fundamental notation is root : (interval1, interval2, ...) / bass. There is no such thing as "default quality" (see 4.2.3 in his diss). Shorthand notations like maj, min, sus2 etc. are only introduced afterwards. These "map directly to pre-defined interval lists for the most common chordtypes" (4.2.4). One can then change these pre-defined interval lists with additional intervals in parentheses, and remove intervals using the * symbol. As shown in his thesis, the syntax becomes root : shorthand (additional intervals) / bass.

I believe his definition is consistent, and I think we should stick to it until some better alternative is found. This probably does not affect many use cases, as annotations as G:(3,5) are rare, but I think they still should be parsed correctly (i.e., according to Harte's syntax definition).

@bmcfee
Copy link
Collaborator

bmcfee commented Jan 14, 2019

I think that makes sense -- I'd like to get @ejhumphrey and @mattmcvicar 's take on things as well, since they've been at chords longer than I.

Having thought about your interpretation a bit more, I think it all comes down to the default quality assumption. When a quality shorthand is explicitly coded, I think both of our interpretations are equivalent, and perhaps I was incorrectly generalizing the add/suppress notion to the case without shorthand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants