Skip to content

Explicit Accidentals in alphaTex #1719

@Danielku15

Description

@Danielku15

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 where ACCIDENTAL 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#4should respect the accidentals described in there. The syntax should beNoteName Accidental OctavewhereAccidental` can be:

  • # -> AccidentalMode.ForceSharp
  • ## or x -> 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 like C#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:

  • song level
  • track level
  • staff level
  • bar level

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.

Metadata

Metadata

Assignees

Labels

area-file-formatsRelated to supported file formatsplatform-allAffects all platformsstate-acceptedThis is a valid topic to work on.

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions