I’m a MIDI and NRPN noob, and trying to educate myself in this area. I’ve read heaps of threads and posts on the subject, some of which have been very helpful. This post by Torsten ToH2002 was awesome, as have been many posts by Burkhard , and clarified a lot. But I’m still struggling with page 13 (and associated pages 11 and12) of MIDI Parameter Documentation 8.6.
The example on page 13 references ““Reverb Mix” in module REV is at NRPN #6169”. I can see from page 23 of the MIDI document, the Effect Module REV is at Address Page 61, so I presume 61 becomes the MSB. And from a Decimal to Hex converter, 61 Dec = 3D Hex (written$3D?). And then on page 20, I can see that “Mix 3 (delay and reverb effects)” is 69, which equals Hex 45. So I can see where the first couple of numbers in the example are from.
But I can’t understand the next paragraph, starting with “So, why $40 and $00?”. I can see the conversion of 8192 into Hex 2000. $2000 when converted to binary becomes 10000000000000. The SHR 7 is (I think) a Shift Right by 7 bits (= 1000000) to get the MSB. Converting Binary 1000000 to Hex = $40. The remaining binary bits are 0000000. And unsurprisingly, Binary 0000000 = Hex $00. So I can see where those two numbers come from.
So why is the “AND $7F” function used?
Trying to remember back to my university days, which preceded the existence of desktop PC’s, phones, internet, you name it, the AND function compares the same bits from two numbers, and returns a 1 where the two bits are both 1, and returns a 0 otherwise.
Hex $7F = Dec 127 = Binary 1111111.
So if the MSB is 1000000, and you AND 1000000 with 1111111, the answer will be 1000000. Which per the above converts to Hex $40, so all good.
But why do you do that?
Similarly, if the LSB is 0000000, and you AND 0000000 with 1111111, the answer will be 0000000. Which per the above converts to Hex $00, again all good.
But again, why do you do the AND function/calculation?
And why use the number $7F, (or127), apart from the fact this gives you seven bits of one’s?
Or asking these questions the other way round, what happens (or what is the risk/issue) if I just used the numbers I got from the MIDI parameter lists, and didn’t do the “AND” calculation?
And lastly, assuming I can get on-board with all the maths and numbers above, I’m guessing that, if I was sending a SysEx command, I would be using the Hex numbers, and if I was using NRPN, the numbers would all be decimal?
Thanks for anyone who has read this far, and even more thanks for anyone who responds!!