Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Slur bezier-x/y from start element gets overwritten by stop element's values

未关闭 适合新手
#2,019 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@bingliscodes 已经在做这个了。

开始于 2026年10月6日。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
75/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
python, xml
领域
backend

调研方向

The issue points to xmlNotationsToSpanners in musicxml/xmlToM21.py and setStyleAttributes. Read how start and stop <slur> elements route their bezier attributes, then check the slur style fields for the separate bezierX2/bezierY2 slots. Add or run a regression test using the provided MusicXML example; done means both elements’ values are preserved in their respective slots.

由索引模型根据 Issue 内容生成。

描述

When a slur has bezier control points on both its start and stop elements in MusicXML, parsing only keeps the stop element's values, the start element's bezier-x/bezier-y get silently overwritten instead of landing in the (separately named) bezierX2/bezierY2 slots.

Repro:

import music21

xml = '''<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 4.0 Partwise//EN" "http://www.musicxml.org/dtds/partwise.dtd">
<score-partwise version="4.0">
  <part-list><score-part id="P1"><part-name>Music</part-name></score-part></part-list>
  <part id="P1">
    <measure number="1">
      <attributes>
        <divisions>1</divisions>
        <time><beats>2</beats><beat-type>4</beat-type></time>
        <clef><sign>G</sign><line>2</line></clef>
      </attributes>
      <note>
        <pitch><step>C</step><octave>5</octave></pitch>
        <duration>1</duration><type>quarter</type>
        <notations><slur number="1" type="start" bezier-x="11" bezier-y="-22"/></notations>
      </note>
      <note>
        <pitch><step>D</step><octave>5</octave></pitch>
        <duration>1</duration><type>quarter</type>
        <notations><slur number="1" type="stop" bezier-x="-33" bezier-y="44"/></notations>
      </note>
    </measure>
  </part>
</score-partwise>'''

slur = music21.converter.parse(xml, format="musicxml").recurse().getElementsByClass(music21.spanner.Slur)[0]
print(slur.style.bezierX, slur.style.bezierY)  # -33 44 -- should be 11 -22, the START tag's own values

Looks like it's coming from xmlNotationsToSpanners in musicxml/xmlToM21.py, it calls setStyleAttributes once per element found, writing into bezierX/bezierY regardless of whether the element is the start or the stop tag, so whichever one gets processed second wins. The bezier-x2/bezier-y2 attribute names exist and would land in the right slot, but nothing ever routes the stop element's own bezier attributes there.

主要语言
Python
星标
2.6k
派生
459
平均合并
1 天 7 小时
30 天内合并 PR
40

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

cuthbertLab/music21 的其他 Issue

查看 cuthbertLab/music21 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。