New Tool (3.1) xRules

I can insert MidiNotesToCC as FX plugin on the track or inside the plugin, not as a instrument

I think it’s supposed to be an instrument. At least, this is how it shows up on my system.

I downloaded the “complete” pizmidi_x64.zip bundle, using x64 builds for Windows, both plugin + Renoise - no sandboxing.

Ive unpacked the whole bundle and rescaned plugins.
Still didnt see Notes2cc in synth plugins just in fx plugins. When i selected it Renoise told me (didnt before) something like: “this plugin seems to be synth, restart renoise”
dont know what is going on but after restarting renoise its here and its working.
Thanks again

I am an absolute beginner to xRules and lua.
I want to convert incoming MIDI-CC #20 to NRPN to control the cutoff of my Prophet VS.
The attached script is recognizing incoming MIDI-CC #20 and sending a proper NRPN string. But unfortunately I can’t figure out how to pass resp. map the incoming MIDI-CC #20 value_2 to the NRPN MIDI-CC #6 value_2.
Can anybody help me?
Thanks a lot in advance.

I want to convert incoming MIDI-CC #20 to NRPN to control the cutoff of my Prophet VS.

I can see you’re splitting the CC message into multiple messages, to create an NRPN message.

I took a quick look, because the built-in NRPN message should be way more comfortable to use.

But it seems that (and this is probably what threw you off), there is a need to define the following

bit_depth = 14

(this really shouldn’t be necessary but also won’t hurt. In this particular case, it seems to make the NRPN message work as intended).

So the way I’d suggest it would be like this (3 steps)

  1. Define a ‘call_function’ that configures xRules to output 14-bit NRPN messages
message_type = 'nrpn'
bit_depth = 14

Of course, you could use the ‘set_message_type’ via the graphical UI too - the snippet above is basically just killing two birds with one stone.

If you need to change, scale values somehow, this can be done as simply as adding the following statements to the code snippet above:

values[1] = 200 -- Number: set to fixed value
values[2] = values[2]*2 -- Data: increase by x2

Splitting into the MSB/LSB parts are done automatically on output. In other words, the message is turned into this kind of message:

-- ### build NRPN message
-- 0xBX,0x63,0xYY (X = Channel, Y = NRPN Number MSB)
-- 0xBX,0x62,0xYY (X = Channel, Y = NRPN Number LSB)
-- 0xBX,0x06,0xYY (X = Channel, Y = Data Entry MSB)
-- 0xBX,0x26,0xYY (X = Channel, Y = Data Entry LSB)

-- TODO optionally, when 'terminate_nrpn' is specified...
-- 0xBX,0x65,0x7F (X = Channel)
-- 0xBX,0x64,0x7F (X = Channel)
  1. Define which output port to use (‘set_port_name’).

  2. Define the output method (‘output_message’ → ‘external_midi’)

Also, check if NRPN is enabled and that the desired output port has been enabled in Preferences > MIDI

Thanks a lot for your helpful advice!
The script is working perfectly. :slight_smile:

I am not quite sure, but I think, that there’s a little issue left in my use case.

It arises as soon as I want to modulate two parameters in an interleaved manner.

The Prophet VS expects NRPN as:
Select Parameter LSB (98dec)
Select Parameter MSB (99dec)
Data Entry LSB (38dec)
Data Entry MSB (06dec)

Because the script is transmitting MSB first instead of LSB first, I think the intended modulation is going to be a little messed up.

Ist there a way to swap MSB and LSB in NRPN Messages?

Ist there a way to swap MSB and LSB in NRPN Messages?

Sure, I’ll make this a global option. Need to put out a new version anyway :slight_smile:

Done.

Install the new version, then go to xRules options > MIDI and expand the NRPN panel to set the MSB/LSB order.

Working as expected :slight_smile:

Hi,

Is it possible to configure a simple on/off switch with xRules (with feedback)? For example,

IF CC = 20 THEN my_toggle = NOT my_toggle

IF my_toggle = 0 THEN don’t light up ELSE light up

This is just for lighting up the launchpad - I’d CTRL+M CC #20 and map to say the on/off for a track effect, mute etc.

Cheers,

LW.

Sure, add this lua snippet before outputting/routing the message (select ‘call function’)

-- run once: initialize our variable
if (type(cc_toggle)=="nil") then
  cc_toggle = false
end

-- respond to press, ignore release
if (values[1] == 20) then
  if (values[2] == 127) then
    cc_toggle = not cc_toggle
  end
  values[2] = cc_toggle and 127 or 0
end

Brilliant - will try this later, thanks again :slight_smile:

Cheers,

LW.

A new release of xRulesis ready, v0.79

FIXED xLib: automation class could produce glitchy values [bug]
FIXED xRules: comparison (string, number) could break due to missing cLib reference in sandbox [bug]
FIXED popup dialog titles
CHANGED log window gone (uses the scripting console instead)
FEATURE click toolbar to view source and documentation

It also contains two new rulesets

One I made for Athaphian (convert aftertouch to midi-cc)

https://forum.renoise.com/t/aftertouch-cc-tracker/47241

And one for LamptonWorm (visual feedback on launchpad)

https://forum.renoise.com/t/duplex-launchpad-orig-top-row-behaviour/46781

Both are included with xRules (click Add > Locate file on disk > “examples” to find them)

Hey danoise thanks for this tool!

I did a ruleset to override some of renoise’s default actions, kind of. A thing that bothered me about macros is that whenever I map certain macro to a knob, it would control that macro even if that instrument is not selected (this is expected), but if you map that knob to a vst parameter using the vst’s mapping functionality (if any) it would only work when the instrument containing the vst is selected (also expected).

What I did with your tool is mapping the knobs of my controller to the selected instrument’s macros :smiley: this is a think I’ve been looking for a long time. Oh, and also mapping program changes to selected_instrument_index.

-----------------------------------------------------------
-- Ruleset definition for xRules
-- More info @ http://www.renoise.com/tools/xrules
-----------------------------------------------------------
return {
osc_enabled = false,
manage_voices = false,
description = "",
{
  ["osc_pattern"] = {
      ["pattern_in"] = "",
      ["pattern_out"] = "",
  },
  ["name"] = "Input",
  ["actions"] = {
      {
          ["route_message"] = "Current Ruleset:➜ Notes",
      },
      {
          ["route_message"] = "Current Ruleset:➜ CC",
      },
      {
          ["route_message"] = "Current Ruleset:➜ Macros",
      },
      {
          ["route_message"] = "Current Ruleset:➜ Instr. Selection",
      },
  },
  ["conditions"] = {},
  ["match_any"] = true,
  ["midi_enabled"] = true,
},
{
  ["osc_pattern"] = {
      ["pattern_in"] = "",
      ["pattern_out"] = "",
  },
  ["name"] = "➜ Notes",
  ["actions"] = {
      {
          ["output_message"] = "internal_raw",
      },
  },
  ["conditions"] = {
      {
          ["message_type"] = {
              ["equal_to"] = "note_on",
          },
      },
      {
          2,
      },
      {
          ["message_type"] = {
              ["equal_to"] = "note_off",
          },
      },
  },
  ["match_any"] = true,
  ["midi_enabled"] = false,
},
{
  ["osc_pattern"] = {
      ["pattern_in"] = "",
      ["pattern_out"] = "",
  },
  ["name"] = "➜ CC",
  ["actions"] = {
      {
          ["output_message"] = "internal_raw",
      },
  },
  ["conditions"] = {
      {
          ["message_type"] = {
              ["equal_to"] = "controller_change",
          },
      },
  },
  ["match_any"] = true,
  ["midi_enabled"] = false,
},
{
  ["osc_pattern"] = {
      ["pattern_in"] = "",
      ["pattern_out"] = "",
  },
  ["name"] = "➜ Macros",
  ["actions"] = {
      {
          ["call_function"] = "renoise.song().selected_instrument:macro(value_1 - 20).value = math.min(1.0, math.max(value_2/127, 0.0))",
      },
      {
          ["output_message"] = 1,
      },
  },
  ["conditions"] = {
      {
          ["message_type"] = {
              ["equal_to"] = "controller_change",
          },
      },
  },
  ["match_any"] = true,
  ["midi_enabled"] = false,
},
{
  ["osc_pattern"] = {
      ["pattern_in"] = "",
      ["pattern_out"] = "",
  },
  ["name"] = "➜ Instr. Selection",
  ["actions"] = {
      {
          ["call_function"] = "renoise.song().selected_instrument_index = values[1]+1",
      },
      {
          ["output_message"] = "internal_auto",
      },
  },
  ["conditions"] = {
      {
          ["message_type"] = {
              ["equal_to"] = "program_change",
          },
      },
  },
  ["match_any"] = true,
  ["midi_enabled"] = false,
}
}

(I don’t know how to fold code snipets, sorry for the long post)

I will be slowly adding stuff to this ruleset. In the meantime I would like to know if someone uses this tool to add similar functionality to renoise.

Chau!

I am trying to integrate paramter automatization of my Bass Station II in renoise.

Some parameters like Filter Cutoff is implemented as 14 bit MIDI CC. (CC #16 dec. is MSB, CC #48 dec. is LSB).

The BS II sends both CCs of a value pair at the same time (in respect to the MIDI input monitor time stamp), so that renoise doesn’t record both of them.

Unfortunately the LSB is stored, so it’s not useful.

I want to convert a MIDI CC pair somehow, so useful information could be stored.

As far as I understand xRules support 14bit MIDI. How would a rule be defined that reacts on

14bit MIDI CC input whereas

MIDI CC #16 is MSB

MIDI CC#48 is LSB

Is it possible to store the LSB a little bit later in the pattern editor than the MSB while recording live?

Is it possible to store the LSB a little bit later in the pattern editor than the MSB while recording live?

well, “delaying” a value would be tricky … what to do when at a pattern boundary, for instance?

Perhaps better and cleaner would be to use xRules to record your 14-bit parameter as graphical automation (envelope)?

There is sufficient resolution in the envelopes to represent the value as a single point.

The “Automapping” example demonstrates how to write automation from the selected parameter.

So, not 100% what you’re looking for but perhaps close enough?

Automapping my 14bit MIDI parameter would definitely be close enough.

I’ve loaded the “Automapping” example in a ruleset but I am not able to record any MIDI parameter to a device parameter in the “track automation editor pane”.

To keep it simple, I started with the Modwheel as MIDI input as already configured in the xRules example.

I’ve selected the “L Delay” parameter of an instance of the Renoise delay device, but can’t figure out how to record it to the track automation. The Modwheel is recorded in the Pattern Editor as usual.

I could only manage to map (using the Renoise MIDI Mapping functionality) the Modwheel to the “L Delay” parameter and see respective hear that it takes effect.

But again, no recording in the “track automation editor pane” happens.

can’t figure out how to record it to the track automation. The Modwheel is recorded in the Pattern Editor as usual.

Hmm, sounds like you’re still recording using “standard” Renoise mappings.

Have you selected the device in the xRules prefs and disabled the port in Renoise preferences?

Edit: you should see the MIDI input indicators lighting up when it works:

8290 xrules-activity-indicators.gif

Doing some tool maintenance today as xRules has a couple of longstanding bugs I wanted to fix.

Any new rulesets that should be considered for inclusion?

New version of xRules, 0.8. Get it from the tool page

This release closes a number of bugs:

(fixed) tool in subfolder (not default folder) causes error on ruleset creation (#69)
(fixed) instrument index set via UI does not work bug (#81)
(fixed) need 'bit_depth' to be set before NRPN messages work (#82)

The second bug (#81) was simply a typo, and affected not only instrument_index but also track_index.

So now you should finally be able to control the target instrument + track from the xRules UI.

1 Like