But getBpm in the d.ts doesn't show this optional parameter, so when you use the getBpm method in typescript the parameter ends up being undefined. This means the result ends up as the default value of 180, as per abc_tune.
This is the starting beats per minute. Tempo changes could appear later in the tune, but this is the value that was set with the Q: statement, or if that statement doesn't exist, it is the default tempo of 180.
which implies that we don't need to supply the tempo metaText to this function, when it looks like we do?
This all assumes I'm not incorrectly using renderAbc and getBpm from the elements of the renderAbc result.
environment:
When doing a test as follow:
abc (click to expand):
``` %abc-2.1 X: 0 T: grand staff bpm test Q: 1/4=80 M: 3/4 L: 1/8 V:R clef=treble V:L clef=bass K: C [V:R] [K: octave=-1] \ z2 z e cB | A2 [Acea] e cB | \ A2 [Acea] z z2 | [V:L] \ z2 z E CB, | [K: octave=-2] A2 [Ge] [K: octave=-1] E CB, | \ [K: octave=-2] A2 [^Fe] z z2 | ```
Expected result:
bpm === 80
Actual result:bpm === 180
From what I can work out...
getBpm
has an optionaltempo
parameter, and all calls to it should supplytempo
fromconst tempo = tune.metaText ? tune.metaText.tempo : null;
if they want to get the actual tempo for the tune (e.g. abc_timing_callbacks).getBpm
in the d.ts doesn't show this optional parameter, so when you use thegetBpm
method in typescript the parameter ends up beingundefined
. This means the result ends up as the default value of 180, as per abc_tune.This ties in to the documentation which says
which implies that we don't need to supply the tempo metaText to this function, when it looks like we do?
This all assumes I'm not incorrectly using renderAbc and getBpm from the elements of the renderAbc result.