Skip to main content

Master and monitoring volumes

Three separate audio channels feed the output: the score itself, a metronome click during playback, and a one-bar count-in before it. Every practice-tool UI has different treatment for the three โ€” mute the metronome for a performance take, boost the count-in for a beginner, duck the master when a voice-over speaks. masterVolume, metronomeVolume, and countInVolume are the three properties behind those controls; each takes a value from 0 (silent) to 1 (unity gain).

00:00 / 00:00

The three knobsโ€‹

  • masterVolume โ€” the output gain applied to the whole mix after per-track fader stages. Use it for a global fade-in, a duck when a voice-over speaks, or the user's application-level volume slider.
  • metronomeVolume โ€” the level of the click track that plays during song playback. 0 mutes the metronome entirely (which is the default); anything higher makes it audible. Pair with the count-in and metronome settings that enable the click in the first place.
  • countInVolume โ€” the level of the click track that plays before the song starts. Independent from metronomeVolume, so you can run a loud count-in and a silent (or subtle) metronome once the music kicks in.

All three are live properties. Assigning during playback takes effect on the next audio buffer.

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.masterVolume = 0.8;
api.metronomeVolume = 0.3;
api.countInVolume = 1.0;

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โ€‹