Per-track mixing
A channel-strip mixer โ one row per track, each with a volume fader, a Solo and a Mute button, plus a transpose readout โ is a standard practice-tool feature. Mute the drums to hear the bass line alone. Solo the vocal against a click. Transpose the guitar track down a whole step to match a capo. Four methods on AlphaTabApi control that fader stage, each accepting an array of tracks so you can adjust one, several, or all of them in a single call.
The four methodsโ
changeTrackVolume(tracks, volume)โ scale the level of one or more tracks. The value is a multiplier applied on top of the score's own mix, not an absolute gain, so1.0leaves the track at its notated level and0silences it.changeTrackSolo(tracks, solo)โ whentrue, other non-solo tracks are muted so the selected tracks play alone. Multiple tracks can be solo at once โ they all sound; everything else falls silent.changeTrackMute(tracks, mute)โ silence the given tracks without touching their volume. Mute and solo are independent flags: a muted track stays silent even when another track is solo.changeTrackTranspositionPitch(tracks, semitones)โ shift the playback pitch of a track without moving what's rendered on the staff. Use it to accommodate a capo, a re-tuned guitar, or a singer's key.
Each call takes effect immediately, even during playback. Passing an empty array is a no-op.
When to reach for eachโ
changeTrackVolume is the everyday fader โ bind it to a slider in your mixer UI. changeTrackSolo and changeTrackMute are the buttons next to it. changeTrackTranspositionPitch is not a mixer knob per se; it's the transposition control that lets playback follow a physical instrument's tuning without re-rendering the score.
Show it in codeโ
import * as alphaTab from '@coderline/alphatab';
const container = getAlphaTabContainer();
const api = new alphaTab.AlphaTabApi(container, {
core: { file: '/scores/song.gp' },
player: { playerMode: alphaTab.PlayerMode.EnabledSynthesizer },
});
api.scoreLoaded.on((score) => {
api.changeTrackSolo([score.tracks[0]], true);
api.changeTrackMute([score.tracks[1]], true);
api.changeTrackVolume([score.tracks[2]], 0.5);
api.changeTrackTranspositionPitch([score.tracks[3]], -2);
});
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โ
- Master and monitoring volumes โ the master fader every track feeds into.
- Selecting and switching tracks โ control which tracks render on screen, independent of the mix.
changeTrackVolume,changeTrackSolo,changeTrackMute, andchangeTrackTranspositionPitchreference entries.