Can't get NRPN listener to work

Hi there. I've been using webmidiJS for a while (and love it :) and have been sending NRPNs with no problems using the setNonRegisteredParameter method.

Just today I've been trying to use the NRPN listener to parse CC commands into NRPN events, but I can't seem to get the listener to fire. I am getting the CC events coming through...

Received 'controlchange' message: 99, 0

Received 'controlchange' message: 98, 10

Received 'controlchange' message: 6, 106

I'm using "webmidi": "^2.5.1"

Here's the code setting up the listener, it's just straight from one of the examples.

WebMidi.nrpnEventsEnabled = true;

var input = WebMidi.getInputById(this.state.selectedMidiInId);

input.addListener('controlchange', "all", (e) => {
    console.log("Received 'controlchange' message:");
    console.log(e.controller.number);
    console.log(e.value);

});

input.addListener('nrpn', "all",
    function (e) {

    if(e.controller.type === 'entry') {
        console.log("Received 'nrpn' 'entry' message.", e);
    }
    if(e.controller.type === 'decrement') {
        console.log("Received 'nrpn' 'decrement' message.", e);
    }
    if(e.controller.type === 'increment') {
        console.log("Received 'nrpn' 'increment' message.", e);
    }
    console.log("message value: " + e.controller.value + ".", e);
    }
);

I've tried it in a few different configurations, just on an individual channel (1), without the control change listener, and everything I can think of. I also considered maybe my synth isn't sending a typical NRPN set of bytes, and tried just doing a physical loop back with my midi interface with a cable, and receiving the input of the setNonRegisteredParameter output, but not having any luck. According to Midi Monitor the interface is at least receiving the MSB, LSB and data value.

Any ideas what I'm doing wrong?

Comments

  • Yeah... about NRPNs... It's one of the few areas of WebMidi.js that I have not worked on myself. As you can see in PR #88, it was graciously contributed by someone else and I never really checked it. I'm pretty confident it was working when it was implemented but the test suite never had tests to check inbound NRPN processing.

    When I started working on the the alpha for v3, I totally reorganized the test suite to include proper tests for inbound NRPNs. It is then that I realized something wasn't right. So, there might be something wrong with how NRPNs are handled in v2 and it might have been there for a long time. It seems to be something only a handful of people are using.

    The problem is that I don't have much time to work on this right now. If you have the skills to look at it and perhaps submit a PR, that would be awesome. If not, I'm afraid you will have to wait for the official release of v3. Sorry...