Skip to main content
Topic: suggestion: enharmonic reversal user tool (Read 9271 times) previous topic - next topic

suggestion: enharmonic reversal user tool

As longtime readers of this forum know, I'm not a great fan of user tools - the only one I currently use with any regularity is Opagust's GlobalMod.og. However, one I would use - if it existed - is one that would flip enharmonic spellings from sharp to flat, or vice versa, within a selection.

NWC's "Audit Enharmonics" tool is useful, but it always defaults to sharps. There are many times when the proper enharmonic choice is flats. I'd love to be able to select the appropriate chords or bars, run a tool, and watch all the A#s and D#s (etc.) change to Bbs and Ebs (etc.).

The tool I visualize wouldn't require user input beyond creating the selection and running the tool. It would simply examine the selection for accidentals and change all that it found to their enharmonic equivalents - sharps to flats of the note above, flats to sharps of the note below.

Anyone want to tackle this? I did my last programming a quarter century ago or more, and I'm not going to start again now, but this doesn't look like a particularly difficult task.

Re: suggestion: enharmonic reversal user tool

Reply #1
Consider the following questions as "requirements gathering":

  • I am assuming that the tool might need to be aware of the current key signature? (In the event that the note being converted to a sharp or flat is already noted as such in the current key)
  • As you describe the tool, it would toggle sharps to flats and flats to sharps. Thus, if a chord contains both flats and sharps, it would still have both after the tool runs, except different notes would be sharpened/flattened. Might it make more sense to have 2 options when the tool is invoked: Sharpen vs. Flatten?
  • NWC allows some interesting chords:

    !NoteWorthyComposerClip(2.751,Single)
    |Chord|Dur:4th|Pos:#-4,-3
    |Chord|Dur:4th|Pos:#-3,b-2
    !NoteWorthyComposerClip-End

    So I assume the tool should deal with these situations gracefully (i.e. either delete the redundant note, or leave that chord as is)
  • If a note has an E# or B# (or an Fb or Cb), should they still be toggled? Perhaps to a double flat or double sharp?  I guess there is also the question of whether double sharps/flats should be toggled as well.

Sorry for all the questions, but I find it handy to plan ahead before starting a project like this.


Re: suggestion: enharmonic reversal user tool

Reply #2
NWC allows some interesting chords:

!NoteWorthyComposerClip(2.751,Single)
|Chord|Dur:4th|Pos:#-4,-3
|Chord|Dur:4th|Pos:#-3,b-2
!NoteWorthyComposerClip-End
This is very typical for (pedal) harp.  :D


Re: suggestion: enharmonic reversal user tool

Reply #4
  • I am assuming that the tool might need to be aware of the current key signature? (In the event that the note being converted to a sharp or flat is already noted as such in the current key)
A reasonable assumption. I rarely use key sigs, so it didn't cross my mind.
Quote
  • As you describe the tool, it would toggle sharps to flats and flats to sharps. Thus, if a chord contains both flats and sharps, it would still have both after the tool runs, except different notes would be sharpened/flattened. Might it make more sense to have 2 options when the tool is invoked: Sharpen vs. Flatten?
I would make it three options: flats to sharps, sharps to flats, sharps/flats reversed.
Quote
  • NWC allows some interesting chords:

    !NoteWorthyComposerClip(2.751,Single)
    |Chord|Dur:4th|Pos:#-4,-3
    |Chord|Dur:4th|Pos:#-3,b-2
    !NoteWorthyComposerClip-End

    So I assume the tool should deal with these situations gracefully (i.e. either delete the redundant note, or leave that chord as is)
Flurmy is correct: chords like this are fairly commonly written for the harp. I think a conditional is called for: if two enharmonic versions of the same pitch class are present, leave them alone. (The user might still want sharps or flats corrected in the same chord.)
Quote
  • If a note has an E# or B# (or an Fb or Cb), should they still be toggled? Perhaps to a double flat or double sharp?  I guess there is also the question of whether double sharps/flats should be toggled as well.
I've been operating under the assumption that the Audit Enharmonics tool has been run first. If that's been done, this is a moot point. I would recommend having the user tool leave them alone, with a note in the help that the AE tool should be run first.
Quote
Sorry for all the questions, but I find it handy to plan ahead before starting a project like this.
Sorry it took so long for me to respond. I'm too busy for my own good. Thanks for taking this on -

Bill

Re: suggestion: enharmonic reversal user tool

Reply #5
Hi Bill,

Do you remember this: Topic: Enharmonic Spelling - Note Entry
I then wrote the user tool 'Enharmonic.og.lua'.
I now added an option 'Reverse sharps/flats'.
See attachment.
Hope it can help you.

Opagust

Edit 02/03/2018:
New version:
- Bug fix concerning dealing with key signature and preceding accidentals in a measure.
- Courtesy accidentals are preserved.
Always look on the bright side of life!

Re: suggestion: enharmonic reversal user tool

Reply #6
Works nice - thanks! Apologies:  - I had forgotten about the earlier conversation, and couldn't find it with the cursory search I made of the forum.

Bill

 

Re: suggestion: enharmonic reversal user tool

Reply #7
Thanks @Opagust for reminding us of the tool you wrote. One less wheel to reinvent.


Re: suggestion: enharmonic reversal user tool

Reply #9
Does/will the tool should adjust double sharps and double flats as well?


Re: suggestion: enharmonic reversal user tool

Reply #11
Thanks, Bill, now I see what Reply 4 says. 

Just to make sure my question is clear, in this sequence

!NoteWorthyComposerClip(2.751,Single)
|Clef|Type:Treble
|Key|Signature:F#,C#,G#,D#,A#,E#|Tonic:F
|TimeSig|Signature:5/4
|Note|Dur:8th|Pos:n0)|Opts:Stem=Up,Beam=First
|Note|Dur:8th|Pos:-3|Opts:Stem=Up,Beam=End
|Note|Dur:4th|Pos:x-3
|Note|Dur:4th|Pos:-2
|Note|Dur:8th|Pos:0|Opts:Stem=Up,Beam=First
|Note|Dur:8th|Pos:-3|Opts:Stem=Up,Beam=End
|Note|Dur:4th|Pos:-2
|Bar|Style:Double
!NoteWorthyComposerClip-End

the F double sharp on beat 2 becomes an accidental G natural, but beat 4 must also be transposed to G natural, without displaying a visible natural sign.  The user tool will need to detect beat 4 and transpose it as well.

Beats 3 and 5 have now become unmarked G naturals due to the change in beat 2.

The user tool needs to be able to automatically add a sharp accidental to beat 3, because finding double sharps later in the score could be challenging. 

Re: suggestion: enharmonic reversal user tool

Reply #12
I've run Opagust's enharmonic.og tool on this twice, with different options ("sharps up/flats down" and "common accidentals"), and both times it produced no changes. This is to be expected, since the notation is clear and accurate. There is no need for changes here, and the tool would not likely be run. I'm not sure I see a problem.

Re: suggestion: enharmonic reversal user tool

Reply #13

Thanks for testing the clip with Opagust's tool, Bill.  I think you're saying it didn't change the Fx to G natural?

Checking further into this, I wrote the same notes without a key signature and forced the accidentals:

!NoteWorthyComposerClip(2.751,Single)
|Text|Text:"Same notes, no key sig, forced acc."|Font:StaffItalic|Pos:8
|Clef|Type:Treble
|TimeSig|Signature:5/4
|Note|Dur:8th|Pos:n0|Opts:Stem=Up,Beam=First
|Note|Dur:8th|Pos:#-3|Opts:Stem=Up,Beam=End
|Note|Dur:4th|Pos:x-3
|Note|Dur:4th|Pos:#-2
|Note|Dur:4th|Pos:x-3|Opts:Stem=Up
|Note|Dur:4th|Pos:#-2
|Bar|Style:Double
!NoteWorthyComposerClip-End

Running Enharmonics.og with No Doubles incorrectly turns beat 4 into a G#:

!NoteWorthyComposerClip(2.751,Single)
|Clef|Type:Treble
|TimeSig|Signature:5/4
|Note|Dur:8th|Pos:0|Opts:Stem=Up,Beam=First
|Note|Dur:8th|Pos:#-3|Opts:Stem=Up,Beam=End
|Note|Dur:4th|Pos:-2
|Note|Dur:4th|Pos:#-2
|Note|Dur:4th|Pos:-2|Opts:Stem=Up
|Note|Dur:4th|Pos:-2
|Bar|Style:Double
!NoteWorthyComposerClip-End

Running Enharmonics.og with "Your choices" "Multiple Select"  F#-Gb, Fx-G and G#-Ab  produced

!NoteWorthyComposerClip(2.751,Single)
|Text|Text:"Same notes, no key sig, forced acc. After Enharmonic.og"|Font:StaffItalic|Pos:8
|Clef|Type:Treble
|TimeSig|Signature:5/4
|Note|Dur:8th|Pos:n0|Opts:Stem=Up,Beam=First
|Note|Dur:8th|Pos:b-2|Opts:Stem=Up,Beam=End
|Note|Dur:4th|Pos:b-2
|Note|Dur:4th|Pos:b-1
|Note|Dur:4th|Pos:b-2|Opts:Stem=Up
|Note|Dur:4th|Pos:b-1
|Bar|Style:Double
!NoteWorthyComposerClip-End

I think the double sharp conversion causes problems with later notes in the bar.  If I'm right, Mike's comment/question #4 asking about double sharps and double flats reveals the available user tool needs tweaking.

I haven't used Enharmonics.og before.  I think most potential glitches will be prevented by the note by note approval safeguard mechanism.  Thank you, Opagust!

Re: suggestion: enharmonic reversal user tool

Reply #14
A new version of the tool is present in reply #5.
I corrected a bug concerning dealing with the key signature and preceding accidentals in a measure. Courtesy accidentals now are also preserved.

I tested it on the clips in the preceding replies. See the result in attachment.
Always look on the bright side of life!

Re: suggestion: enharmonic reversal user tool

Reply #15
Thanks!