Inbound NRPN?

Home Forums General Using Ctrlr Inbound NRPN?

Viewing 20 posts - 1 through 20 (of 20 total)
  • Author
    Posts
  • #201
    dnigrin
    Participant
      • Topics: 9
      • Replies: 57
      • Total: 66

      I’m using NRPN to send messages from my panel to my synth, and it is working well. I wanted to now get the other direction working, so that when I twiddle a knob on my synth, the knob on screen updates accordingly. My synth sends NRPN messages when its knobs are moved.

      When messing around with this last night, I couldn’t get the components on my panel to respond to the synths knobs. My components are set to Multi mode, with the 4 lines of NRPN code in the Multi Message List section, and the appropriate MIDI controller number is set in its properties. Interestingly, when I switched the component’s mode to CC, the knob started to respond to the incoming messages.

      So how do I keep the components set to Multi mode to send NRPN, but also be able to receive incoming NRPN messages?

      #1946
      atom
      Keymaster
        • Topics: 159
        • Replies: 2945
        • Total: 3104
        • ★★★★★

        well it should be Multi and NRPN, but i noticed yesterday that there are some issues with that code, and i started to do some fixes i just didn’t have the time to finish this. But i’m aware of the problem and will try to include the fix in the new build.

        #1945
        dnigrin
        Participant
          • Topics: 9
          • Replies: 57
          • Total: 66

          Beautiful, thank you again!!

          #1952
          dnigrin
          Participant
            • Topics: 9
            • Replies: 57
            • Total: 66

            Hi atom – have you had a chance to address this yet? I tried again with the most recent build, and it’s still not working here… Thanks again.

            #1950
            atom
            Keymaster
              • Topics: 159
              • Replies: 2945
              • Total: 3104
              • ★★★★★

              Well i’m using NRPNs when testing Ctrlr with the MOPHO and all seems to work fine. And yes you will get CC midi type working when receiving NRPNs since NRPN is a set of 4 CCs and Ctrlr is reacting to one of them. If you can give me an example panel or scenarion where it’s not working i’ll have a look, but i’ll need a corresponding MIDI input dump to see what sort of meesages are beeing received (there are at least 3 NRPN implementations that i know of, each beeing slightly different)

              #1951
              dnigrin
              Participant
                • Topics: 9
                • Replies: 57
                • Total: 66

                OK, will work on getting you a nice stripped down example with all the data. More soon – thanks!

                #1947
                dnigrin
                Participant
                  • Topics: 9
                  • Replies: 57
                  • Total: 66

                  OK, did some investigating. To set up, I just took a new blank panel, and set the appropriate in/out MIDI devices. Then I added a slider, set its MIDI message type to Multi, set the MIDI controller number to 0 (the appropriate one for the data element I’m testing with), then clicked the blue icon with the "+" on it and chose NRPN. When I lock that, I can turn the on-screen knob and see the value change on the device in question (a Mutable Instruments Shruthi, with MIDI mode set to "Ctrl" – trust me, that’s the right mode to be in). Here are the MIDI values I see sent out, via the MIDI monitor in Ctrlr:

                  [MidiOut][7:52:19:224.000]: [MIDI OUT][Shruthi] [b0 63 00]
                  [MidiOut][7:52:19:224.000]: [MIDI OUT][Shruthi] [b0 62 00]
                  [MidiOut][7:52:19:224.000]: [MIDI OUT][Shruthi] [b0 06 00]
                  [MidiOut][7:52:19:224.000]: [MIDI OUT][Shruthi] [b0 26 01]

                  Now however, if I twist a knob on the device itself, I don’t see the on-screen knob adjust, and this is what I see in the MIDI monitor:

                  [MidiIn][7:52:01:554.000]: [MIDI IN][Shruthi][b0 26 02]

                  So it seems that the Shruthi is only sending a partial NRPN message or something? Sort of like MIDI running status or something? Just guessing.

                  Thanks for any help!

                  #1944
                  atom
                  Keymaster
                    • Topics: 159
                    • Replies: 2945
                    • Total: 3104
                    • ★★★★★

                    well this might be yet another NRPN variation. The problem with this one is that the received messages can’t be distinguished from a normal CC, unless you look at previous messages and keep track of them. I can try and implement some way to follow a "stream" of messages, but it’s just wrong. Synth manufacturers don’t consider other synth feelings, i mean they assume that their synth is the only one on the MIDI chain (i assume yours is a USB device, based on the MIDI device name), and don’t care about making MIDI more usable.

                    #1949
                    dnigrin
                    Participant
                      • Topics: 9
                      • Replies: 57
                      • Total: 66

                      Thanks atom – I will investigate with Olivier, the man behind Mutable Instruments…. Oh, and the Shruthi is not a USB device, it’s a regular MIDI device…

                      #1948
                      dnigrin
                      Participant
                        • Topics: 9
                        • Replies: 57
                        • Total: 66

                        Olivier’s reply:

                        "From my experience with other synths, I have always been under the impression that once a parameter is selected, a stream of data entry or increment/decrement messages can be sent — ie, if you rotate the same pot, you don’t have to retransmit the parameter number part of the message at every value change. So the Shruthi tries to be parsimonious (and low-latency) in the MIDI data it sends, and only retransmits what has really changed.

                        My technical view on NRPNs – and the way it is implemented in my code – is that there are 4 registers per MIDI channel – parameter id MSB/LSB ; value MSB/LSB. Each incoming NRPN message writes the corresponding register. Furthermore, upon the reception of a data entry MSB/LSB message (depending on the data format used by the recipient), the parameter/value pair stored in the registers is committed to the patch memory of the synth. This view/implementation is consistent with retransmitting only the value when the same parameter is tweaked over and over again."

                        The thread is at Mutable Instrument’s forum, http://mutable-instruments.net/forum/co … sionID=730

                        Olivier asked if there was a formal MIDI spec that stipulated that all messages always had to be sent?

                        #1953
                        dnigrin
                        Participant
                          • Topics: 9
                          • Replies: 57
                          • Total: 66

                          Atom, here’s the "official" word from the folks at midi.org:

                          http://www.midi.org/cgi-bin/forum/forum … 39550/s-0/

                          With this in mind, is there a way that Ctrlr could be modified to accept these kinds of inbound NRPN messages, or is it a no-go? Thanks regardless…

                          #1954
                          dnigrin
                          Participant
                            • Topics: 9
                            • Replies: 57
                            • Total: 66

                            Atom, any thoughts as to whether you might address this in the future?

                            Thanks regardless…

                            #1955
                            atom
                            Keymaster
                              • Topics: 159
                              • Replies: 2945
                              • Total: 3104
                              • ★★★★★

                              i guess this is possible. i just think it’s not a good idea. but like i wrote many times, every manufacturer has it’s own idea on how to do NRPN, here we have another one.

                              #1956
                              dnigrin
                              Participant
                                • Topics: 9
                                • Replies: 57
                                • Total: 66

                                Understood. You have the misfortune I’m afraid of writing an app that makes it its business to interact with all those different approaches! Not fun… Anyway, hope you choose to do it, and find the time… Thanks again for all your efforts! Appreciate the nightly builds!!

                                #72520
                                dnigrin
                                Participant
                                  • Topics: 9
                                  • Replies: 57
                                  • Total: 66

                                  Resurrecting my own 6 year old post! I’m now working on a new synth, and to my dismay, I’m finding that it handles outbound NRPN’s in the exact same way I described as for the previous Mutable Instruments synth I was working on before. For this synth, if it is sending a “new” NPRN (e.g. I start twiddling a new knob on the synth), it initially sends the full 4 CC messages, like this:

                                  [Controller] Ch:[ 1] No:[ 99] Val:[ 2] RAW:[b0 63 02]
                                  [Controller] Ch:[ 1] No:[ 98] Val:[ 33] RAW:[b0 62 21]
                                  [Controller] Ch:[ 1] No:[ 6] Val:[ 0] RAW:[b0 06 00]
                                  [Controller] Ch:[ 1] No:[ 38] Val:[ 29] RAW:[b0 26 1d]

                                  But then if I continue to twist the same knob, I now get a stream of messages like this:

                                  [Controller] Ch:[ 1] No:[ 38] Val:[ 28] RAW:[b0 26 1c]
                                  [Controller] Ch:[ 1] No:[ 38] Val:[ 27] RAW:[b0 26 1b]
                                  [Controller] Ch:[ 1] No:[ 38] Val:[ 26] RAW:[b0 26 1a]
                                  [Controller] Ch:[ 1] No:[ 38] Val:[ 25] RAW:[b0 26 19]
                                  [Controller] Ch:[ 1] No:[ 38] Val:[ 24] RAW:[b0 26 18]
                                  [Controller] Ch:[ 1] No:[ 38] Val:[ 23] RAW:[b0 26 17]

                                  So it’s just sending one CC message for each change in value.

                                  Any suggestions on how to deal with this scenario, so that my panel modulators are reliably updated when I move parameters on the synth itself?

                                  Thanks for any tips!

                                  #72521
                                  dnigrin
                                  Participant
                                    • Topics: 9
                                    • Replies: 57
                                    • Total: 66

                                    Following up on my own post, it seems similar in spirit to what is discussed in this thread, albeit in the other direction – that thread talks about filtering outbound NRPN data to thin it, I need to do the opposite, create fully formed NRPN messages from inbound thinned (or running status as I like to call them) messages.

                                    Does it sound reasonable to write a Lua script that is “Called when a panel receives a MIDI message” (or perhaps “Called when a panel receives a multi MIDI message”?), keep track of the last inbound NRPN message, and if the new message matches the same element, then create a fully formed 4 CC message to pass on to Ctrlr to process normally.

                                    If that sounds reasonable, I don’t know how to do two things:

                                    * how do I pass the output of the Lua script to the normal inbound MIDI data handling of the panel?
                                    * how do I keep persistent data (the last inbound NRPN message info) between instances of this new method that will be called?

                                    Hopefully that’s clear!

                                    #72522
                                    Puppeteer
                                    Participant
                                      • Topics: 16
                                      • Replies: 185
                                      • Total: 201
                                      • ★★

                                      I did this in LUA on a PC3 for outgoing messages, but the messages there are far more complex. Due to the vast number of parameters the control messages are 8 MIDI CC’s long.

                                      I keep track of the last message and do a comparison. If certain elements change, then I send a whole new message, otherwise I send just the running status (ie the short version of the message). I need to do this due to bandwidth, and it’s in line with running messages in the MIDI spec.

                                      To read them in (and this isn’t required on the PC3) I’d either drop them into an array based on the MIDI message, or have a series of IF THEN statements to work out which control should change, and then set the value of the Ctrlr control based on the valaue part of the NRPN. You’d need to make an assumption that unless you receive a new destination parameter that all messages are to change the currently selected control.

                                      Pseudocode would go something like this (I’m not on a computer with Ctrlr or Lua at the moment so can’t do the actual coding)

                                      Assume you read the incoming MIDI and for MIDI CC messages you put Byte 2 into midiCcNum and Byte 3 into midiCcVal

                                      ie IF midiCcNum = 99 THEN
                                      parameterNumber1 = midiCcVal
                                      ELSEIF midiCcNum = 98 THEN
                                      parameterNumber2 = midiCcVal
                                      ELSEIF midiCcNum = 6 THEN
                                      parameterNumber3 = midiCcVal
                                      ELSIF midiCcNum = 38 THEN
                                      ctrlrParamVal = midiCcVal

                                      ctrlrParamName = some function of parameterNumber1, parameterNumber2, parameterNumber3

                                      The set ctrlrParamName.ctrlrParamVal

                                      By default all variables are global in LUA, so just assign the messages to a new variable and it will be accessible to new methods.

                                      • This reply was modified 6 years, 9 months ago by Puppeteer.

                                      The Puppeteer
                                      http://godlike.com.au

                                      #72525
                                      dnigrin
                                      Participant
                                        • Topics: 9
                                        • Replies: 57
                                        • Total: 66

                                        Thanks very much, super helpful! Especially knowing that variables are global in Lua, didn’t know that (my first time doing stuff in Lua).

                                        One more question – do I have to refer to the ctrlParamName to be able to set the modulator with the ctrlrParamVal, or is there a way to refer to it by the modulator number associated with it (which I can derive from parameterNumber1 and parameterNumber2 in your pseudocode). Reason being that there’s over 500 variables for the synth I’m coding for, and so I’d like to be able to refer to the modulator programmatically, rather than with >500 if…then statements. I think I saw a trick somewhere where one could use the Custom Modulator Index for this purpose maybe?

                                        #72526
                                        Puppeteer
                                        Participant
                                          • Topics: 16
                                          • Replies: 185
                                          • Total: 201
                                          • ★★

                                          I think you can, but you normally don’t. Do a search on the forum for this, because I think the modulator number is assigned by Ctrlr and may be unreliable. You can do something though like give a variable the Ctrlr name lookup.

                                          This is what Atom does in the example modules, so you just define all the modulators on panel startup, and then refer to them as a variable during programming. You could use the variable name as something related to the MIDI CC Numbers, which would be the easiest way to accomplish this.

                                          The Puppeteer
                                          http://godlike.com.au

                                          #72527
                                          dnigrin
                                          Participant
                                            • Topics: 9
                                            • Replies: 57
                                            • Total: 66

                                            Thanks for the tips, will check it all out!

                                          Viewing 20 posts - 1 through 20 (of 20 total)
                                          • The forum ‘Using Ctrlr’ is closed to new topics and replies.
                                          There is currently 0 users and 58 guests online
                                          No users are currently active
                                          Forum Statistics
                                          Threads: 2,495, Posts: 17,374, Members: 77,605
                                          Most users ever online was 12 on January 22, 2019 3:47 pm
                                          Ctrlr