Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở
#1,700 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
30/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
data

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
Python
Star
2.6k
Fork
459
Merge trung bình
1 ngày 7 giờ
Pull request đã merge (30 ngày)
40

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của cuthbertLab/music21

Tất cả issue của cuthbertLab/music21

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.