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

Same figure in rntxt file differs from instantiated RomanNumeral object #1229

Closed
napulen opened this issue Feb 20, 2022 · 5 comments · Fixed by #1230
Closed

Same figure in rntxt file differs from instantiated RomanNumeral object #1229

napulen opened this issue Feb 20, 2022 · 5 comments · Fixed by #1230

Comments

@napulen
Copy link
Contributor

napulen commented Feb 20, 2022

Minimal reproducibility code:

In [1]: import music21

In [2]: music21.__version__
Out[2]: '7.1.0'

In [3]: rntxt = music21.converter.parse("text.rntxt")

In [4]: for rn in rntxt.flat.notes:
   ...:     print(rn, rn.pitchClasses)
   ...:
<music21.roman.RomanNumeral #viø4/3 in f minor> [8, 0, 2, 5]

In [5]: rn2 = music21.roman.RomanNumeral("#viø4/3", "f")

In [6]: rn2.pitchClasses
Out[6]: [9, 1, 3, 6]

In [7]: !cat text.rntxt
m1 f: #vi/o4/3

In [8]: rn2 = music21.roman.RomanNumeral("#vi/o4/3", "f")

In [9]: rn2.pitchClasses
Out[9]: [9, 1, 3, 6]

The last lines are just to confirm that this doesn't seem to be related to the /o notation for half-diminished.

The annotation shows up in several instances of the When-in-Rome dataset (@MarkGotham might be interested). That's how I detected it.

@napulen
Copy link
Contributor Author

napulen commented Feb 20, 2022

So I just realized that the value of scaleDegreeWithAlteration is different.

In [12]: rn.scaleDegreeWithAlteration
Out[12]: (6, <music21.pitch.Accidental sharp>)

In [13]: rn2.scaleDegreeWithAlteration
Out[13]: (6, <music21.pitch.Accidental double-sharp>)

So I guess whenever someone wants to parse an annotation in the same way as the RomanText parser would, the right line is?

rn2 = music21.roman.RomanNumeral("#viø4/3", "f", sixthMinor=music21.roman.Minor67Default.FLAT)

@napulen
Copy link
Contributor Author

napulen commented Feb 20, 2022

I can confirm that I've tried several combinations of sixthMinor and seventhMinor args, but nothing seems to mimic the same interpretation of a Roman numeral that the RomanText converter does.

The only thing that has worked for me, if one wanted to mimic the same behavior is something like this:

key = rn.key.tonicPitchNameWithCase
figure = rn.figure
s = music21.converter.parseData(f"m1 {key.replace('-', 'b')}: {figure}", format="romantext")
rn = [rn for rn in s.flat.notes][0]

That won't reproduce the offset location, of course.

@jacobtylerwalls
Copy link
Member

Hi @napulen thanks for the report. I haven't looked in detail at your second and third messages, but from the first one, this looks like another manifestation of #1217, don't you think? Looking at my solution there it's looking like that function shouldn't be editing rootAlterationString at all.

@jacobtylerwalls
Copy link
Member

Ah, a more backwards compatible solution would be to just set CAUTIONARY for the sixthMinor and seventhMinor attributes on the roman numeral objects created by romanNumeralFromChord. And then you would be able to rely on those values when parsing figures.

e.g.

rn2 = RomanNumeral(otherRn.figure, 'f', sixthMinor=otherRn.sixthMinor, seventhMinor=otherRn.seventhMinor)

I can confirm that I've tried several combinations of sixthMinor and seventhMinor args

Have you tried CAUTIONARY?

>>> music21.roman.RomanNumeral("#viø4/3", "f", sixthMinor=roman.Minor67Default.CAUTIONARY).pitchClasses
[8, 0, 2, 5]

@napulen
Copy link
Contributor Author

napulen commented Feb 21, 2022

I did not try the CAUTIONARY. I'll run the full corpus with this and report back (same in PR).

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

Successfully merging a pull request may close this issue.

2 participants