Playback speed
Learners work up to tempo. A slow-down button that pulls a tricky solo down to 0.5ร while the fingering settles in โ then back up to 1.25ร for a stretch, then 1.0ร for the take โ is table stakes for a practice tool. playbackSpeed is the single property behind that button. It scales the tempo without repitching the audio, so the note pitches stay put while the timing stretches.
The propertyโ
playbackSpeed is a multiplier applied to the score's tempo. 1.0 plays at the notated tempo. 0.5 runs at half speed, 2.0 at double. The playground exposes the full supported range of 0.1 through 3.0.
The setter takes effect immediately โ even mid-playback โ so binding it to a slider produces a smooth speed change without interrupting the audio. The pitch stays fixed; only the timing scales. Both the transport clock and the on-screen cursor follow the modified tempo.
Setting playbackSpeed while the player is paused stores the value; it applies as soon as play() runs.
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 },
});
const slider = document.getElementById('speed');
slider.addEventListener('input', () => {
api.playbackSpeed = Number(slider.value);
});
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โ
- Play, pause, stop โ the transport methods this property modulates.
- Looping a section โ pair a slow speed with a tight loop for focused practice.
playbackSpeedreference entry.