Discussion/Proposal: Pitches always have accidentals
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 35/100
Línea de trabajo
Start by reading the Pitch and Accidental implementation and their tests; the issue does not name specific files or tests. Assess how making every Pitch hold an Accidental affects construction, behavior, and performance, including the stated timing comparisons and the proposed terminology changes. Done would require an agreed proposal and corresponding updates, but this issue is a discussion rather than a scoped implementation task.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Similar in vein to #2009 (octave always exists):
Music21 started out with the goal of being able to represent many different ways of thinking about music, globally and historically. One of the things that I wanted to be able to represent was pitch ambiguity.
In a lot of the world's music, especially what I'm most familiar with, Medieval European music, there's a notion of a neutral pitch, like some B, which might be expressed as B-natural or B-flat, but which one is not specified, and tradition and context will determine which to sing. (Tradition and norms is, for instance, why the default B in England became B-natural, but the default B in Germany became B-flat...)
This is why music21 has the concept of Pitch.accidental is None -- it does not mean "don't show a natural" (that would be Pitch.accidental = Accidental('natural', displayType='never') ). It was intended to means that no accidental (sharp/natural/flat) had been applied to this not at all.
What a laudable goal, representing all this way of thinking about music.
Has anyone ever actually done this with music21 (outside some demos I gave ca. 2008)? No. Probably not. Has everyone who ever worked with music21 ever since had to deal with if p.accidental is None or p.accidental.name = 'natural':... -- yes. And has everyone who works with this just always treated None as meaning natural? Yes, surely.
Proposal
Every Pitch object gets an accidental object attached to it -- natural if not specified -- and .accidental will always refer to an Accidental object.
Is there a cost to this?
You bet. Pitches with naturals will take 50% longer to create than they currently do:
In [42]: %timeit pitch.Pitch('C4')
512 ns ± 10.5 ns per loop (mean ± std. dev. of 7 runs, 1,000,000 loops each)
In [43]: %timeit pitch.Pitch('C#4')
750 ns ± 1.92 ns per loop (mean ± std. dev. of 7 runs, 1,000,000 loops each)
this cascades down to Note, as a 17% slowdown:
In [48]: %timeit note.Note('C4')
1.56 μs ± 23.4 ns per loop (mean ± std. dev. of 7 runs, 1,000,000 loops each)
In [49]: %timeit note.Note('C#4')
1.83 μs ± 6.06 ns per loop (mean ± std. dev. of 7 runs, 1,000,000 loops each)
If Accidental had been made immutable like Microtone, then we might be able to get the cost down to near nothing, but instead we can try to make the speed up in other ways.
Like we might stop allowing 'SHARP' instead of 'sharp' or 'FLAT' instead of 'flat' -- save a few ns -- I think that .set() can also be sped up immediately using a one-time created lookup table instead of a bunch of if statements.
Proposal Part 2:
Remove non-standard terminology for half-sharp ~ and half-flat ` -- no one knows what they are and I think better to be explicit ("-half-flat") than obscure.
- Lenguaje dominante
- Python
- Estrellas
- 2.6k
- Forks
- 459
- Merge medio
- 1 d 7 h
- PR fusionados (30 d)
- 40
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de cuthbertLab/music21
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
cuthbertLab/music21#2084 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
cuthbertLab/music21#2082 ·
Los mantenedores suelen responder en 1 día
-
`TypeError` in `ChordReducer.run()` on multi-part `stream.Score` without instrument `partId`sAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
cuthbertLab/music21#2074 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
cuthbertLab/music21#2055 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
Slur bezier-x/y from start element gets overwritten by stop element's valuesQuizá libre de nuevo @bingliscodes la tomó hace 8 días y no hay ningún pull request abierto. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
cuthbertLab/music21#2019 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de cuthbertLab/music21
Issues similares
-
approved Good First Issue scope: docs
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
hiero-ledger/hiero-sdk-python#2730 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
wemake-services/wemake-django-template#3178 · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
md/asciidoc/csv: an explicit `encoding="utf-8"` keeps a leading BOM, the auto-detect path drops itAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
docling-project/docling#4846 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
neurostuff/NiMARE#1181 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
pytest-dev/pytest#15180 ·
Los mantenedores suelen responder en 1 día