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

**harm spine import errors out on unrecognized token

Đang mở
#1,655 0 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ó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
28/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 harm-token handling in music21/humdrum/harmparser.py, where the parser returns None for unrecognized tokens (around line 66), and reproduce by parsing the linked .krn file with converter.parse(format='humdrum'). Done means an unrecognized **harm token no longer raises, and the maintainers have settled whether the fix is a default object, an opt-out setting, or keeping the raw token string, since the issue lists all three without choosing. The thread has no replies and the issue is over three years old, so confirm the approach with a maintainer before writing code.

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

Mô tả

music21 version

8.3.0

Problem summary

Steps to reproduce

import music21
path = 'https://raw.githubusercontent.com/jcdevaney/TAVERN/master/Beethoven/B068/Joined/B068_00_01a_a.krn'
score = music21.converter.parse(path, format='humdrum')   # raises type error

Expected vs. actual behavior
I would expect the **harm spine parser to either not run by default or to handle unrecognized symbols without raising an error. If running the parser remains the default, perhaps there could be a setting that lets us not run the parser.

More information
This was run on a mac m1. An easy fix would be to have some sort of handling of unrecognized chord symbols. This line currently returns None which is fine but the final result of an unrecognized token should be some kind of default or empty music21 roman object.
The reason the score linked to above doesn't process is because it encodes the duration information into the chord tokens as well which is a relatively common thing to do in humdrum. In my case, I am not even using the results of the HarmParser. Instead I use music21's tools for reading any spine and take the **harm tokens as they are. But even doing it this way does not work without editing the score to remove the durations and occasional other unrecognized tokens.
Ideally there would be:

  1. a default value for unrecognized tokens
  2. a way to omit automatic parsing of **harm spines
  3. a bit of a side-quest, but it seems like you should be able to access the original **harm token's string no matter how it eventually gets represented (like the .contents attribute of objects in spine.eventList)
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.