Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Tuplet and Parenthesis Handling Issues in ABC converter (abcFormat)

Abierto
#1,798 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
1-2 días
Aptitud para principiantes
30/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
python
Área
data

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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 (3 are tokenized and applied to following notes via the lastTupletToken variable. However, at the same time, the string "Tuplet" is pushed onto the self.activeParens stack and only removed upon encountering an ABCParenStop token. 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
Lenguaje dominante
Python
Estrellas
2.6k
Forks
459
Merge medio
1 d 1 h
PR fusionados (30 d)
42

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de cuthbertLab/music21

Todos los issues de cuthbertLab/music21

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.