Skip to main content

Bar Metadata

For bars various tags can be specified which change information like clefs, key signatures repeats etc. They follow the format \tag value value just like the score metadata. Be sure not to mix the score metadata and the bar metadata of the first bar.

\ts​

Syntax
\ts common
\ts (numerator denominator)

Description: Defines the time signature for this and subsequent bars.

AlphaTab does not yet support polytempo notation where instruments might use different time signatures. Therefore be sure to only specify the timesignatures once as part of the first track/staff or ensure they are consistent across the whole document.

Values:

NameDescriptionTypeRequired
commonSpecifies a common (4/4) time signature using the special C symbolidentifieryes
numeratorThe time signature numeratornumberyes
numeratorThe time signature denominatornumberyes

Example:

\ts 3 4 | \ts 4 4 | \ts 6 8 | \ts common
\ts 3 4 | \ts 4 4 | \ts 6 8 | \ts common

There are no properties on this metadata.

\ro​

Syntax
\ro

Description: Marks the start of a repeat.

Values: None

Example:

\ro 1.3 2.3 3.3 4.3 | 5.3 6.3 7.3 8.3 | \rc 2 1.3 2.3 3.3 4.3 | \ro \rc 3 1.3 2.3 3.3 4.3
\ro 1.3 2.3 3.3 4.3 | 5.3 6.3 7.3 8.3 | \rc 2 1.3 2.3 3.3 4.3 |
\ro \rc 3 1.3 2.3 3.3 4.3

There are no properties on this metadata.

\rc​

Syntax
\rc repeats

Description: Marks the end of a repeat.

Values:

NameDescriptionTypeRequired
repeatsThe number of repeats which should be playednumberyes

Example:

\ro 1.3 2.3 3.3 4.3 | 5.3 6.3 7.3 8.3 | \rc 2 1.3 2.3 3.3 4.3 | \ro \rc 3 1.3 2.3 3.3 4.3
\ro 1.3 2.3 3.3 4.3 | 5.3 6.3 7.3 8.3 | \rc 2 1.3 2.3 3.3 4.3 |
\ro \rc 3 1.3 2.3 3.3 4.3

There are no properties on this metadata.

\ae​

Syntax
\ae ending
\ae (ending ending...)

Description: Specifies on which repeats a bar should be played (to build alternate endings).

Values:

NameDescriptionTypeRequired
endingThe repeats on which the bar should be playednumber listyes

Example:

\ro 1.3 2.3 3.3 4.3 | \ae (1 2 3) 5.3 6.3 7.3 8.3 | \ae 4 \rc 4 5.3 8.3 7.3 6.3
\ro 1.3 2.3 3.3 4.3 | \ae (1 2 3) 5.3 6.3 7.3 8.3 | \ae 4 \rc 4 5.3 8.3 7.3 6.3

There are no properties on this metadata.

\ks​

Syntax
\ks key

Description: Specifies the key signature for this and subsequent bars.

Values:

NameDescriptionTypeRequired
keyThe key signatureidentifieryes

For major keys, the value is one of Cb, Gb, Db, Ab, Eb, Bb, F, C, G, D, A, E, B, F#, C#. Their equivalent minor scale can also be used, so Bminor is the same as D etc. A major scale can also be explicitly written out, like Dmajor.

Example:

\ks Cb | \ks C | \ks C# | \ks Aminor | \ks Dmajor | \ks Bminor
\ks Cb | \ks C | \ks C# |
\ks Aminor | \ks Dmajor | \ks Bminor

There are no properties on this metadata.

\clef​

Syntax
\clef clef

Description: Changes the clef for this and subsequent bars.

Values:

NameDescriptionTypeRequired
clefThe clefidentifieryes

Following clefs are supported: G2, Treble, F4, Bass, C3, Tenor, C4, Alto, N, Neutral

Example:

\clef G2 | \clef F4 | \clef C3 | \clef C4 | \clef N | \clef Treble | \clef Bass | \clef Tenor | \clef Alto | \clef Neutral |
\clef G2 | \clef F4 | \clef C3 | \clef C4 | \clef N |
\clef Treble | \clef Bass | \clef Tenor | \clef Alto | \clef Neutral |

\ottava​

Syntax
\ottava ottava

Description: Changes the clef ottave for this and subsequent bars.

Values:

NameDescriptionTypeRequired
ottavaThe clef ottavaidentifieryes

Following ottavia are supported: 15ma, 8va, regular, 8vb, 15mb

Example:

\clef F4 \ottava 15ma | | \ottava regular | | \clef C3 \ottava 8vb | |
\clef F4 \ottava 15ma | | \ottava regular | | \clef C3 \ottava 8vb | |

There are no properties on this metadata.

\tempo​

Syntax
\tempo tempo
\tempo (tempo label position hide)

Description: Adds a tempo change to the bar.

A bar can have multiple tempo changes. They can either be relatively positioned using this metadata tag or applied via the tempo property as beat effect.

Tempo changes affect the whole song and not only an individual track. To avoid unexpected side effects, we recomment to specify the tempo changes only once on the first track/staff.

Values:

NameDescriptionTypeRequired
tempoThe new tempo in BPMnumberyes
labelA textual label for the temponumberno
positionA relative (ratio) position where within the bar the tempo change should happennumber (float, 0-1)no
hideIf specified the tempo change is not visually shownidentifierno

Example:

\tempo 30 C4 D4 E4 F4 | \tempo (120 "Moderate") \tempo (60 "" 0.5 hide) C4 D4 E4 F4 |
\tempo 30
C4 D4 E4 F4 |
\tempo (120 "Moderate")
\tempo (60 "" 0.5 hide)
C4 D4 E4 F4 |

There are no properties on this metadata.

\tf​

Syntax
\tf tripletFeel

Description: Changes the triplet feel (aka. swing) play style.

Values:

NameDescriptionTypeRequired
tripletFeelThe triplet feel styleidentifieryes
TripletFeelPossible values
No Triplet Feelnone
Triplet 16thtriplet16th
Triplet 8thtriplet8th
Dotted 16thdotted16th
Dotted 8thdotted8th
Scottish 16thscottish16th
Scottish 8thscottish8th

Example:

\tf none 3.3*4 | \tf triplet16th 3.3*4 | \tf triplet8th 3.3*4 | \tf dotted16th 3.3*4 | \tf dotted8th 3.3*4 | \tf scottish16th 3.3*4 | \tf scottish8th 3.3*4 |
\tf none 3.3*4 |
\tf triplet16th 3.3*4 | \tf triplet8th 3.3*4 |
\tf dotted16th 3.3*4 | \tf dotted8th 3.3*4 |
\tf scottish16th 3.3*4 | \tf scottish8th 3.3*4 |

There are no properties on this metadata.

\ac​

Syntax
\ac

Description: Marks the bar as an anacrusis (pick-up) bar.

By default bars follow a strict timing defined by the time signature and tempo. Anacrusis (aka. pickup bars) do not follow this rule. The length of those bars is defined by the actual beats/notes in the bar.

Values: None

Example:

\ks D \ts 24 16 \ac r.16 6.3 7.3 9.3 7.3 6.3 | r.16 5.4 7.4 9.4 7.4 5.4 6.3.4{d} 9.6.16 10.6 12.6 10.6 9.6 14.6.4{d} r.16
\ks D \ts 24 16 \ac r.16 6.3 7.3 9.3 7.3 6.3 | r.16 5.4 7.4 9.4 7.4 5.4 6.3.4{d} 9.6.16 10.6 12.6 10.6 9.6 14.6.4{d} r.16

There are no properties on this metadata.

\section​

Syntax
\section marker text
\section text

Description: Starts a new section within the song (intro, outro,..)

Values:

NameDescriptionTypeRequired
markerThe marker for the section, typically a single letterstringno
textThe text/description of the new sectionstringyes

Example:

\section "Intro" // simple section 1.1 1.1 1.1 1.1 | 1.1 1.1 1.1 1.1 | \section S Solo // with marker and section name differently 1.1 1.1 1.1 1.1
\section "Intro" // simple section
1.1 1.1 1.1 1.1 | 1.1 1.1 1.1 1.1 |
\section S Solo // with marker and section name differently
1.1 1.1 1.1 1.1

There are no properties on this metadata.

\jump​

Syntax
\jump direction

Description: Adds a direction/jump instruction to the bar.

Values:

NameDescriptionTypeRequired
directionThe direction to addidentifieryes

Jump Targets

  • Fine
  • Segno
  • SegnoSegno
  • Coda
  • DoubleCoda

Jump Instructions

  • DaCapo

  • DaCapoAlCoda

  • DaCapoAlDoubleCoda

  • DaCapoAlFine

  • DalSegno

  • DalSegnoAlCoda

  • DalSegnoAlDoubleCoda

  • DalSegnoAlFine

  • DalSegnoSegno

  • DalSegnoSegnoAlCoda

  • DalSegnoSegnoAlDoubleCoda

  • DalSegnoSegnoAlFine

  • DaCoda

  • DaDoubleCoda

Example:

. \ro \rc 2 3.3*4 | 3.3*4 | \jump Segno 3.3*4 | \ro \rc 2 3.3*4 | \jump DaCoda 3.3*4 | 3.3*4 | 3.3*4 \jump DalSegnoAlCoda 3.3*4 | 3.3*4 | \jump Coda 3.3*4 | 3.3*4 | 3.3*4
.
\ro \rc 2 3.3*4 |
3.3*4 |
\jump Segno 3.3*4 |
\ro \rc 2 3.3*4 |
\jump DaCoda 3.3*4 |
3.3*4 | 3.3*4
\jump DalSegnoAlCoda 3.3*4 |
3.3*4 |
\jump Coda 3.3*4 |
3.3*4 |
3.3*4

There are no properties on this metadata.

\ft​

Syntax
\ft

Description: Marks the bar as a free-time bar where players are free to vary the playback.

Values: None

Example:

. :2 C4*2 | \ft C4*2 | \ft C4*2 | C4*2 |
.
:2
C4*2 |
\ft C4*2 |
\ft C4*2 |
C4*2 |

There are no properties on this metadata.

\simile​

Syntax
\simile mark

Description: Adds a simile mark to the bar indicating that the content of the last, or previous two bars should be repeated.

Values:

NameDescriptionTypeRequired
markThe mark to addidentifieryes
  • none - No simile mark is applied
  • simple - A simple simile mark. The previous bar is repeated.
  • firstofdouble - A double simile mark. This value is assigned to the first bar of the 2 repeat bars.
  • secondofdouble - A double simile mark. This value is assigned to the second bar of the 2 repeat bars.

Example:

3.3*4 | \simile simple | 3.3*4 | 4.3*4 | \simile firstofdouble | \simile secondofdouble
3.3*4 | \simile simple | 3.3*4 | 4.3*4 | \simile firstofdouble | \simile secondofdouble

There are no properties on this metadata.

\barlineLeft and \barlineRight​

Syntax
\barlineLeft style
\barlineRight style

Description: Adjusts the lines which will be shown left and right on the bar.

For some special notation needs, the default bar line can be adjusted on every bar. The bar line styles are aligned with the ones from MusicXML.

alphaTab attempts to reuse lines on overlapping styles across bars.

Values:

NameDescriptionTypeRequired
styleThe line style to useidentifieryes

Available styles:

  • automatic - Bar lines are determined automatically based on details like repeats and free time (default).
  • dashed
  • dotted
  • heavy
  • heavyheavy
  • heavylight
  • lightheavy
  • lightlight
  • none
  • regular
  • short
  • tick

Example:

\instrument piano . \track "Overlapping" \staff \barlineleft dashed \barlineright dotted | \barlineleft heavyheavy \barlineright heavyheavy \staff \barlineleft lightlight \barlineright lightheavy | \barlineleft heavylight \barlineright dashed \track "All Styles" \staff \barlineright dashed | \barlineright dotted | \barlineright heavy | \barlineright heavyHeavy | \barlineright heavyLight | \barlineright lightHeavy | \barlineright lightlight | \barlineright none | \barlineright regular | \barlineright short | \barlineright tick |
\instrument piano
.
\track "Overlapping"
\staff
\barlineleft dashed
\barlineright dotted
|
\barlineleft heavyheavy
\barlineright heavyheavy

\staff
\barlineleft lightlight
\barlineright lightheavy
|
\barlineleft heavylight
\barlineright dashed
\track "All Styles"
\staff
\barlineright dashed |
\barlineright dotted |
\barlineright heavy |
\barlineright heavyHeavy |
\barlineright heavyLight |
\barlineright lightHeavy |
\barlineright lightlight |
\barlineright none |
\barlineright regular |
\barlineright short |
\barlineright tick |

There are no properties on this metadata.

\scale​

Syntax
\scale scale

Description: Adjusts the relative scale of the bar when using systemsLayoutMode: 'UseModelLayout' with the page layout.

Values:

NameDescriptionTypeRequired
scaleThe scale of the bar within the systemnumber (float)yes

Example:

\track { defaultSystemsLayout 3 } \scale 0.25 :1 c4 | \scale 0.5 c4 | \scale 0.25 c4 | \scale 0.5 c4 | \scale 2 c4 | \scale 0.5 c4 | c4 | c4
\track { defaultSystemsLayout 3 }
\scale 0.25 :1 c4 | \scale 0.5 c4 | \scale 0.25 c4 |
\scale 0.5 c4 | \scale 2 c4 | \scale 0.5 c4 |
c4 | c4

There are no properties on this metadata.

\width​

Syntax
\width width

Description: Adjusts the absolute of the bar when using systemsLayoutMode: 'UseModelLayout' with the horizontal layout.

Values:

NameDescriptionTypeRequired
widthThe absolute width of the barnumberyes

Example:

\track \width 100 :1 c4 | \width 300 c4 | \width 350 c4
\track
\width 100 :1 c4 | \width 300 c4 | \width 350 c4

There are no properties on this metadata.

\sync​

Syntax
\sync (barIndex occurence millisecondOffset ratioPosition)

Description: Adds a new sync point for synchronizing the music sheet with an external media source like a backing track or video player.

alphaTex support specifying sync points for the synchronization with external media.

It is recommended to add the sync points at the very end of the song but it is also possible to define them inbetween.

The barIndex, occurence, ratioPosition values define the absolute position within the music sheet. The millisecondOffset defines the absolute position within the external media.

With this information known, alphaTab can synchronize the external media with the music sheet.

Values:

NameDescriptionTypeRequired
barIndexThe index of the bar being syncednumberyes
occurenceThe occurence of the bar for which this sync point applies (on repeats)numberyes
millisecondOffsetThe absolute millisecond offset within the external medianumberyes
ratioPositionThe relative position within the bar where the synchronization happensnumberno

Example:

The sample below uses an audio backing track with inconsistent tempos. The sync points correct the tempo differences and the cursor is placed correctly.

\title "Prelude in D Minor"
\artist "J.S. Bach (1685-1750)"
\copyright "Public Domain"
\tempo 80
.
\ts 3 4
0.4.16 (3.2 -.4) (1.1 -.4) (5.1 -.4) 1.1 3.2 1.1 3.2 2.3.8 (3.2 3.4) |
(3.2 0.4).16 (3.2 -.4) (1.1 -.4) (5.1 -.4) 1.1 3.2 1.1 3.2 2.3.8 (3.2 3.4) |
(3.2 0.4).16 (3.2 -.4) (3.1 -.4) (6.1 -.4) 3.1 3.2 3.1 3.2 3.3.8 (3.2 0.3) |
(3.2 0.4).16 (3.2 -.4) (3.1 -.4) (6.1 -.4) 3.1 3.2 3.1 3.2 3.3.8 (3.2 0.3) |
.
\sync 0 0 0
\sync 0 0 1500 0.666
\sync 1 0 4075 0.666
\sync 2 0 6475 0.333
\sync 3 0 10223 1

\accidentals​

Syntax
\accidentals mode

Description: Changes the mode how alphaTab should treat accidentals when writing pitched notes.

alphaTab can use the accidentals as specified in alphaTex, or apply accidentals automatically based on the note pitch.

Values:

NameDescriptionTypeRequired
modeThe mode which should be activeauto or explicityes

Example:

\accidentals explicit C#4 C4 Eb4 Ax4 | \accidentals auto C#4 C4 Eb4 Ax4 |
\accidentals explicit
C#4 C4 Eb4 Ax4 |
\accidentals auto
C#4 C4 Eb4 Ax4 |

There are no properties on this metadata.

\spd, \spu and \sph​

Syntax
\spd position
\sph position
\spu position

Description: Specifies how the sustain petal should be pressed down (spd), held (sph) or lifted up (spu).

This tag allows specifying the sustain pedal relative to the bar. The sustain pedal can also be applied via beat properties.

Values:

NameDescriptionTypeRequired
positionThe relative position within the bar for the markernumber (float, 0-1)yes

Example:

\spd 0 \spu 0.25 \spd 0.5 \sph 0.75 \spu 1 :8 C4 * 8
\spd 0
\spu 0.25
\spd 0.5
\sph 0.75
\spu 1
:8 C4 * 8

There are no properties on this metadata.