You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
awanger
changed the title
Missing humdrumPosition thisSpine.stream.flatten() with root cause analysis
Missing humdrumPosition in thisSpine.stream.flatten() with root cause analysis
Apr 1, 2024
music21 version
9.1.0
Problem summary
Loaded a krn format into music21 and received the following error message:
Steps to reproduce
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 theDynamSpine
class is run in line 1445, and wheneventC
='p'
, then a Dynamic object is created<music21.dynamics.Dynamic p>
. This object has ahumdrumPosition
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
The text was updated successfully, but these errors were encountered: