**harm spine import errors out on unrecognized token
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
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.
由索引模型根据 Issue 内容生成。
描述
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:
- a default value for unrecognized tokens
- a way to omit automatic parsing of **harm spines
- 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)
- 主要语言
- Python
- 星标
- 2.6k
- 派生
- 459
- 平均合并
- 6 小时 22 分钟
- 30 天内合并 PR
- 95
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
cuthbertLab/music21 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
cuthbertLab/music21#2190 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
cuthbertLab/music21#2189 ·
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 68/100
cuthbertLab/music21#2088 ·
维护者通常 1 天内回复
-
MusicXML import drops piano-family MIDI programs when the instrument name isn't recognized可能重新可做 @Krishna221308 于 8 天前认领,目前没有进行中的 PR。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
cuthbertLab/music21#2084 · 6 条评论 ·
维护者通常 1 天内回复
-
Slur bezier-x/y from start element gets overwritten by stop element's values可能重新可做 @bingliscodes 于 26 天前认领,目前没有进行中的 PR。 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
cuthbertLab/music21#2019 · 3 条评论 ·
维护者通常 1 天内回复
查看 cuthbertLab/music21 的全部 Issue
相似的 Issue
-
question
难度 2/5 1-3 小时 新手友好度 62/100
conda-forge/vc-feedstock#132 ·
-
难度 2/5 1-3 小时 新手友好度 72/100
limitlessprojects/Go-Hybrid#3342 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 85/100
UKGovernmentBEIS/inspect_ai#6268 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100
LSSTDESC/rail_sompz#42 ·
-
难度 2/5 1-3 小时 新手友好度 66/100
pytest-dev/pytest-forked#113 ·