Tuplet and Parenthesis Handling Issues in ABC converter (abcFormat)
还没有人认领这个 Issue。
评估
调研方向
Start in music21/abcFormat, where lastTupletToken is set and "Tuplet" is pushed onto self.activeParens, and trace how ABCParenStop pops that stack. Run the reproduction snippet from the issue and check that the slur closes after F and that G is not included. Done means the (C(3DEF)G example yields a slur over C, D, E, F only, with the tuplet timing unchanged.
由索引模型根据 Issue 内容生成。
描述
music21 version
9.7.1
Operating System(s) checked
MacOS 15.5
Problem summary
Hi music21 developers! Thank you for maintaining such a great project!
While working with the ABC converter in music21/abcFormat, I noticed some issues related to how tuplets and parentheses (used for slurs and cresc./dim.) are handled. Here’s what I’ve found:
- ABC tuplet symbols like
(3are tokenized and applied to following notes via thelastTupletTokenvariable. However, at the same time, the string"Tuplet"is pushed onto theself.activeParensstack and only removed upon encountering anABCParenStoptoken. This is problematic because in ABC notation, tuplets are not structured like slurs—they don’t require a closing parenthesis. - Slur stops and crescendo/diminuendo stops are all tokenized as
ABCParenStop, without distinguishing their types. This could cause issues when these constructs appear in alternating patterns. One possible fix is to use separate token types and maintain separate stacks for each construct.
I’m happy to help address these issues! I actually have already done some work to support ABC v2.1 (like multi-voice and inline clef/key/meter change)—but I’m still refining it.
Additionally, the current ABC parsing logic is quite complex. Have we considered building on top of existing tools like abc2xml.py, which already provides a fairly complete ABC parser?
Steps to reproduce
Here is an example:
from music21 import converter
abc_str="""X:1
M:4/4
K:C
L:1/4
(C(3DEF)G|"""
score = converter.parse(abc_str)
score.show('text')
Expected vs. actual behavior
Actual behavior:
{0.0} <music21.metadata.Metadata object at 0x14a13ffee480>
{0.0} <music21.stream.Part 0x14a13fe47b30>
{0.0} <music21.clef.TrebleClef>
{0.0} <music21.key.Key of C major>
{0.0} <music21.meter.TimeSignature 4/4>
{0.0} <music21.spanner.Slur <music21.note.Note C><music21.note.Note D><music21.note.Note E><music21.note.Note F><music21.note.Note G>>
{0.0} <music21.note.Note C>
{1.0} <music21.note.Note D>
{1.6667} <music21.note.Note E>
{2.3333} <music21.note.Note F>
{3.0} <music21.note.Note G>
Expected behavior:
{0.0} <music21.metadata.Metadata object at 0x14a13ffee480>
{0.0} <music21.stream.Part 0x14a13fe47b30>
{0.0} <music21.clef.TrebleClef>
{0.0} <music21.key.Key of C major>
{0.0} <music21.meter.TimeSignature 4/4>
{0.0} <music21.spanner.Slur <music21.note.Note C><music21.note.Note D><music21.note.Note E><music21.note.Note F>>
{0.0} <music21.note.Note C>
{1.0} <music21.note.Note D>
{1.6667} <music21.note.Note E>
{2.3333} <music21.note.Note F>
{3.0} <music21.note.Note G>
The closing parenthesis) should end the slur that starts before C. However, due to interaction with the tuplet parsing, it incorrectly includes the note G in the slur.
More information
I’d be happy to help with:
- Introducing distinct close tokens and separate stacks for each construct (tuplets, slurs, etc.)
- Add new features to support ABC v2.1
- Refactoring or rewriting parts of the ABC parser to improve clarity and modularity if needed
- 主要语言
- Python
- 星标
- 2.6k
- 派生
- 459
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
cuthbertLab/music21 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
cuthbertLab/music21#2190 ·
-
难度 2/5 1-3 小时 新手友好度 62/100
cuthbertLab/music21#2189 ·
-
enhancement
难度 2/5 1-3 小时 新手友好度 68/100
cuthbertLab/music21#2088 ·
-
MusicXML import drops piano-family MIDI programs when the instrument name isn't recognized可能重新可做 @Krishna221308 于 10 天前认领,目前没有进行中的 PR。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
cuthbertLab/music21#2084 · 6 条评论 ·
-
Slur bezier-x/y from start element gets overwritten by stop element's values可能重新可做 @bingliscodes 于 29 天前认领,目前没有进行中的 PR。 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
cuthbertLab/music21#2019 · 3 条评论 ·
查看 cuthbertLab/music21 的全部 Issue
相似的 Issue
-
needs-area-label
难度 2/5 1-3 小时 新手友好度 66/100
维护者通常 2 天内回复
-
enhancement good first issue
难度 2/5 1-3 小时 新手友好度 84/100
Official-Space-AI/OpenPhysGraspGen#114 ·
维护者通常 2 天内回复
-
changelog investigate
难度 2/5 1-3 小时 新手友好度 62/100
ramnes/notion-sdk-py#441 ·
-
qa_bug
难度 2/5 1-3 小时 新手友好度 78/100
NVIDIA-NeMo/Gym#5644 ·
维护者通常 2 天内回复
-
BUG: catalog database credentials printed to logs at startup可能已有人在做 @cjboyle 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 1 天内回复