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

Accidentals never and if-absolutely-necessary #1148

Merged
merged 10 commits into from
May 2, 2022
Merged

Conversation

mscuthbert
Copy link
Member

Add more logic for makeAccidentals for displayType "never"

Add "if-absolutely-necessary" displayType

Simplify some parts of the accidental making.

Do not merge until I have a chance to write tests.

(Ignore branch name -- did not get to it in this PR)

@coveralls
Copy link

coveralls commented Oct 14, 2021

Coverage Status

Coverage increased (+0.006%) to 93.153% when pulling 62d016a on brailleAccidentals into 79a8796 on master.

@mscuthbert
Copy link
Member Author

@jacobtylerwalls would you have a chance to review this? Thanks!

music21/pitch.py Outdated Show resolved Hide resolved
music21/pitch.py Outdated
Comment on lines 4764 to 4768
# nope, no previous pitches in this octave and register, now more complex things...
# but first handle 'if-absolutely-necessary' case.
if acc and acc.displayType == 'if-absolutely-necessary':
acc.displayStatus = False
return
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is too early to short-circuit, if if-absolutely-necessary also needs to show a necessary natural contradicting the ks. If it's not what it's supposed to do, then maybe reword only-for-cancelling-in-register? (not that I love that phrasing). Just that cancelling a ks seems absolutely necessary.

pr:

>>> m = stream.Measure([key.Key('C-'), note.Note('G#'), note.Note('Cn')])
>>> p = stream.Part(m)
>>> m.notes[-1].pitch.accidental.displayType = 'if-absolutely-necessary'
>>> p.show()

Screen Shot 2021-10-20 at 10 09 34 PM


Maybe this means organizing the cases differently so we can short-circuit somewhere.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah -- you are absolutely right. Okay, that will take a bit more time to do.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

THANKS!

music21/pitch.py Outdated Show resolved Hide resolved
@mscuthbert mscuthbert merged commit 39ae4a7 into master May 2, 2022
@mscuthbert mscuthbert deleted the brailleAccidentals branch May 2, 2022 02:25
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 this pull request may close these issues.

3 participants