Why does NRPN also send RPN?

Hey all. Loving the webmidijs library. I'm using it to create a webapp that adjusts parameters for a custom MIDI controller. In my testing it appears that when I use the setNonRegisteredParameter method, it sends 6 MIDI messages instead of 4 as I would expect. I expect an NRPN message to send controller 99, controller 98, controller 6, and controller 38. The method as I'm using it currently also sends controller 101 and 100 (MSB and LSB of RPN). There could be something I am not understanding. Why does it send these RPN messages?


My JS code:

output.setNonRegisteredParameter([0, 1], [0, 2], [channel = 1], [options = {}]);


Sends these messages:

Message 1 (NRPN):

byte1 DEC: 176 (0xB0)

byte2 DEC: 99 (0x63)

byte3 DEC: 0 (0x00)


Message 2 (NRPN):

byte1 DEC: 176 (0xB0)

byte2 DEC: 98 (0x62)

byte3 DEC: 1 (0x01)


Message 3 (NRPN):

byte1 DEC: 176 (0xB0)

byte2 DEC: 6 (0x06)

byte3 DEC: 0 (0x00)


Message 4 (NRPN):

byte1 DEC: 176 (0xB0)

byte2 DEC: 38 (0x26)

byte3 DEC: 2 (0x02)


Message 5 (RPN):

byte1 DEC: 176 (0xB0)

byte2 DEC: 101 (0x65)

byte3 DEC: 127 (0x7F)


Message 6 (RPN):

byte1 DEC: 176 (0xB0)

byte2 DEC: 100 (0x64)

byte3 DEC: 127 (0x7F)

Comments

  • As you can read on this page: "It is now widely regarded as best practice to Null (RPN 127, 127) the active parameter number immediately after sending the Data Controller(s)".

    This is why it is sending 6 messages instead of 4.

    Cheers!

  • Very interesting. I was getting my info from the MIDI spec and wasn't aware of this best practice. Thanks a lot Jean-Philippe! Your library is making a lot of things possible for me. I really appreciate your work on this.

  • Thank you for your nice words! If you ever find the time, I would love to hear your feedback regarding the new version (3) which is currently in alpha in the develop branch.

    Cheers!