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

romanText parser assumes fast 3/8 #1185

Closed
malcolmsailor opened this issue Dec 14, 2021 · 11 comments
Closed

romanText parser assumes fast 3/8 #1185

malcolmsailor opened this issue Dec 14, 2021 · 11 comments

Comments

@malcolmsailor
Copy link
Contributor

music21 version

7.1.0

Problem summary

The romanText parser raises an exception on this file from the When-in-Rome corpus.

The exception is music21.romanText.translate.RomanTextTranslateException: too many notes in this measure: m83 i b3 bVI

The time signature is 3/8. If I understand the Romantext format correctly, beat 3 should be the third 8th note of the measure, thus the exception is unexpected.

Steps to reproduce

Here is a minimal example to reproduce the bug

import music21

content = """Time signature: 3/8 

m1 C: I b3 V
"""

music21.converter.parse(content, format="romanText")
@jacobtylerwalls
Copy link
Member

Hi, thanks for the note. In version 7, the default interpretation of 3/8 changed to assume one dotted-quarter beat, not 3 eighth note beats. This is mentioned here, but I don't see that we added it to the release notes.

>>> ts = meter.TimeSignature('3/8')
>>> ts.beatCount
1
>>> ts = meter.TimeSignature('slow 3/8')
>>> ts.beatCount
3

I skimmed the Romantext spec, and it looks silent on this point. This, though, does work on v7:

>>> content = """Time signature: 3/8
... m1 C: I b1.66 V
... """
>>> music21.converter.parse(content, format="romanText").show()

Screen Shot 2021-12-14 at 7 06 39 PM

@jacobtylerwalls
Copy link
Member

@MarkGotham any thoughts here? Should the RomanText converter assume 3/8 is compound single or simple triple?

@jacobtylerwalls jacobtylerwalls changed the title romanText parser fails in 3/8 romanText parser assumes fast 3/8 Dec 15, 2021
@malcolmsailor
Copy link
Contributor Author

Hi, thanks for your response!

It's surprising to me that a meter with "3" in the numerator would default to having 1 beat. I think of meters with numerators of 3 to be simple, and only meters with numerators n * 3 where n > 1 to be compound. Presumably music21 assumes 3/4 and 3/2 have 3 beats each? It's certainly your prerogative to have your library understand 3/8 as you see fit, but I can't be the only musician that understands meter conventions in this way, so maybe it would be worth adding a warning when using 3/8 (or 3/16?) if the user does not explicitly specify "fast" or "slow"?

All that said, what I would really like to know is if there is a way for me to parse this file. Can I explicitly specify the default interpretation of 3/8 as "slow" to the parser somehow?

@jacobtylerwalls
Copy link
Member

Sure, it's Python so you can patch anything at runtime ;)

import music21

class TimeSigSubClass(music21.meter.TimeSignature):
    def __init__(self, value: str = '4/4', divisions=None):  # I copied the signature
        if value == '3/8':
            value = 'slow 3/8'  # hack it in
        super().__init__(value, divisions=divisions)

music21.meter.TimeSignature = TimeSigSubClass

content = """Time signature: 3/8 

m1 C: I b3 V
"""

music21.converter.parse(content, format="romanText")

@jacobtylerwalls
Copy link
Member

Certainly I'm partial to ensuring the when-in-rome files can be processed by music21 without any hassle!

It's surprising to me that a meter with "3" in the numerator would default to having 1 beat. I think of meters with numerators of 3 to be simple, and only meters with numerators n * 3 where n > 1 to be compound.

I didn't propose or merge the changes in question, but I think intuition could cut either way. In contemporary music 3/16 is almost exclusively a 1-beat meter, and 3/8 also, usually, in my experience. Even a 3/4 scherzo in Beethoven can be a 1-beat meter, although that would be a crummy default. In The Rhythm Book, Rory Stuart writes for a jazz/contemporary music audience: "the dotted-quarter note pulse we feel, whether the meter is 3/8, 6/8, 9/8 ..."

@jacobtylerwalls
Copy link
Member

a jazz/contemporary music audience

Since Roman numeral analysis is not very useful in those genres, that's a good argument for defaulting to slow 3/8 in the RomanText parser.

@malcolmsailor
Copy link
Contributor Author

I agree that the intuition for 3/8 could go either way, depending on the musician. Hence my suggestion of a warning if "slow" or "fast" is not specified.

Also agree that it would be good for the RomanText parser to be compatible by default with the When-in-Rome corpus, since these will presumably often be used together. But in the meantime, thanks for the suggested hack!

@malcolmsailor
Copy link
Contributor Author

After investigating some more it seems that only some analyses in the When-in-Rome corpus assume slow 3/8 (e.g., Corpus/Quartets/Beethoven,_Ludwig_van/Op132/3/analysis.txt), while others assume fast 3/8 (e.g., Corpus/Quartets/Beethoven,_Ludwig_van/Op018_No4/2/analysis.txt). I will post an issue there, since it seems to me that they should be consistent (or perhaps specify "slow" or "fast").

@MarkGotham
Copy link
Contributor

Thanks for this. I've checked and romanText accepts Time signature: slow 3/8, so simply specifying which is used will solve this on the corpus side. On the music21 side then:

  • Are we content with the fast default on 3/8 in TimeSignature? I would vote for the slow default, though clearly reverting a recent change away from this would be messy.
  • Does the romanText documentation need work, or is it clear given the above that TimeSignature strings should be handled exactly as they are elsewhere?

Thanks again.

@jacobtylerwalls
Copy link
Member

Thanks for the quick work, Mark; it's good to know the when-in-rome corpus is now compatible with v7.

Are we content with the fast default on 3/8 in TimeSignature? I would vote for the slow default, though clearly reverting a recent change away from this would be messy.

I'll keep count for anybody raising this in future. If somebody felt strongly about proposing those changes I suppose they could try to get consensus developed through the mailing list.

Does the romanText documentation need work, or is it clear given the above that TimeSignature strings should be handled exactly as they are elsewhere?

I think that's clear in music21; the reporter mentioned the original paper, and I didn't know how willing you'd be to change the files, so that's why I was posing the questions :-)

maybe it would be worth adding a warning when using 3/8 (or 3/16?) if the user does not explicitly specify "fast" or "slow"?

I'm not entirely opposed to that, but a couple things come to mind.

  • there are gobs of ambiguous musical situations that music21 could come across. I don't know that we have to warn every time; this is more on the analyst to inspect/guard/analyze for.
  • We warn for things like file parsers that detect format spec violations or norm violations. So when MuseScore or Sibelius doesn't put a <voice> tag somewhere we expect, for instance. And we probably warn too MUCH in those cases (spewing out hundreds of times per file). That's different from the above bullet point.

If anyone wants to propose a warning for "naked" 3/8 or 3/16's in a PR I'm happy to have another look, but I think there's greater ROI in just cleaning up the way music21 warns generally before adding one-off warnings for specific ambiguous musical situations (see #254). Thanks again @malcolmsailor for bringing the original ambiguity to attention!

@mscuthbert
Copy link
Member

No, we will not be adding a general warning for creating/parsing a 3/8 time signature without specifying beats. Many people parse files for other reasons and don't use beats at all, and we'd be gumming up people's usage.

I could be open to having a warning for 3/8 for RomanText specifically. Though there's usually a better way: scan through the rest of the RomanText file and see if the string " b2 " exists -- if it does assume that 3/8 is slow 3/8. -- that would fix it for most (except for cases where the TS changes later)

The decision to make music21's default for 3/8 be 1-beat was made pretty recently, and I think there was a pretty compelling reason for the change, though it escapes me.

I just looked up the RT specification (which of course Mark + I contributed to writing) and it's unfortunately ambiguous on this point. And the specification does not allow for things like "slow" or "fast" so music21's parser won't be loading it, unless the specification changes (and we add a version to it, etc.)

FWIW -- I wanted the specification to always use 6-beat 6/8, etc. because I hate parsing 1.66.5 etc. but that's where it went.

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

4 participants