The argument `dd` of `smfTimeSignature()` doesn't seem to be a power of 2
m4saka opened this issue · 2 comments
The document (https://jazz-soft.net/doc/JZZ/jzzmidi.html) says:
smfTimeSignature(nn, dd, cc, bb)
- time signature; returns FF58 04 nn dd cc bb
, where nn
is a time signature numerator, and dd
- time signature denominator expressed as a power of 2 (e.g. nn=6, dd=3
would mean 6/8
). Optional parameters: ...
However, the following code (nn=4, dd=4
) outputs 4/4
(this should be 4/16
if dd
is a power of 2):
console.log(JZZ.MIDI.smfTimeSignature(4, 4).toString()); // => ff58 -- Time Signature: 4/4 24 8
Also, the following code (nn=6, dd=3
) throws RangeError exception:
console.log(JZZ.MIDI.smfTimeSignature(6, 3).toString()); // => Uncaught RangeError: Wrong time signature: : 6
// at smfTimeSignature (JZZ.js:1933)
The version of JZZ: 1.2.5
Oh, there was confusion between the function documentation and the MIDI specs. I'll fix the page shortly.
I should probably fix the error message too...
Meanwhile, to see how the function should be called, please look at the test cases in test/common.js
The easiest way to call the function is to give it a text argument, e.g. JZZ.MIDI.smfTimeSignature('3/4')
Thanks for letting me know!
Updated both the documentation page and the error messages.
Thanks again for noticing!