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

Missing humdrumPosition in thisSpine.stream.flatten() with root cause analysis

Aperta
#1,700 1 commento 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
30/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
python
Ambito
data

Direzione di ricerca

Start with the Humdrum (**kern) parser's DynamSpine.parse() around line 1445, where a Dynamic is created for the piano marking in the pickup measure. Then check the del el.humdrumPosition at about line 1811 and the lookup prioritiesToSearch[dynamic.humdrumPosition] at about line 1947. Done means a score parsed from sonata06-1.krn without an AttributeError, with the pickup dynamic kept in the stream. The reproduction needs the external kern file, so get a local copy first.

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

Descrizione

music21 version

9.1.0

Problem summary

Loaded a krn format into music21 and received the following error message:

AttributeError: 'Dynamic' object has no attribute 'humdrumPosition'

Steps to reproduce

from music21 import converter
score = converter.parse('http://kern.ccarh.org/data?l=beethoven/sonatas&file=sonata06-1.krn')

Expected vs. actual behavior

Expecting the Sonata to render but get error message instead.

Root Cause Analysis

After running the debugger, I noticed that when the parse() method from the DynamSpine class is run in line 1445, and when eventC = 'p', then a Dynamic object is created <music21.dynamics.Dynamic p>. This object has a humdrumPosition attribute. But this attribute is removed from the object in line 1811 (del el.humdrumPosition) which is why when trying to access this attribute in line 1947 (prioritiesToSearch[dynamic.humdrumPosition] = dynamic), we receive the error message.

In this particular sonata, I noticed that the dynamic object is the piano marking in the pickup measure. Curiously, if we remove this marking from the .krn file (line 21), then everything works as expected.

To summarize, it is likely that music21 has difficulty parsing dynamic markings found in pickup measures

Miscellaneous Information
Apple M1 Pro
macOS Sonoma 14.3.1

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.