Diatonic transpositions incorrectly handled for transposed instruments [reproducible]

• Aug 26, 2015 - 13:40
Priority
normal
Status
closed
Component
Code
Category
bug report
Project

The problems exists in version 2.0.2 (f51dc11).

The French Horn displays these notes in concert pitch:

Clipboard03.png

but these notes in non-concert pitch:

Clipboard04.png

In non-concert pitch, the correct notes should be C natural (the displayed pitch is one semitone high) and F sharp (the displayed pitch is one semitone low). When the score is exported to MusicXML, the error is retained even if the score is displayed in concert pitch.

There seem to be a number of bug reports with transposition problems when in the key of C. I checked the open ones and I can't quite make out whether this problem currently has an active bug report or not. In this case, I am not using the Transpose feature, just turning on/off the display in concert pitch option. In the case of the MusicXML problem, I am just exporting.


Comments

I cannot reproduce this - French horn transposes as expected for me, key of C or not. Can you post the specific score you are having problems with, and/or steps to reproduce the problem from scratch?

Hi, Mark,
I have attached a MuseScore 2 file that reproduces the problem for me:

Concert Pitch Bug.mscz

I saved the file and re-opened it and I still saw the problem.

Just to be sure you see what I saw, here's that file when viewed in concert pitch:

Clipboard05.png

And here's the same file viewed in non-concert pitch:

Clipboard08.png

Since the score in C is diatonic, the transposed score should be as well. Only the F and C should be sharp and they should always be sharp. I used a different transposing instrument this time: the Clarinet in Bb which has also been creating problems for me.

I can reproduce with this particular score. Somehow the "TPC" information that is used to record the enharmonic spellings has become corrupt - it is recording that the first note, for instance, should be a B in concert pitch, and C transposed. It seems all the concert B's are affected, as are several other pitches.

Any insight into how it got into this state? Was it imported from some other program? Created with an unsupported early experimental pre-release build of 2.0? Any way you can retrace your steps at all the give us some insight into how this happened?

Simply doing a select all then hitting up arrow followed by down (or vice versa) fixes the problem but you'd lose any deliberate enharmonic adjustments you had made elsewhere.

Well, I've worked on this score since about April, so it would be hard to remember all the things I've done to it. It probably started with MuseScore 2.0 or 2.01 and move to MuseScore 2.0.2.

The entire piece is diatonic, luckily, so up key/down key is a viable solution. Thanks!

This probably should be a separate bug report, but when I export the newly corrected piece to MusicXML while viewing in concert pitch, I get:

  <part id="P6">
    <measure number="1" width="127.28">
      <print>
        <staff-layout number="1">
          <staff-distance>65.00</staff-distance>
          </staff-layout>
        </print>
      <attributes>
        <divisions>4</divisions>
        <key>
          <fifths>0</fifths>
          </key>
        <time>
          <beats>4</beats>
          <beat-type>4</beat-type>
          </time>
        <clef>
          <sign>G</sign>
          <line>2</line>
          </clef>
        <transpose>
          <diatonic>-1</diatonic>
          <chromatic>-2</chromatic>
          </transpose>
        </attributes>
...
    <measure number="18" width="186.97">
      <direction placement="below">
        <direction-type>
          <dynamics>
            <f/>
            </dynamics>
          </direction-type>
        <sound dynamics="106.67"/>
        </direction>
      <note default-x="15.32" default-y="-570.00">
        <pitch>
          <step>D</step>
          <octave>4</octave>
          </pitch>
        <duration>4</duration>
        <voice>1</voice>
        <type>quarter</type>
        <stem>up</stem>
        <notations>
          <articulations>
            <staccato/>
            </articulations>
          </notations>
        </note>


When I view it in non-concert pitch and export, I get:

  <part id="P6">
    <measure number="1" width="146.34">
      <print>
        <staff-layout number="1">
          <staff-distance>65.00</staff-distance>
          </staff-layout>
        </print>
      <attributes>
        <divisions>4</divisions>
        <key>
          <fifths>2</fifths>
          </key>
        <time>
          <beats>4</beats>
          <beat-type>4</beat-type>
          </time>
        <clef>
          <sign>G</sign>
          <line>2</line>
          </clef>
        <transpose>
          <diatonic>-1</diatonic>
          <chromatic>-2</chromatic>
          </transpose>
        </attributes>
...
    <measure number="18" width="186.97">
      <direction placement="below">
        <direction-type>
          <dynamics>
            <f/>
            </dynamics>
          </direction-type>
        <sound dynamics="106.67"/>
        </direction>
      <note default-x="15.32" default-y="-570.00">
        <pitch>
          <step>D</step>
          <octave>4</octave>
          </pitch>
        <duration>4</duration>
        <voice>1</voice>
        <type>quarter</type>
        <stem>up</stem>
        <notations>
          <articulations>
            <staccato/>
            </articulations>
          </notations>
        </note>

I'm not a MusicXML expert, but it looks the concert-pitch score and the transposed score differ only in the key signature. The notes and the section are, in both cases, given as though the instrument is in its transposed key. Shouldn't the key signature and the notes match?

I don't really know how MusicXML deals with concert pitch; my understanding is, "not very well".

Understood that you don't know exactly how to reproduce the original problem. Anything you can think of that might help, feel free to share. Like, do you think it was working well until recently then suddenly went awry? Or did the problem perhaps first creep in back in April? There *were* bug involving concert pitch and enharmonic spellings in 2.0 and/or 2.0.1, but nothing that would explain this.

Ok, re: MusicXML: it's the blind leading the blind. Here's my "blind" guess: when writing the file, decide whether you will store a transposing instrument in its transposed form or in its concert pitch form. It doesn't matter which you choose or if you choose to do it one way one time and another way the other. Whichever way you decide, the key signature and notes should match. This way, the accidentals and naturals will make sense. Writing the notes in a different key than indicated might make them harder to interpret, but I haven't tried the exercise.

When reading the file, you can use the transpose element to see if a part is transposed and how it is transposed. If any parts are transposed, you could guess that the score is being displayed in transposed form. The key and the accidentals/naturals tell you how to display a part and the transpose information lets you calculate the true pitch of a note, which might be how you want to store it internally. You could also cross-check a note's representation with its pitch and complain if they don't match up.

You won't necessarily know what instrument is being used since instrument names are not enforced by MusicXML, but you can at least tell that you have a Bb or F instrument, for example. Some programs don't track this information well and assigning a transposing instrument to an imported part may generate odd results.

Anyway, that's just how it makes sense to me and so it's my light-weight case for saying that it looks like a bug for MuseScore to write a transposed part with the key signature in concert pitch but the notes in transposed mode. The work-around is to display the score in transposed form before exporting—then the key and notes match.

As for anything that might give a clue on what happened to the score to screw it up, I'm not sure what to tell you. I have worked with the score in concert pitch almost exclusively. I only noticed the problem when I tried to export a MusicXML file to Notion (maybe a month back?). At this point, I am writing some code to read the MusicXML file (to convert it to a MIDI file in my own special fashion), and I heard the familiar (from my Notion experience) out of tune notes once again.

As long as I stay in concert pitch (which is practically always) MuseScore displays and plays the parts properly, so the problem is invisible. The only thing I can think of is that I might have copied/pasted some notes from a non-transposing instrument to a transposing one. Everything was generated inside MuseScore—I didn't import anything. Notes were entered using Note Input mode or through copy/paste. Things have evolved over time: measures added and deleted, instruments added and deleted and notes moved from one section to another.

Thanks for your help!

Title Transposed instruments correct in concert pitch, incorrect otherwise Transposed instruments correct in concert pitch, incorrect otherwise [reproducible]

OK, I figured out how to reproduce this.

  1. Create a new score: select Wind Quarter as the template and choose the key of C. Make sure that you are displaying concert pitch.
  2. Add some notes to the flute part.
  3. Copy those notes to the clarient.
  4. Select the copied notes and choose Notes / Transpose / Transpose Diatonically / Down , Third

The notes look fine in concert pitch, but if you then disable concert pitch, the notes are screwed up. These are the notes I used, in concert pitch:

Clipboard01.jpg

Here's what it looks like after I turn off concert pitch:

Clipboard02.jpg

If I switch back to concert pitch and use Marc's workaround (select the notes, use the up key and then the down key) and turn off concert pitch, I get:

Clipboard03.jpg

There are probably shorter sequences that will create this problem, but this one is not very long and works as a reproducible case. Even if the notes are displayed correctly when viewed in concert pitch, saving to XML format will create the problem in the XML file.

Are you thinking it is likely that you use the diuatonic transposition option in your original score as well? If not, then this seems like a separate issue and should be filed as such. If you think it was diatonic transposition all along, then we can change the title of this issue to reflect that.

Title Transposed instruments correct in concert pitch, incorrect otherwise [reproducible] Diatonic transpositions incorrectly handled for transposed instruments [reproducible]

Hi, Marc, I changed the title. I used a lot of diatonic transpositions in the score where the problem originally appeared. It's likely that this was the problem in that case, although I'll never know for sure.

Status needs info active

OK, in that case, I'll mark this "active", and when a fix is implemented, we will close it. If you eventually find other cases not related to diatonci transposition, we can file new reports.

In a pretty remarkable coincidence, I was just working on a totally different issue today in which I found another way to create this sort of "tpc corruption" - add an Instrument change text to a staff, change to an intrument with different transposition than that of the staff itself, then enter notes in that passage. You get similar bad transposition. This has nothing to do with the diatonic transposition command, so my fix for this other issue won't in itself fix your issue here. However, as part of my fix, just this morning I added code when reading a score that attempts to correct any corruptions that were previous introduced. And I have now verified that particular piece of code also retroactively fixes the corruptions that were introduced by "your" issue. So we still need to fix the issue itself, but the code I was already planning on adding will correct the corruptions in existing scores.

Status active patch (code needs review)

https://github.com/musescore/MuseScore/pull/2260

BTW, in the current code, it's broken regardless of hether you are in concert pitch mode when you do the transposition or not - just differently broken. Basically, all combinations of diatonic transposition in the presence of transposing instruments do bad things, either right away, or after toggling concert pitch.

I've tested my fix pretty thoroughly and my changes seem good, but it's definitely worth having more testing to see if I missed something.