Skip to main content

Guitar tablature

Tablature draws each string as a horizontal line and prints fret numbers on top. It's the notation most guitar and bass players read first โ€” reach for it whenever the audience is fretted-string players. Pair it with standard notation for scores that must serve both audiences, or render it alone for a tab-only chart.

Showing rhythm on a tab-only staffโ€‹

When you hide standard notation, the tab staff loses stems and beams. Turn them back on through notation.rhythmMode:

  • Hidden (default when both staves show) โ€” no rhythm indicators on the tab staff.
  • ShowWithBars โ€” each beat draws a stem with flags; grouped beats connect through a common bar under the staff.
  • ShowWithBeams โ€” same as above but individual notes use flags instead of a bar, matching the standard-notation convention.
  • Automatic โ€” Hidden when standard notation is visible, ShowWithBars when it isn't.

notation.rhythmHeight controls how far the stems drop below the tab staff (default 15), and notation.smallGraceTabNotes prints grace notes at a reduced size so they don't crowd the main fret numbers.

Because these are settings on the notation group, they apply to every staff in the render. Combine them with per-staff showTablature toggles when you need mixed layouts.

Transposed tablatureโ€‹

notation.transpositionPitches shifts a track by a number of semitones for display and playback. On the tab staff, a note keeps its string and fret position shifted by the transposition while that fret is playable. When the fret would drop below the open string or rise beyond the 24th fret, alphaTab moves the note to another string. It picks the string whose fret is closest to the previous notes and keeps chord notes on separate strings.

Notes connected by ties, slides, and hammer-ons or pull-offs move together, so they stay on one string. Bends, slides, and vibrato never land on an open string. Natural harmonics move to the node that sounds the transposed pitch. When no string has such a node, the harmonic counts as unplayable.

The example below is transposed down four semitones. The open strings and the low notes no longer fit on their strings:

A note that fits on no string of the tuning keeps its string and shows the out-of-range fret in display.resources.tabUnplayableFretColor. The low E above is such a note.

The new positions exist only on the rendered tab. The loaded score keeps its strings and frets, and changing transpositionPitches at runtime takes effect on the next render(). Frets count from the capo, so a capo lowers the highest usable fret. String number circles in the standard notation follow the moved strings, and left-hand finger numbers of moved notes are hidden. Chord diagrams are not transposed.

Show it in codeโ€‹

import * as alphaTab from '@coderline/alphatab';

const container = getAlphaTabContainer();
const api = new alphaTab.AlphaTabApi(container, {
core: { file: '/scores/song.gp' },
notation: {
rhythmMode: alphaTab.TabRhythmMode.ShowWithBars,
rhythmHeight: 20,
smallGraceTabNotes: true,
},
});

api.scoreLoaded.on((score) => {
for (const track of score.tracks) {
for (const staff of track.staves) {
staff.showStandardNotation = false;
staff.showTablature = true;
}
}
api.render();
});

getAlphaTabContainer() is a placeholder for the platform-specific step of obtaining the render target โ€” a <div> on Web, an AlphaTab control on .NET, or an AlphaTabView on Android. Every other line runs unchanged on all three runtimes.

Where to look nextโ€‹