@@ -1657,16 +1657,6 @@ def setScoreLayouts(self):
16571657 self .firstScoreLayout = scoreLayout
16581658
16591659 def _populatePartExporterList (self ):
1660- if self .makeNotation :
1661- # hide any rests created at this late stage, because we are
1662- # merely trying to fill up MusicXML display, not impose things on users
1663- for p in self .parts :
1664- p .makeRests (refStreamOrTimeRange = self .refStreamOrTimeRange ,
1665- inPlace = True ,
1666- hideRests = True ,
1667- timeRangeFromBarDuration = True ,
1668- )
1669-
16701660 count = 0
16711661 sp = list (self .parts )
16721662 for innerStream in sp :
@@ -1683,9 +1673,7 @@ def _populatePartExporterList(self):
16831673 def parsePartlikeScore (self ):
16841674 '''
16851675 Called by .parse() if the score has individual parts.
1686-
1687- Calls makeRests() for the part (if `ScoreExporter.makeNotation` is True),
1688- then creates a `PartExporter` for each part, and runs .parse() on that part.
1676+ Creates a `PartExporter` for each part, and runs .parse() on that part.
16891677 Appends the PartExporter to `self.partExporterList`
16901678 and runs .parse() on that part. Appends the PartExporter to self.
16911679
@@ -2652,19 +2640,27 @@ def parse(self):
26522640 self .stream .toWrittenPitch (inPlace = True )
26532641
26542642 # Suppose that everything below this is a measure
2655- if self .makeNotation and not self .stream .getElementsByClass (stream .Measure ):
2656- self .fixupNotationFlat ()
2657- elif self .makeNotation :
2658- self .fixupNotationMeasured ()
2643+ if self .makeNotation :
2644+ # hide any rests created at this late stage, because we are
2645+ # merely trying to fill up MusicXML display, not impose things on users
2646+ self .stream .makeRests (refStreamOrTimeRange = self .refStreamOrTimeRange ,
2647+ inPlace = True ,
2648+ hideRests = True ,
2649+ timeRangeFromBarDuration = True ,
2650+ )
2651+
2652+ # Split complex durations in place (fast if none found)
2653+ # Do this after makeRests since makeRests might create complex durations
2654+ self .stream = self .stream .splitAtDurations (recurse = True )[0 ]
2655+
2656+ if self .stream .getElementsByClass (stream .Measure ):
2657+ self .fixupNotationMeasured ()
2658+ else :
2659+ self .fixupNotationFlat ()
26592660 elif not self .stream .getElementsByClass (stream .Measure ):
26602661 raise MusicXMLExportException (
26612662 'Cannot export with makeNotation=False if there are no measures' )
26622663
2663- # Split complex durations in place (fast if none found)
2664- # must do after fixupNotationFlat(), which may create complex durations
2665- if self .makeNotation :
2666- self .stream = self .stream .splitAtDurations (recurse = True )[0 ]
2667-
26682664 # make sure that all instances of the same class have unique ids
26692665 self .spannerBundle .setIdLocals ()
26702666
@@ -2841,7 +2837,7 @@ def fixupNotationMeasured(self):
28412837 them into the first measure if necessary.
28422838
28432839 Checks if makeAccidentals is run, and haveBeamsBeenMade is done, and
2844- haveTupletBracketsBeenMade is done .
2840+ remake tuplets on the assumption that makeRests() may necessitate changes .
28452841
28462842 Changed in v7 -- no longer accepts `measureStream` argument.
28472843 '''
@@ -2871,16 +2867,20 @@ def fixupNotationMeasured(self):
28712867 if outerTimeSignatures :
28722868 first_measure .timeSignature = outerTimeSignatures .first ()
28732869
2874- # see if accidentals/beams/tuplets should be processed
2870+ # see if accidentals/beams should be processed
28752871 if not part .streamStatus .haveAccidentalsBeenMade ():
28762872 part .makeAccidentals (inPlace = True )
28772873 if not part .streamStatus .beams :
28782874 try :
28792875 part .makeBeams (inPlace = True )
2880- except exceptions21 .StreamException : # no measures or no time sig?
2881- pass
2882- if part .streamStatus .haveTupletBracketsBeenMade () is False :
2883- stream .makeNotation .makeTupletBrackets (part , inPlace = True )
2876+ except exceptions21 .StreamException as se : # no measures or no time sig?
2877+ warnings .warn (MusicXMLWarning , str (se ))
2878+ # tuplets should be processed anyway (affected by earlier makeRests)
2879+ # technically, beams could be affected also, but we don't want to destroy
2880+ # existing beam information (e.g. single-syllable vocal flags)
2881+ for m in measures :
2882+ for m_or_v in [m , * m .voices ]:
2883+ stream .makeNotation .makeTupletBrackets (m_or_v , inPlace = True )
28842884
28852885 if not self .spannerBundle :
28862886 self .spannerBundle = part .spannerBundle
0 commit comments