diff --git a/music21/musicxml/testPrimitive.py b/music21/musicxml/testPrimitive.py
index c37d17dc44..6e3c3dce70 100644
--- a/music21/musicxml/testPrimitive.py
+++ b/music21/musicxml/testPrimitive.py
@@ -17808,6 +17808,77 @@
"""
+hiddenRests = """
+
+
+
+
+ MusicXML Part
+
+
+
+
+
+ 2
+
+
+ G
+ 2
+
+
+
+
+ E
+ 5
+
+ 4
+ 1
+ half
+ up
+
+
+ 2
+ 1
+
+
+
+ E
+ 4
+
+ 2
+ 1
+ quarter
+ up
+
+
+ 8
+
+
+ 4
+ 2
+
+
+
+ F
+ 4
+
+ 2
+ 2
+ quarter
+ down
+
+
+ 2
+ 2
+
+
+
+
+"""
+
multiDigitEnding = """
@@ -17860,7 +17931,6 @@
"""
-
ALL = [
articulations01, pitches01a, directions31a, lyricsMelisma61d, notations32a, # 0
restsDurations02a, rhythmDurations03a, chordsThreeNotesDuration21c, # 5
@@ -17876,7 +17946,7 @@
mixedVoices1a, mixedVoices1b, mixedVoices2, # 37
colors01, triplets01, textBoxes01, otaveShifts33d, # 40
unicodeStrNoNonAscii, unicodeStrWithNonAscii, # 44
- tremoloTest, multiDigitEnding # 46
+ tremoloTest, hiddenRests, multiDigitEnding # 46
]
diff --git a/music21/musicxml/xmlToM21.py b/music21/musicxml/xmlToM21.py
index d9c7945d37..6a53fbfdd6 100644
--- a/music21/musicxml/xmlToM21.py
+++ b/music21/musicxml/xmlToM21.py
@@ -2323,7 +2323,10 @@ def parse(self):
if self.useVoices is True:
for v in self.stream.iter.voices:
if v: # do not bother with empty voices
- v.makeRests(inPlace=True, hideRests=True)
+ # Fill mid-measure gaps, and find end of measure gaps by ref to measure stream
+ # https://github.com/cuthbertlab/music21/issues/444
+ v.makeRests(refStreamOrTimeRange=self.stream, fillGaps=True,
+ inPlace=True, hideRests=True)
v.coreElementsChanged()
self.stream.coreElementsChanged()
@@ -6463,6 +6466,21 @@ def testFretIndication(self):
self.assertIsInstance(notes[3].articulations[1], articulations.FretIndication)
self.assertEqual(notes[3].articulations[1].number, 3)
+ def testHiddenRests(self):
+ from music21 import converter
+ from music21.musicxml import testPrimitive
+
+ # Voice 1: Half note, (quarter), quarter note
+ # Voice 2: (half), quarter note, (quarter)
+ s = converter.parse(testPrimitive.hiddenRests)
+ v1, v2 = s.recurse().voices
+ self.assertEqual(v1.duration.quarterLength, v2.duration.quarterLength)
+
+ restV1 = [r for r in v1.getElementsByClass(note.Rest)][0]
+ self.assertTrue(restV1.style.hideObjectOnPrint)
+ restsV2 = [r for r in v2.getElementsByClass(note.Rest)]
+ self.assertEqual([r.style.hideObjectOnPrint for r in restsV2], [True, True])
+
def testMultiDigitEnding(self):
from music21 import converter
from music21.musicxml import testPrimitive