Midi channel pitch must be a 14bit value from 0-16383.
Current implementation is 15bit value from 0-32639.
Current implementation just combines the two bytes to a 15bit value with a leading 0.
unchecked((short)(Data1 + Data2 * 256)) leads to a range from 0 to (127 + 127 * 256) = 32639. 01111111 01111111
Correct calculation for 14bit value:
unchecked((short)(Data1 + Data2 * 128)) leads to a range from 0 to (127 + 127 * 128) = 16383. 01111111 1111111
Also when calculated like that, endianess is already always correct.
Midi channel pitch must be a 14bit value from 0-16383. Current implementation is 15bit value from 0-32639.
Current implementation just combines the two bytes to a 15bit value with a leading 0.
unchecked((short)(Data1 + Data2 * 256))
leads to a range from 0 to (127 + 127 * 256) = 32639. 01111111 01111111Correct calculation for 14bit value:
unchecked((short)(Data1 + Data2 * 128))
leads to a range from 0 to (127 + 127 * 128) = 16383. 01111111 1111111Also when calculated like that, endianess is already always correct.