Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

MIDI import: makeTies()/makeMeasures() permanently desyncs later note offsets by whole bars when simultaneous notes of different length collide

Aperta
#2,020 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
54/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Tranquilla
Stack tecnologico
python
Ambito
backend

Direzione di ricerca

Start by reproducing the supplied MIDI example with mido and music21.converter.parse(..., quantizePost=False), then trace midiTrackToStream and its makeMeasures()/makeTies() processing. Compare the resulting note offsets with the raw MIDI event timing; done means the final note lands at offset 12.0 rather than 16.0 and later offsets remain synchronized.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

music21 version: 10.5.0

MIDI import permanently desyncs note offsets by one bar once a short tied note ends while a longer tied note is still sounding — every later note shifts one bar late from there on. Seen on real orchestral MIDI, inflating a track's measure count.

Minimal reproduction

import mido, music21

t = 480
mid = mido.MidiFile(ticks_per_beat=t, type=1)
trk = mido.MidiTrack(); mid.tracks.append(trk)
M = mido.Message
trk.extend([
    M('note_on',  note=58, velocity=100, time=0),
    M('note_on',  note=62, velocity=100, time=0),
    M('note_on',  note=55, velocity=100, time=0),
    M('note_off', note=58, velocity=0,   time=t*8),
    M('note_off', note=62, velocity=0,   time=0),
    M('note_off', note=55, velocity=0,   time=t*4),
    M('note_on',  note=60, velocity=100, time=0),
    M('note_off', note=60, velocity=0,   time=t),
])
mid.save('repro.mid')

raw = music21.converter.parse('repro.mid', quantizePost=False)
for n in sorted(raw.flatten().notes, key=lambda x: x.offset):
    print(n.offset, n.quarterLength, n.tie)

Last note should land at offset 12.0; it lands at 16.0:

0.0  4.0  <Tie start>
0.0  4.0  <Tie start>
8.0  4.0  <Tie stop>
8.0  4.0  <Tie continue>
12.0 4.0  <Tie stop>
16.0 1.0  None

Workaround: cross-check against a raw mido decode and rebuild when it disagrees; real fix likely belongs in midiTrackToStream's makeMeasures()/makeTies().

Lingua principale
Python
Stelle
2.6k
Fork
459
Merge medio
1g 7h
PR unite (30g)
40

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di cuthbertLab/music21

Tutte le issue di cuthbertLab/music21

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.