Explicit Accidentals in alphaTex #1719
Labels
area-file-formats
Related to supported file formats
platform-all
Affects all platforms
state-accepted
This is a valid topic to work on.
Milestone
Related Discussion: #1717
Current State
alphaTex doesn't allow expressing explicit accidentals for notes. When using pitched notes the note names are only used to describe what note "height" within the octave the note should have, but accidental information is fully ignored.
Feature Description
alphaTex is meant to be a language where you can fill the data model supported by alphaTab and the
Note.accidentalMode
is a missing part in the language. Therefore the alphaTab syntax needs to be extended to allow describing what accidentals you want on a note.Note Effect
The accidental is described like note effects as annotation in the braces after the note. Syntax
acc ACCIDENTAL
whereACCIDENTAL
is one of:Default
->AccidentalMode.Default
#
,ForceSharp
->AccidentalMode.ForceSharp
##
,x
,ForceDoubleSharp
->AccidentalMode.ForceDoubleSharp
b
, 'ForceFlat' ->AccidentalMode.ForceFlat
bb
, 'ForceDoubleFlat' ->AccidentalMode.ForceDoubleFlat
This way the accidentals can be described on any note:
Important: alphaTab will not try to detect combinations of note heights and accidentals which are not really possible and in worst case it might result in wrong notes. We expect notation to be written in a meaningful way and alphaTab places notes according to the known rules of music notation.
Percussion
For percussion tracks any descibed accidentals are ignored.
Pitched Notes
The parsing of pitched notes like 'C#4
should respect the accidentals described in there. The syntax should be
NoteName Accidental Octavewhere
Accidental` can be:#
->AccidentalMode.ForceSharp
##
orx
->AccidentalMode.ForceDoubleSharp
b
->AccidentalMode.ForceFlat
bb
->AccidentalMode.ForceDoubleFlat
Opt-Out on Forced Accidentals
Some authors might prefer to keep the
AccidentalMode.Default
but you are forced to write notes likeC#3
. Therefore alphaTex should allow an opt-out from the forced accidentals and fallback to the classical mode of just using the accidentals to describe the note height. The following syntax should be supported to change the mode how the accidentals are interpreted:\accidentals auto
- Indicates the accidentals are detected automatically (current behavior)\accidentals explicit
- Indicates the accidentals are expressed explicitly and should be respected (new behavior, new default)This tag is then supported on following levels and changing the mode for next notes being parsed:
Further details
I noticed that there might be some bugs in alphaTab today. We should extend the test matrix to check accidental modes and key-signature combinations more widely.
The text was updated successfully, but these errors were encountered: