Relative Knobs In Duplex (Using Nrpn)

Hey all,

i’m currently in the process of fiddling around with Duplex to get the relative knobs on my MPD32 working through NRPN. As this seems not quite that easy to do and would most probably result more in a hack than a solution, i’d like to ask beforehand if i’m wasting my time here, because it’s already being developed or something.

If not, it would surely be encouraging if somebody could confirm that this is not impossible to do.

Thanks! :)

EDIT: See first draft below.

It’s actively being planned No, seriously:

Relative MIDI controller message support for endless rotary encoders  
Has ability to control UISlider  
Specify as "mode" attribute:  
1. abs_7 (the default)  
2. rel_7_signed1 - increase at [065 - 127], decrease at [001 - 063]  
3. rel_7_signed2 - increase at [001 - 063], decrease at [065 - 127]  
4. rel_7_offset - increase at [065 - 127], decrease at [063 - 000]  
5. rel_7_twos_comp - increase at [001 - 64], decrease at [127 - 065]  
  

And those are just a starting point…there are even more types of relative msgs
But to begin with, your MPD32 could be covered by one of these, or it needs to send NRPN ?

Yeah, it needs to be NRPN actually.

The MPD32 does not retransmit when it’s already reached the min or max value, so the relative workarounds, as they are available through renoise’s midi-mapping, don’t really work here.

At least with the MPD32, i need to switch to NRPN to be able to use the knob in an “endless” mode.

Update:

Got it working basically. I can now adjust my DSP parameters without jumps using a non-bidirectional controller (MPD32) in NRPN INC/DEC mode.

But the performance isn’t really nice. Got to twist the knob for a few secs to get from one extreme to the other. Also, there is noticeable delay in processing the MIDI input. I’ve noticed that on the CC-mode controllers as well, but there it’s by far not as noticeable as with the NRPN stuff. Might have something to do with appx. 5 x the MIDI load probably?

If anybody has hints, i’d be grateful.

Thanks, and good night! :)

That’s great, I would really like to see those modifications!!

Hmmm…when movement through the range of a slider is too slow, can’t you adjust the size of those relative messages in the MPD32 editor? It shouldn’t be a problem on the receiving end, unless you’re really putting out a lot of messages.
When going through Duplex, a message should arrive in it’s destination (it’s application) immediately, it’s obviously a “high priority”. But I know that satobox has also been having some difficulties with his nanoKONTROL2 - it was simply generating too many MIDI messages, to the point where the (non-KORG) driver cause software freeze (in both Renoise, Ableton and other places). He replaced the driver, which resolved the buffer overflow problem, but the unit is still producing 4-5 times as many MIDI messages than most devices do.

So, there is definitely such a thing as a MIDI bottleneck, and fortunately, this is something we can do something about. For example, selectively deciding which messages should be echoed back to the device, and throttling the input (skip messages when too many are arriving within a certain period of time), etc.

Essentially i’ve modified the MidiDevice:midi_callback method to buffer and suppress NRPN messages, and generate a pseudo-CC message when a complete NRPN message was received. The code itself isn’t quite done yet, as i’m still trying to tweak some stuff, see below.

Unfortunately not. It always just sends “increase” and “decrease”, not the amount of it.

Well, yesterday i found it’s not actually a performance issue on the PC, it’s just the MPD32 seeming unable to send more than 30-40 messages per second. :huh: No matter if its in CC or NRPN mode. In CC mode it just isn’t that obvious, as in that case it just skips intermediate values and “jumps”. But in NRPN inc/dec mode, this results in 4 seconds knob-twisting to get from max to min and vice versa.

I’m currently experimenting with ways to dynamically interpolate knob twisting speed, but the possibilities are limited. I might end up just defining a configurable but constant jump value.

Or, i could just trash the freaking MPD32 and get a ZeroSL. :yeah:

OK, here we go.

* What does it do?
[indent]It makes Duplex understand NRPN messages.
[/indent]* How does it do that?
[indent]NRPN messages are being “translated” to CC messages, which are then processed normally.
[/indent]* Prerequisites:
[indent]Duplex 0.97
[/indent]* Installation:
[indent]Copy MidiDevice.lua to Duplex Directory. Overwrite the existing copy.
[/indent]* Configuration:
[indent]Configuration is done on the MIDI Controller itself. No specific configuration is necessary in Duplex or Renoise.
[/indent][indent]To setup a knob for NRPN INC/DEC mode, configure the parameter settings as follows:
[/indent][indent]- Parameter MSB: This should match the CC code the knob uses in CC mode. (For the Akai MPD32 knob K1, this is 3 e.g.)
[/indent][indent]- Parameter LSB: Set this to the “jump” value that is applied when the knob is turned quickly. In my tests with the Akai MPD32, a value between 3 and 5 seemed reasonable. (Use 1 if in doubt )
[/indent]
I could only test this with my Akai MPD32, and it’s working quite nicely there. It’s by far not flawless, especially the “acceleration” part when the knob is turned quickly, so broader testing is necessary for sure before this goes anywhere.

EDIT:

A quick test with Duplex 0.98a2 + Renoise 2.8b2 was successful, too.

Hi,

Maybe I’m doing totaly stupid thing though :rolleyes: ,
Can’t this new MidiDevice.lua file be used for APC20’s CUE LEVEL knob?

I’ve tested this file with changing the “Cue Level” part in APC20.xml file, like;

  
<group name="Cue Level"><br>
  <param value="CC#47|Ch1" type="dial" name="dial 1" msb="47" lsb="3" maximum="127" minimum="0">
<br>
</group>  
  

But I cannot get success (no response at all).

This is the midi signal of CUE LEVEL knob (turn right, then turn left).

Click to view contents

MidiDevice: Akai APC20 received MIDI B0 2F 1
MidiDevice: Akai APC20 received MIDI B0 2F 2
MidiDevice: Akai APC20 received MIDI B0 2F 2
MidiDevice: Akai APC20 received MIDI B0 2F 1
MidiDevice: Akai APC20 received MIDI B0 2F 2
MidiDevice: Akai APC20 received MIDI B0 2F 1
MidiDevice: Akai APC20 received MIDI B0 2F 2
MidiDevice: Akai APC20 received MIDI B0 2F 4
MidiDevice: Akai APC20 received MIDI B0 2F 2
MidiDevice: Akai APC20 received MIDI B0 2F 1
MidiDevice: Akai APC20 received MIDI B0 2F 1
MidiDevice: Akai APC20 received MIDI B0 2F 2
MidiDevice: Akai APC20 received MIDI B0 2F 1
MidiDevice: Akai APC20 received MIDI B0 2F 1
MidiDevice: Akai APC20 received MIDI B0 2F 1
MidiDevice: Akai APC20 received MIDI B0 2F 1
MidiDevice: Akai APC20 received MIDI B0 2F 1
MidiDevice: Akai APC20 received MIDI B0 2F 1
MidiDevice: Akai APC20 received MIDI B0 2F 2
MidiDevice: Akai APC20 received MIDI B0 2F 7F
MidiDevice: Akai APC20 received MIDI B0 2F 7F
MidiDevice: Akai APC20 received MIDI B0 2F 7D
MidiDevice: Akai APC20 received MIDI B0 2F 7F
MidiDevice: Akai APC20 received MIDI B0 2F 7F
MidiDevice: Akai APC20 received MIDI B0 2F 7E
MidiDevice: Akai APC20 received MIDI B0 2F 7F
MidiDevice: Akai APC20 received MIDI B0 2F 7D
MidiDevice: Akai APC20 received MIDI B0 2F 7E
MidiDevice: Akai APC20 received MIDI B0 2F 7F
MidiDevice: Akai APC20 received MIDI B0 2F 7F
MidiDevice: Akai APC20 received MIDI B0 2F 7D
MidiDevice: Akai APC20 received MIDI B0 2F 7E
MidiDevice: Akai APC20 received MIDI B0 2F 7F
MidiDevice: Akai APC20 received MIDI B0 2F 7E
MidiDevice: Akai APC20 received MIDI B0 2F 7E
MidiDevice: Akai APC20 received MIDI B0 2F 7F
MidiDevice: Akai APC20 received MIDI B0 2F 7E
MidiDevice: Akai APC20 received MIDI B0 2F 7F
MidiDevice: Akai APC20 received MIDI B0 2F 7F
MidiDevice: Akai APC20 received MIDI B0 2F 7F

Do I misunderstand at all??

I’ve only added support for NRPN messages, sorry. What you are posting are relative CC messages, which should already “work” currently. (Actually, they should currently jump from one extreme to the other in Duplex, as far as i can interpret your message dump)

Does the knob work with Renoise’s MIDI mapping, and Duplex disabled? It should imho, if you set the map mode like so:

Btw., for my modifications to work, you don’t need to edit Duplex configuration files. Just copy the MidiDevice.lua over, and then configure the controller itself to use NRPN INC/DEC mode, the MSB and the LSB values respectively. This might not be feasible for everybody, but as i am modifying someone else’s tool here, i didn’t want to modify too much, for it might be easier to maintain.

Ahh, I see. Thanks for making things clear.

Yes, I can use this knob by setting “Relative two’s comp” in Renoise’s native midi mapping.
Simply I was curious whether I could use it in Duplex too.
Sorry for my confusion. :)

Thanks a bunch!! This looks really interesting. Going to take a closer look…

Thanks John. I’ve had the time to look closer, and as far as I could gather, you’re “intercepting” certain CC messages (#6, #96-#99), which basically could be implemented as a switch somewhere (either per-parameter, or globally).
But what really got me worried is, that you are probing the selected device in the selected track. That’s a dangerous strategy, as most applications in Duplex will allow you choose whether to follow the focus or not, so you can’t really ever rely on what’s presently selected in Renoise.
To be fair, you said that you weren’t about to make too many modifications, and tying into the application logic + extending the control-map format to include new attributes like “msb” and “lsb” would require changes in a lot more places - thanks for keeping it simple :slight_smile:

So I guess I’m just trying to understand how you are using this modification in the first place: as a direct way to change parameters of the most recently selected DSP device, using the Effect application?

For now, I think I’ll include your modifications to the MidiDevice, but have them turned off per default. Then, I’ll look for a way to implement “standard” relative messages and return to this NRPN business, once I understand how it’s all coming together. Deal?

this means , now i can create my midi controller to my hardwares?
i want to use renoise to controll the hardware and vice versa , not a controller i want to use Grooveboxes and synts

@hotelsinus: Duplex isn’t aimed at controlling external hardware. You could hack it, obviously, but no need to reinvent the wheel: for something which control hardware, CTRL is probably the most flexible thing around. Check if your hardware is already supported in their device database?

That’s right. Essentially all that i’ve done here is more or less a hack, intended as some kind of PoC. Probing the Renoise API directly was done because i could do it quickly, though knowing there must be a more suitable solution, like using some of the UI controls as a source.

Essentially, before i started doing this, i just wanted to have a solution to (1) have my knobs dynamically assigned to the DSP i have selected with my mouse, and (2) to NOT have the sliders jump around everytime i select another DSP due to an unsynchronized absolute value caused by my device not supporting bidirectional operation. (1) was already working with Duplex+MPD32, (2) wasn’t. So i started digging into Lua, the Renoise API, and Duplex. ;)

Bottom Line: Yes, i was actually targeting the Effect Application, and that was essentially all that i have tested against. Select DSP device > move knob > watch slider. :)

Yeah, sure, that’s perfectly fine for me. Feel free to use what is useful, and trash/rewrite what is imperfect. :D

i knwo that…
i build a vst to change banks and presets, but renoise didnt support this way via vst and midi out… dont know why, all other host can do this…
i test my vst lots of other host and works fine… only renoise fail…
this is why i hope DUplex can do this sometime… :(

Ouch. So, you actually did something with CTRL, but Renoise doesn’t support the features of the CTRL plugin?

If that’s true, that’s a shame - and a bit strange, because the plugin would need to open an external MIDI port for communication (so, not internally-routed MIDI, which Renoise doesn’t have). And I have done several plugins for my own use, using the good old Synthedit. I could send and receive MIDI from the plugin to external gear, no problems. Sounds like CTRL could be improved in this aspect?

no i use synthedit for external hardware, but renoise not send midiout for external hardwares with vst surface…

Please excuse my necromancy on this thread, but I do not understand how to access the NRPN messages. Do I have to add fake buttons in my Controlmaps/MPD32.xml to process the bundle of messages that make up the NRPN message? I had a look at the logs and they are dropped otherwise, because params is empty.

As far as I understand, the MPD32 sends two messages, MSB and LSB, which are to defined on the controller via EDIT mode, on midichannels 99 and 98 and an “Inc” flag on channel 96 or an “Dec” flag on channel 97.