cuthbertLab / music21

music21 is a Toolkit for Computational Musicology
https://www.music21.org/
Other
2.12k stars 401 forks source link

ChordSymbols: addb7 gives doubly-flatted seventh #1570

Closed Dazzid closed 1 year ago

Dazzid commented 1 year ago

music21 version

9.8.7

Problem summary

music21 is encoding several chords wrongly. 1) Csus add b7, it seems no allowed this very common jazz chord, as it decoded it as ['C2', 'F2', 'G2', 'A3'] 2) Slash chords with extensions need to be corrected. For example, I'm parsing an XML file of a song with an F# b9 / B, and music21 decodes it as F#7/B add b9, which is a huge error. Is there a way to fix it? 

Steps to reproduce

element = 'Csus add b7'
tmp = m21.harmony.ChordSymbol(element)
theNotes = [str(p) for p in tmp.pitches]
print(theNotes)

Expected vs. actual behavior

More information

jacobtylerwalls commented 1 year ago

Csus add b7, it seems no allowed this very common jazz chord, as it decoded it as ['C2', 'F2', 'G2', 'A3']

Csusadd7 (or even "C7sus") gives what you want.

Looks like the redundant "b" in "b7" (perhaps a "Nashville number"?) is causing music21 to doubly-flat the 7th. We can avoid that, I'll open a PR.


Slash chords with extensions need to be corrected. For example, I'm parsing an XML file of a song with an F# b9 / B, and music21 decodes it as F#7/B add b9, which is a huge error. Is there a way to fix it?

I'll need more information to reproduce. I created a file with the chord symbol "F# b9 / B", exported a musicxml file, imported that, and retrieved the expected pitches:

      <harmony print-frame="no">
        <root>
          <root-step>F</root-step>
          <root-alter>1</root-alter>
          </root>
        <kind>major</kind>
        <degree>
          <degree-value>9</degree-value>
          <degree-alter>-1</degree-alter>
          <degree-type>add</degree-type>
          </degree>
        <bass>
          <bass-step>B</bass-step>
          </bass>
        </harmony>
>>> s["ChordSymbol"].first().pitches
(<music21.pitch.Pitch B1>, <music21.pitch.Pitch F#2>, <music21.pitch.Pitch A#2>, <music21.pitch.Pitch C#3>, <music21.pitch.Pitch G3>)