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โHiddenwhen standard notation is visible,ShowWithBarswhen 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.
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โ
- Standard notation โ pair the tab staff with a score staff.
- Slash notation โ swap fret numbers for chord-rhythm slashes.
- Drum tablature โ the same tab staff for percussion tracks.
notation.rhythmMode,notation.rhythmHeight, andnotation.smallGraceTabNotesin the settings reference.Staff.showTablaturein the model reference.