Hello Don,
The documentation is actually correct:
28-bit signed integer variable status sys-ex message format:
- Byte 1: 0xf0 - system exclusive start.
- Byte 2: 0x7d - fixed manufacturer ID.
- Byte 3: 0x1a - message type code for Hauptwerk 28-bit signed integer variable status message.
- Byte 4: variable ID (see list below).
- Byte 5: variable value byte 1 (most significant 7 bits).
- Byte 6: variable value byte 2.
- Byte 7: variable value byte 3.
- Byte 8: variable value byte 4 (least significant 7 bits).
- Byte 9: 0xf7 - end of system exclusive message.
As you realised, only 7 bits of any given MIDI byte can be used for data, hence four MIDI bytes can hold a maximum of 7x4 = 28 bits in total.
The maximum value range of a 28-bit signed integer is -134217727 to 134217727. To determine the bytes that would be sent for any given value within that range you simply need to take the least 7 significant bits of your value and put them in byte 8, then take the next least significant 7 bits and put them in byte 7, etc., i.e.:
Byte 4 = ( [28-bit integer value] >> 21 ) & 0x7f
Byte 5 = ( [28-bit integer value] >> 14 ) & 0x7f
Byte 6 = ( [28-bit integer value] >> 7 ) & 0x7f
Byte 7 = ( [28-bit integer value] >> 0 ) & 0x7f
Do the inverse if you want to convert it to the other way, i.e. multiply by 0x7f and shift left 7 bits more for each consecutive MIDI byte (starting with the least significant), summing the result.
Best regards, Martin.
Hauptwerk software designer/developer, Milan Digital Audio.