Lyrics
Lyrics render below the staff with each syllable positioned under the beat it belongs to. alphaTab reads lyric lines from the source file or accepts them programmatically through the API.
Aligning to beatsโ
Each lyric syllable sits under its target beat โ the way songbook vocal lines are typeset so a singer reads word and melody at the same glance. Hyphens between syllables indicate a continuation across beats, and underscores extend a syllable across held notes.
Multi-verse handlingโ
Multiple verses stack below the staff, one line per verse โ the way hymnals and folk songbooks fit two, three, or four sets of words under a single melodic line. alphaTab preserves the order the source file provides. Pass extra strings to alphaTex's \lyrics directive to add verses.
Rendering fontsโ
Lyrics use a dedicated font entry so a chart can restyle them without touching the rest of the score โ the typical case for a hymnal that pairs a serif melody with a large sans-serif lyric line. Point display.resources.wordsFont at any registered family to change size, weight, or face.
See Custom text fonts for the full list of font slots and Font family fallbacks for handling missing families.
Show it in codeโ
Lyrics render on by default. To hide them from a printout โ for instance, an instrumental lead sheet โ flip the EffectLyrics element off:
import * as alphaTab from '@coderline/alphatab';
const container = getAlphaTabContainer();
const api = new alphaTab.AlphaTabApi(container, {
core: { file: '/scores/song.gp' },
notation: {
elements: new Map([
[alphaTab.NotationElement.EffectLyrics, false],
]),
},
});
getAlphaTabContainer() is a placeholder for the platform-specific render target. Lyrics can also be attached at runtime through the Lyrics model on the model reference.
Where to look nextโ
- Toggling notation elements off โ hide any category globally.
- Custom text fonts โ configure the lyric font family and size.
- Font family fallbacks โ handle missing font families gracefully.
notation.elementsโ the settings entry point for the element map.Lyricsโ the model type for attaching lyrics programmatically.