Introduction

In this section you find all details about how to write music notation using AlphaTex. AlphaTex is a text format for writing music notation for AlphaTab. AlphaTex loading can be enabled by specifying data-tex="true" on the container elmement. AlphaTab will load the tex code from the element contents and parse it. AlphaTex currently only allows writing of a single track.

Showcase

Here is an example score fully rendered using alphaTex.

\title "Canon Rock" \subtitle "JerryC" \tempo 90 . :2 19.2{v f} 17.2{v f} | 15.2{v f} 14.2{v f}| 12.2{v f} 10.2{v f}| 12.2{v f} 14.2{v f}.4 :8 15.2 17.2 | 14.1.2 :8 17.2 15.1 14.1{h} 17.2 | 15.2{v d}.4 :16 17.2{h} 15.2 :8 14.2 14.1 17.1{b(0 4 4 0)}.4 | 15.1.8 :16 14.1{tu 3} 15.1{tu 3} 14.1{tu 3} :8 17.2 15.1 14.1 :16 12.1{tu 3} 14.1{tu 3} 12.1{tu 3} :8 15.2 14.2 | 12.2 14.3 12.3 15.2 :32 14.2{h} 15.2{h} 14.2{h} 15.2{h}14.2{h} 15.2{h}14.2{h} 15.2{h}14.2{h} 15.2{h}14.2{h} 15.2{h}14.2{h} 15.2{h}14.2{h} 15.2{h}

Metadata

Metadata is specified using \tagname value value at the beginning of the score. It can be used to specify global information like title, tempo or track tuning. Metadata is optional, but if specified, it must be followed by a dot do indicate the end of the metadata.

// Song information \title "Song Title" \subtitle Subtitle \artist Artist \album 'My Album' \words Daniel \music alphaTab \copyright Daniel // Tempo in BPM \tempo 200 // Instrument as General Midi number or name \instrument 30 // Capo fret \capo 2 // String tuning starting at the most bottom string \tuning e5 b4 g4 d4 a3 e3 .

Notes

The following examples show how to general notes. Multiple bars are separated by |.

Single notes and rests

Notes follow the format fret.string.duration. For rests the fret is simply replaced with r. The duration is specified as a number where 1 represents a full note, 2 a half note and so on.

0.6.2 1.5.4 3.4.4 | 5.3.8 5.3.8 5.3.8 5.3.8 r.2

Chords

To specify multiple notes on a beat, group them in parenthesis. The full format is (fret.string fret.string ...).duration

(0.3 0.4).4 (3.3 3.4).4 (5.3 5.4).4 r.8 (0.3 0.4).8 | r.8 (3.3 3.4).8 r.8 (6.3 6.4).8 (5.3 5.4).4 r.4 | (0.3 0.4).4 (3.3 3.4).4 (5.3 5.4).4 r.8 (3.3 3.4).8 | r.8 (0.3 0.4).8

Duration Ranges

To make it simpler to write notes, you can apply the same duration to multiple notes. Start a new duration range with :duration. The following notes will all have this duration. AlphaTex also remembers the last explictely set duration and will take use it in case of a missing duration.

// explicit ranges via :duration :4 2.3 3.3 :8 3.3 4.3 3.3 4.3 | // implicit ranges via beat duration 2.3.4 3.3 3.3.8 4.3 3.3 4.3

Repeat beats

You can specify a multiplier after a beat to add the same beat multiple times to the score.

3.3*4 | 4.3*4

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.

Time Signatures

Time signatures have the format \ts Numerator Denominator

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

Repeats

Repeats can be started with \ro and be closed with \rc Count. Count specifies how often the bar range is repeated.

\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 |

Key Signatures

The key signature can be specified with \ks Value where the value is one of the following: Cb, Gb, Db, Ab, Eb, Bb, F, C, G, D, A, E, B, F#, C#

\ks Cb | \ks C | \ks C#

Clef

To change the clef simply specify \clef Clef where Clef is one of the following values: G2, Treble, F4, Bass, C3, Tenor, C4, Alto, N, Neutral

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

Tempo

To change the tempo of the score you can specify \tempo BPM.

// score meta also supports \tempo, therefore we skip the score meta with a dot . // bars \tempo 30 1.3 2.3 3.3 4.3 | \tempo 80 1.3 2.3 3.3 4.3 |

Beat Effects

There are various effects that can be applied to a beat. All beat effects are specified in braces after the beat. Beat{Effects}

Simple Effects

Please find the list of support effects in the example below.

// fade in 3.3{f} // vibrato 3.3{v} // slap 3.3{s} // pop 3.3{p} | // dotted 3.3{d} // double dotted 3.3{dd} // pick stroke (su => up, sd => down) 3.3{su} 3.3{sd} | // grace (on beat) 3.3{gr ob} 3.3 // grace (before beat) 3.3{gr} 3.3 | // Tuplets (supported variants: 3,5,6,7,9,10,11,12) 3.3{tu 3} 3.3{tu 3} 3.3{tu 3} 3.3{tu 5} 3.3{tu 5} 3.3{tu 5} 3.3{tu 5} 3.3{tu 5} | // tremolo picking (`tp duration` where duration can be 8,16 or 32) 3.3{tp 8} 3.3{tp 16} 3.3{tp 32}

Tremolo / Whammy Bar

The tremolo/whammy bar effect is a bit more complex than the others. You can specify a number of values which are evenly distributed over the time when the note is played. The values indicate the number of quarter notes increased or decreased on playing. tb (value1 value2 ...)

3.3.1{tb (0 4 0 8)} | 3.3.1{tb (0 -4 0 -8)} |

Note Effects

Just like beat effects, there are also effects for single notes like harmonics, bends, accentuations etc. The syntax is Fret.String{NoteEffects}

Simple Effects

Please find the list of support effects in the example below.

// Harmonics (natural, articifial, tapped, pinch and semi) :8 3.3{nh} 3.3{ah} 3.3{th} 3.3{ph} 3.3{sh} | // trill (tr fret duration) :4 3.3{tr 4 16} 3.3{tr 5 32} 3.3{tr 6 64} // vibrato 3.3{v} | // slides (legato and shift) 3.3{sl} 3.3{ss} // hammer on/pull offs 3.3{h} 4.3{h} | // ghost notes 3.3{g} // accentuations (normal and heavy) 3.3{ac} 3.3{hac} // staccato 3.3{st} | // palm mute 3.3{pm} 3.3{pm} 3.3{pm} 3.3{pm} | // let ring 3.3{lr} 3.3{lr} 3.3{lr} 3.3{lr} | // dead notes 3.3{x} x.3 | // fingering (left and right; 1 => Thumb, 2 => Index, 3 => Middle, 4 => Annual, 5 => Little) :8 3.3{lf 1} 3.3{lf 2} 3.3{lf 3} 3.3{lf 4} 3.3{lf 5} (2.2{lf 4} 2.3{lf 3} 2.4{lf 2}) | :8 3.3{rf 1} 3.3{rf 2} 3.3{rf 3} 3.3{rf 4} 3.3{lf 5} |

Bends

The bend effect works like the tremolo/whammy bar effect. You can specify a number of values which are evenly distributed over the time when the note is played. The values indicate the number of quarter notes increased bend up upon playing. b (value1 value2 ...)

3.3{b (0 4 )} | 3.3{b (0 4 0 8)} |

Exporter

AlphaTab can export an already loaded track as alphaTex.

Open a Guitar Pro file by clicking here to export the first track as alphaTex.
function toTex(track) {
            var exporter = new AlphaTab.Exporter.AlphaTexExporter();
            exporter.Export(track);
            return exporter.ToTex(); 
        }

Exported AlphaTex

Open a file to see the generated alphaTex here.