@@ -866,6 +866,21 @@ def xmlRootToScore(self, mxScore, inputM21=None):
866866 self .spannerBundle .remove (sp )
867867
868868 s .coreElementsChanged ()
869+ for m in s [stream .Measure ]:
870+ for v in m .voices :
871+ if v : # do not bother with empty voices
872+ # the musicDataMethods use insertCore, thus the voices need to run
873+ # coreElementsChanged
874+ v .coreElementsChanged ()
875+ # Fill mid-measure gaps, and find end of measure gaps by ref to measure stream
876+ # https://github.com/cuthbertlab/music21/issues/444
877+ # but only when the score comes from Finale
878+ if any ("Finale" in software for software in md .software ):
879+ v .makeRests (refStreamOrTimeRange = m ,
880+ fillGaps = True ,
881+ inPlace = True ,
882+ hideRests = True )
883+
869884 s .definesExplicitSystemBreaks = self .definesExplicitSystemBreaks
870885 s .definesExplicitPageBreaks = self .definesExplicitPageBreaks
871886 for p in s .parts :
@@ -2576,16 +2591,7 @@ def parse(self):
25762591
25772592 if self .useVoices is True :
25782593 for v in self .stream .iter ().voices :
2579- if v : # do not bother with empty voices
2580- # the musicDataMethods use insertCore, thus the voices need to run
2581- # coreElementsChanged
2582- v .coreElementsChanged ()
2583- # Fill mid-measure gaps, and find end of measure gaps by ref to measure stream
2584- # https://github.com/cuthbertlab/music21/issues/444
2585- v .makeRests (refStreamOrTimeRange = self .stream ,
2586- fillGaps = True ,
2587- inPlace = True ,
2588- hideRests = True )
2594+ v .coreElementsChanged ()
25892595 self .stream .coreElementsChanged ()
25902596
25912597 if (self .restAndNoteCount ['rest' ] == 1
0 commit comments