toSoundingPitch() transposes key signatures by the MIDI program's instrument instead of the part's `<transpose>`
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
- Nửa ngày
- Mức phù hợp với người mới
- 62/100
Hướng nghiên cứu
Start by running the reproduction script in the issue: it parses a MusicXML clarinet-in-A part with and without <midi-program> 72 and calls toSoundingPitch(). The note comes out right, but the key signature only goes wrong when the program is 72, so the bug is in how the importer assigns a Clarinet instrument and how its default transposition is applied to the key. Done means the sounding key has 3 sharps in both cases, matching A major, and the <transpose> value is used consistently.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
music21 version
10.5.0
Problem summary
For a clarinet in A written in C, toSoundingPitch() moves the notes down a minor third, following the part's <transpose>, but it moves the key signature down a major second. When the part's <midi-program> is 72 (clarinet), the importer makes the part's instrument a Clarinet, whose default transposition is that of a B♭ clarinet, and the key signature follows that instead. So the sounding notes are in A major, but the sounding key signature is G major.
Steps to reproduce
from music21 import converter, key
def clarinet_in_a(midi_program):
midi = f'<midi-instrument id="P1-I1"><midi-program>{midi_program}</midi-program></midi-instrument>' if midi_program else ''
return f'''<score-partwise version="4.0">
<part-list><score-part id="P1"><part-name>Clarinet in A</part-name>
<score-instrument id="P1-I1"><instrument-name>Clarinet</instrument-name></score-instrument>{midi}
</score-part></part-list>
<part id="P1"><measure number="1">
<attributes>
<divisions>1</divisions>
<key><fifths>0</fifths></key>
<transpose><diatonic>-2</diatonic><chromatic>-3</chromatic></transpose>
</attributes>
<note><pitch><step>C</step><octave>5</octave></pitch><duration>4</duration><type>whole</type></note>
</measure></part>
</score-partwise>'''
for midi_program in (72, None):
sounding = converter.parse(clarinet_in_a(midi_program), format='musicxml').toSoundingPitch()
print(midi_program,
sounding.flatten().notes[0].nameWithOctave,
[k.sharps for k in sounding.flatten().getElementsByClass(key.KeySignature)],
sounding.parts[0].getInstrument().transposition.directedName)
Expected vs. actual behavior
Expected the note A4 and a key signature with 3 sharps both times. Actual:
72 A4 [1] M-2
None A4 [3] m-3
Without the <midi-program>, the part's instrument takes its transposition from <transpose> (minor third down), and the key signature is correct. With program 72, the importer makes a Clarinet with the B♭ clarinet's default transposition (major second down), and that seems to take priority over <transpose> for the key signature, though not for the notes.
- 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
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.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của cuthbertLab/music21
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
cuthbertLab/music21#2084 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
cuthbertLab/music21#2082 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`TypeError` in `ChordReducer.run()` on multi-part `stream.Score` without instrument `partId`sĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
cuthbertLab/music21#2074 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
cuthbertLab/music21#2055 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Slur bezier-x/y from start element gets overwritten by stop element's valuesCó thể làm lại được @bingliscodes đã nhận 9 ngày trước và không có pull request nào đang mở. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
cuthbertLab/music21#2019 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của cuthbertLab/music21
Issue tương tự
-
documentation good first issue
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 72/100
sujithputta02/Esapay#13 ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Flaky: credential-proxy admission metric test asserts a wall-clock bound it does not establishĐang mởneeds-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
gke-labs/kube-agents#3277 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
jbacalso24/mimry#291 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
good first issue
Độ khó 2/5 Dưới một giờ Mức phù hợp với người mới 82/100
eli-alvarado/us-watchlist-alerts#14 ·
Maintainer thường phản hồi trong vòng 1 ngày