Tracks and Staves
For some songs you might want to define that the song has multiple tracks or staves. Depending on your UI the user might then select which track to display and switch between them. Staves configurations are useful to adjust the display of the individual tracks. You can enable/disable certain notation to be shown and also add multiple staffs to a single track (e.g. for piano grand staff).
Tracks​
A new track can be started with the \track "Track Long Name" "Track Short Name"
metadata.
Both names are optional and the short name is the one displayed before the track starts.
The long name can be used e.g. in your custom UI.
If the short name is not specified, the first 10 characters of the long name are used as short name.
Be sure to finish the previous beat with a vertical bar |
to start a new bar of a new track.
\track "First Track" "frst"
1.1 2.1 3.1 4.1 |
\track // new track
\tuning A1 D2 A2 D3 G3 B3 E4 // tuning of new track (with 7 strings)
4.1 3.1 2.1 1.1 |
Staves​
A new staff can be started with the \staff
metadata.
In braces you can optionally define via the options score
(for standard notation) and tab
(for guitar tablature)
whether the corresponding notation should be shown.
By default both notation systems are shown.
\track "Piano with Grand Staff" "pno."
\staff{score} \tuning piano \instrument acousticgrandpiano
c4 d4 e4 f4 |
\staff{score} \tuning piano \clef F4
c2 c2 c2 c2 |
\track "Guitar"
\staff{tabs} \capo 5
1.2 3.2 0.1 1.1
Automatic Bars​
The staff with the largest number of bars defines how long the overall song is. There is no need to manually ensure that all staves have the correct number of bars. AlphaTab will create missing empty bars automatically.
\track "Piano with Grand Staff" "pno."
\staff{score} \tuning piano \instrument acousticgrandpiano
c4 d4 e4 f4 |
\staff{score} \tuning piano \clef F4
c2 c2 c2 c2 | c2 c2 c2 c2 | c2 c2 c2 c2 |
\track "Guitar"
\staff{tabs} \capo 5
1.2 3.2 0.1 1.1 | 1.2 3.2 0.1 1.1