If volume level is represented as a float value between 0 and 1, how to create data bytes of the Universal SysEx Master Volume message?
This is Sysex message constructor, with given Sysex message status byte (0xF0) and data bytes:
new SysexMessage(0xF0, data, data.length)
According to MIDI specification, there are 2 status bytes and 6 data bytes in the Master Volume message (without status bytes), with the last two data bytes specifying volume level:
0xF0 SysEx (Status)
0x7F Universal Realtime
0x7F Disregards channel
0x04 Sub-ID -- Device Control
0x01 Sub-ID2 -- Master Volume
0xLL Bits 0 to 6 of a 14-bit volume
0xMM Bits 7 to 13 of a 14-bit volume
0xF7 End of SysEx (Status)
So, if I'm not wrong, data bytes should look like this:
data = new byte[] { 0x7F, 0x7F, 0x04, 0x01, LL, MM }
My question is how to get LL and MM bytes from a float volume level between 0 and 1?