Set playback speed in BPM #2490
Replies: 3 comments 1 reply
-
|
If someone doesn’t beat me to it. I have accomplished this already and
can put together some snippets for you, that you should be to plug in.
I have tested now on 8 different go files and all have automatically
generated BPM matches.
…On Fri, Jan 9, 2026 at 7:08 PM Brandon Nielsen ***@***.***> wrote:
I find it confusing to set the playback speed via 1, .2, .8, 1.2, etc. I
want to set it directly. Have it default to the BPM of the tab but let the
user set it exactly where they want it. No more doing mental math of "How
many BPM is 70% of 125BPM?", etc.
—
Reply to this email directly, view it on GitHub
<#2490>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BNLESQCERYL55EOWVRDCLHL4GBULPAVCNFSM6AAAAACRH4QLGOVHI2DSMVQWIX3LMV43ERDJONRXK43TNFXW4OZZGMZDOOBSGQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
|
@brandonfake69 You have to consider that the music notation is written in a specific BPM and might have tempo changes. Setting a fixed BPM would need to override these tempo changes. Either we would need to ignore the tempo changes (causing confusion regarding the displayed notation) or we're back at a "percentual playback speed". Keep in mind that this is just the underlying way of control alphaTab. you can always display a BPM selector in the GUI for your users initializing it with the initial BPM ( The "relative playback speed" is something you often see in the speed trainer functionalities. You will see the same behavior of percentual speeds in most applications with some convenience UI based on the initial BPM. Guitar Pro
MuseScore
SoundSlice
Songsterr
Flat.io
|
Beta Was this translation helpful? Give feedback.
-
|
Hi Brandon see if this helps you:
I saw your request for direct BPM settings. I've been working on a React
component for alphaTab that calculates the BPM in real-time so you don't
have to do the math. It shows the *Live BPM* based on the current playback
speed ratio. Feel free to use this logic for your UI!
I attached my exact file as a PDF, but you can change to your preferences,
etc.
-
The Formula: I've implemented the exact logic you need:
$$CurrentBPM = SongTempo \times PlaybackSpeed$$
-
*Visual Confirmation:* In the songInfo block, you clearly display the
result of that math:
-
*Large Display:* {currentBPM} BPM (The "Live" speed)
-
*Sub-label:* Original: {songInfo.tempo} BPM (The "Reference" speed)
-
*The "Live" Feel:* Because you used Math.round, as you move the slider, the
BPM values will tick up and down like a digital metronome. You don't have
to guess what "70%" is; just slides until you see "88 BPM."
The one attached is straight out of my app, but if you are looking for a 1
bpm adjustment at a time instead of how I have it:
The trick is to convert the *Playback Speed Ratio* into a *BPM integer*,
add or subtract 1, and then convert it back into a ratio that alphaTab
understands.
The "1 BPM" Math
Since alphaTab’s playbackSpeed is a multiplier ($1.0 = 100\%$), the formula
to shift by exactly 1 BPM is:
$$Speed_{new} = \frac{(Tempo_{original} \times Speed_{current}) \pm
1}{Tempo_{original}}$$
Implementation for SpeedControl.tsx
Add this useEffect inside your SpeedControl component. This will listen for
the *'a'* and *'d'* keys to nudge the tempo.
TypeScript
useEffect(() => {
const handleKeyDown = (e: KeyboardEvent) => {
// Only trigger if no input/textarea is focused
if (['INPUT', 'TEXTAREA'].includes(document.activeElement?.tagName
|| '')) return;
if (!songInfo || !api) return;
const originalBPM = songInfo.tempo;
const currentBPM = Math.round(originalBPM * playbackSpeed);
let targetBPM = currentBPM;
if (e.key.toLowerCase() === 'd') {
targetBPM = currentBPM + 1;
} else if (e.key.toLowerCase() === 'a') {
targetBPM = currentBPM - 1;
} else {
return; // Not our keys
}
// Convert BPM back to a decimal ratio
const newSpeed = targetBPM / originalBPM;
// Safety bounds (alphaTab usually supports 0.25 to 2.0)
if (newSpeed >= 0.25 && newSpeed <= 2.0) {
onSpeedChange(newSpeed);
}
};
window.addEventListener('keydown', handleKeyDown);
return () => window.removeEventListener('keydown', handleKeyDown);
}, [api, songInfo, playbackSpeed, onSpeedChange]);
-
Hope this helps solve your problems!
Brett
…On Sun, Jan 11, 2026 at 1:07 PM Brandon Nielsen ***@***.***> wrote:
Great suggestions! Just need to be able to select (or view) the initial
BPM - even if it's just a UI thing that just sets the playback speed...
—
Reply to this email directly, view it on GitHub
<#2490 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BNLESQBDGS5CLPNVNGPEN7T4GK3SZAVCNFSM6AAAAACRH4QLGOVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTKNBXGA2DONI>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.





Uh oh!
There was an error while loading. Please reload this page.
-
I find it confusing to set the playback speed via 1, .2, .8, 1.2, etc. I want to set it directly. Have it default to the BPM of the tab but let the user set it exactly where they want it. No more doing mental math of "How many BPM is 70% of 125BPM?", etc.
Beta Was this translation helpful? Give feedback.
All reactions