"Fake" barlines on score missing on some instrumental parts and disappearing completely after a save.

• Jun 6, 2015 - 17:13
S3 - Major

Muse Score 2.0.1 - Windows

Marked as "major" because, as far as I can see, there is no available workaround.

Discussion here: https://musescore.org/en/node/63831

1. Start a score with a 4/4 time signature with several systems (a big-band template is good). Insert some notes/rests (or just see the posted example "Tuplets across barline.mscz" here: https://musescore.org/en/node/63831.)

2. Create an invisible 8/4 bar in bar 3, and split it in half with a "fake" barline by clicking on the 5th beat (rest or note, as applicable) in the top stave of each system.

3. Double-click on the normal barline in the barlines palette and drag the barline downwards to cover each system.

4. Create individual instrumental parts for the whole score (File>Parts>New all).

Result 1:

All the "fake" barlines initially show in the score, but only in each created instrumental part which corresponds to the top stave in each system. The same "fake" barline is missing from the remaining created individual parts from each system.

Expected Result 1:

The same "fake" barline should appear in every instrumental part.

Result 2:

After saving and subsequently reopening the score, the "fake" barlines have all disappeared in both the score and parts.

Expected Result 2:

The score should open in the same state as when saved - i.e. the same "fake" barline should still appear in all systems in both the score and in every instrumental part.


1) I can reproduce the "first" result: "All the "fake" barlines initially show in the score, but only in each created instrumental part which corresponds to the top stave in each system"

After checking, it's a very former issue: more than a year. The followings images has been produced with this Nightly: 56177c3
Bb clarinet.jpg
A Clarinet.jpg

2) I cannot reproduce the "second" result: "After saving and subsequently reopening the score, the "fake" barlines have all disappeared in both the score and parts."
But I notice that the barlines are incomplete.
For example, in the main score after save and reload.
incomplete barline.jpg

cadiz 1,

Thank you for your reply. Glad you could reproduce the first result, and sorry, I didn't realise this had already been reported - I did search before posting this but it seems not carefully enough!

I'm surprised you can't reproduce the second result though - happens every time here (MS 2.0.1 + Windows). You don't say which OS you're using, but is it possible the result could vary depending on OS, or perhaps the score template (I note your example is piano only, whereas I'm using the big band template)? Edit: Nope, just tried with Piano-only score, and I see the same result as below. In fact I can't seem to reproduce the same result as your screenshot in (2) where the barline is drawn beyond the bottom of the top stave.

Just to check that the problem is not dependent on note content, I just tried this in an empty score and the result was the same. To reproduce the issue, please follow this process exactly as described:

1. Create New Score from scratch in MS 2.0.1 - choose the Big Band template.
2. Select Bar 3 (all staves)
3. Right-click->bar->bar properties->set "actual" to 8/4 and click OK
4. Deselect
5. Click the breve rest in the top stave (alto sax 1)
6. Click semibreve rest in the note entry selection area at the top left to split the breve rest into 2 semibreve rests
7. Repeat steps 5 & 6 in all staves in the sax section system (alto 1 to baritone saxes)
8. Select only the second semibreve in the top (alto sax 1) stave
9. In the barlines palette, click "normal barline" to split the 8/4 bar with a "fake" barline.
10. Deselect.
11. Select the new "fake" barline and drag down to cover the sax section system.
12. Save file
13. Reopen file

Result - the "fake" barline is gone (and a new single "default" semibreve rest is added to the invisible 8/4 bar).

Expected result - the "fake" barline should still be present. It would also be good if two default rests were added to the two new "fake" bars either side of the "fake" barline, too.

OK, I've now done a little more testing...

I still have MS v2.0.0 installed on ubuntu (15.04), and if I follow the process I described above the result is different in that version - in fact it's the same result you describe - i.e. the "fake" barline hangs down below the top stave!

So - it seems there is inconsistent behaviour in this respect between scores created in v2.0.0 and in v2.0.1. It's also possible that there could be differences between the same MS version on different OS's, but unfortunately I can't test that right now as I don't have the time to compile v2.0.1 for ubuntu (shame it's not yet in the PPA, otherwise I would be happy to do it).

Also, I just tried opening a score created (using the process described above) in MS 2.0.0 (on Ubuntu 15.04) in MS 2.0.1 on Windows and I can still see the long, overhanging barline. So it seems the result is different, depending in which MS version the score was created.

In any case, neither result is expected nor good. It would be great if this issue could be fixed relatively soon because, at least as far as I am aware, there is no workaround.

I'm looking into this. Some interesting discoveries so far.

One semi-useful bit of information is, there is a difference in behavior depending on whether you add the barline by clicking the note/rest then double clicking the palette item, or by dragging the palette item to the note. The former method is what results in the barline disappearing on reload, because barlines added this way have the "generated" flag set, making it appear to MuseScore more like a "real" barline, so it doesn't get written. Drag & drop results in generated being false, which allows the barline to be written. I am reluctant to mess with the basic palette code, but I am fixing this for now by explicitly setting "generated" to false when adding a midmeasure barline, in ChordRest::drop().

Also, from what I can tell, in the cases where you used drag and drop so the barline is written, it does get written correctly, but is then *read* incorrectly - as if the span is supposed to represent total number of staff lines spanned (across all staves), rather than just being set to the line number of bottom staff line of the top staff. Maybe there was some reason it was being done this way at one time, but that's not how we store spans normally. That too seems a simple fix.

So I think I have that much under control. Now looking into parts.

That's great Marc - thank you. It seems odd that two possible methods of doing (what should be) exactly the same thing (adding a barline) should have produced two different behaviours - it didn't even occur to me that might have been the case. Wish I knew more about programming!

Anyway, it's great to hear that you've identified the issue in the code, and have been able to correct at least some of it. Many thanks again for looking into this so promptly.

FYI, I now have editing of barlines after generation of parts working, so if you create the parts *before* adding/editing the barline, it automatically adds/deletes corresponding barlines in the linked staves. The code that handles creating the parts in the first place is separate, so that's next.

Status (old) active patch (code needs review)


I tried to be thorough, this should work well both for initially creating the parts and also for editing the barline span after part creation. Changes to the score will automatically update the parts correctly in all cases I could think to test. I deliberately do *not* to the reverse - updating the score when changing parts - because it actually isn't always even possible. By reducing the span for two-staff parts like piano to just the top staff, you could conceivably make the barline discontiguous in the score.

Sounds like a great solution for now and should certainly be fine for my needs. I guess you're right about the code needing review though, because I think ideally the whole thing should be completely foolproof, i.e. changes to something as fundamental as barlines in the score should really be reflected in the parts and vice versa.

However, that doesn't in the least bit detract from my huge appreciation, both for the thought and time you've put into this fix and for the incredibly timely manner in which you've attended to it - thanks once again Marc.

Hi Marc,

I'm not sure whether your changes have propagated to the nightlies yet - if not then ignore this...

I just tested again in today's nightly and the disappearing barline issue in the score seems to be resolved, so that's great - thanks.

However, in a newly-created set of individual parts, the "fake" barline in all but the top instrument part in each system is still missing. For example, in the saxes, I see the "fake" barline in the Alto 1 part, but not in the Alto2, Tenors 1 & 2 or Bari parts.