MusicXML import ignores jumps written as `<sound>` attributes
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
Start with SoundTagMixin.setSound in musicxml/xmlSoundParser.py, which handles only tempo and has TODOs for dacapo, dalsegno, tocoda, fine, segno and coda, then check how the <words> repeat expressions are created in the MusicXML importer. Run the reproduction script in the issue and confirm the expanded note list includes the second D E pass. Done means a <sound dalsegno> jump is honoured without matching text, and the design question of how multiple <sound> tags map to one jump expression is settled first.
由索引模型根据 Issue 内容生成。
描述
music21 version
10.5.0
Problem summary
The MusicXML importer only creates repeat expressions (Segno, Coda, DalSegnoAlCoda, ...) from the text of <words> directions. It ignores the dacapo, dalsegno, tocoda, fine, segno and coda attributes of <sound>, which are how MusicXML encodes jumps for playback. So when the <words> text isn't one of the recognized phrases, or there's no text, expandRepeats() skips the jump even though the <sound> says exactly what it is.
Steps to reproduce
from music21 import converter
def measure(number, step, before="", after=""):
return (f'<measure number="{number}">{before}<note><pitch><step>{step}</step>'
f'<octave>4</octave></pitch><duration>4</duration><type>whole</type></note>{after}</measure>')
xml = f'''<score-partwise version="4.0">
<part-list><score-part id="P1"><part-name>Music</part-name></score-part></part-list>
<part id="P1">
{measure(1, "C", "<attributes><divisions>1</divisions></attributes>")}
{measure(2, "D", '<direction><direction-type><segno/></direction-type><sound segno="segno"/></direction>')}
{measure(3, "E", after='<direction><direction-type><words>To Coda</words></direction-type><sound tocoda="coda"/></direction>')}
{measure(4, "F", after='<direction><direction-type><words>Repeat from sign, then go to the coda</words></direction-type><sound dalsegno="segno"/></direction>')}
{measure(5, "G", '<direction><direction-type><coda/></direction-type><sound coda="coda"/></direction>')}
</part>
</score-partwise>'''
expanded = converter.parse(xml, format='musicxml').expandRepeats()
print([n.name for n in expanded.flatten().notes])
Expected vs. actual behavior
Expected ['C', 'D', 'E', 'F', 'D', 'E', 'G'], from the dalsegno attribute. Actual:
['C', 'D', 'E', 'F', 'G']
With <words>D.S. al Coda</words> the jump is taken, so this only affects jumps whose text isn't a recognized phrase.
More information
SoundTagMixin.setSound in musicxml/xmlSoundParser.py only handles tempo, and has TODOs for coda, dacapo, dalsegno, fine, segno and tocoda.
A suggestion for how the two sources could combine: if only one of <words> and <sound> gives a jump, use it; if both do and they disagree, prefer <sound>, since it's the playback encoding, and maybe warn.
One complication: music21 represents a jump as a single expression, like DalSegnoAlCoda, but MusicXML spreads it over several <sound>s: dalsegno at the jump, tocoda at the "To Coda", and fine at the Fine. So a <sound dalsegno> on its own only says "D.S.", and telling whether it's "al Coda" or "al Fine" means looking for tocoda or fine elsewhere in the part. For the same reason, <words>D.S. al Coda</words> with <sound dalsegno="segno"/> isn't a disagreement, just a more specific description.
- 主要语言
- Python
- 星标
- 2.6k
- 派生
- 459
- 平均合并
- 1 天 7 小时
- 30 天内合并 PR
- 40
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
cuthbertLab/music21 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
cuthbertLab/music21#2084 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
cuthbertLab/music21#2082 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
cuthbertLab/music21#2074 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
cuthbertLab/music21#2055 · 3 条评论 ·
维护者通常 1 天内回复
-
Slur bezier-x/y from start element gets overwritten by stop element's values可能重新可做 @bingliscodes 于 10 天前认领,目前没有进行中的 PR。 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
cuthbertLab/music21#2019 · 3 条评论 ·
维护者通常 1 天内回复
查看 cuthbertLab/music21 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
PolicyEngine/policyengine-us#10262 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
kellyjonbrazil/jc#788 ·
维护者通常 2 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
`/search.json` ignores the documented `editions.sort` parameter可能已有人在做 @PranavD2905 今天认领。 未关闭Affects: Server Good First Issue Module: Solr Needs: Triage Theme: Public APIs Theme: Search
难度 2/5 1-3 小时 新手友好度 74/100
internetarchive/openlibrary#13989 · 1 条评论 ·
维护者通常 1 天内回复
-
bug P2: misleading query
难度 2/5 1-3 小时 新手友好度 62/100
jeffknupp/association#478 ·