Open liusw02 opened 1 year ago
text shows no problem
Do you mind adding the argument addEndTimes=True to your show('text') call? That would show us whether there is an overlap between the last two notes. That would indicate the issue is with parsing the MIDI (and to investigate further, we'd need you to attach the MIDI file, or better, check how other programs like GarageBand import that file.)
It's possible there is an issue somewhere inside this, where we fail to see that voices are required:
I don't think that midiTrackToStream believes in voices. If a note is sounding and another one comes in then I think it makes a chord and ties the first note to its pitch in the next chord, like a chordify.
In addition to seeing the addEndTimes version, we should see the uncompressed MusicXML version to confirm that it's not an import error by the other software.
I don't think that midiTrackToStream believes in voices. If a note is sounding and another one comes in then I think it makes a chord and ties the first note to its pitch in the next chord, like a chordify.
I quoted too large of a chunk 😅 -- there is a voicesRequired
variable in there.
python code: from music21 import converter,instrument
file = converter.parse('The Shadow of Your Smile.mid') components = []
Recurse = file.recurse() alto = Recurse.parts[0]
print(alto)
excerpt = alto.measures(1,1) excerpt.show('text')
Text {0.0} <music21.stream.Measure 1 offset=0.0> {0.0} <music21.instrument.Piano 'Piano: Piano'> {0.0} <music21.instrument.Instrument 'None'> {0.0} <music21.instrument.ElectricPiano 'Electric Piano'> {0.0}
{0.0}
{0.0} <music21.meter.TimeSignature 4/4>
{0.0}
{1.5}
{2.0}
{2.5}
{3.0}
{3.5}
text shows no problem
music21 write xml note duration error score = stream.Score()
score.insert(0,excerpt) score.insert(0,metadata.Metadata()) score.metadata.title = 'The Shadow of Your Smile' score.metadata.composer = 'example composer' print(type(file),type(excerpt)) score.write('xml',fp=r'The Shadow of Your Smile.xml')
xml <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 3.1 Partwise//EN" "http://www.musicxml.org/dtds/partwise.dtd">
Importing xml sheet music with overt
The red circled part should be eighth notes, but it is wrongly written in xml as quarter notes, the note duration of this bar is longer than 4 (See Figure 1-1)
Using music21 preview also gives an error The red circled part should be eighth notes, but it is wrongly written in xml as quarter notes, the note duration of this bar is longer than 4 There are also eighth rests and thirds. (See Figure 1-2)
Correct
Version win10 Home Chinese 1909 Anaconda3 python 3.97 music21 8.1.3.0
music21-8.3.0 and music21- 8.1.0 both have this problem