New Tool (3.1) xRules

Is it possible to map a cc (knob) to notes using this tool? Id like to control the scenes in Glitch 2 with a knob rather than keys…could be fun…

Sure, here is how I would do it

cc_to_note.png?raw=1

First, check if message is actually a control change. You can make this more specific - which channel, MIDI port etc.
Next, convert message into a “note_on”, and apply second MIDI byte (CC value) to the first one (note pitch)
Finally, output message.

return {
  {
   actions = {
     {
       call_function = "message_type = \"note_on\"\nvalue1 = value2",
     },
     {
       output_message = 1,
     },
   },
   conditions = {
     {
       message_type = {
         equal_to = "controller_change",
       },
     },
   },
  }
}

Copy the text above and select xRules > Add > Paste from clipboard

now isn’t that neat :slight_smile: Thank you, I added a condition for channel and cc number (106 in my case) and bobs your uncle. I have also mapped cc106 to this motorized love egg I am sitting on.


– Ruleset definition for xRules
– Visit http://www.renoise.com/tools/xrules for more info

return {
osc_enabled = false,
manage_voices = false,
description = “”,{
actions = {
{
call_function = “message_type = "note_on"\nvalue1 = value2”,
},
{
output_message = 1,
},
},
conditions = {
{
message_type = {
equal_to = “controller_change”,
},
},
{
channel = {
equal_to = 1,
},
},
{
value1 = {
equal_to = 106,
},
},
},
}
}

I’m having an issue selecting the value of a condition. The drop down list appears, but then whatever is selected instantly reverts to the first possible selection. It used to not do this. I guess I’ll reinstall the tool and see if it works normally. Weird. Im on Win7 if that matters.

Is there any intention to implement transport controls/MMC or sysex?

How would one filter incoming notes via LUA? CCs get passed through, given x condition of course.

Hm, I don’t know if re-installing the tool helped you, but from my perspectivethere might still be some problem, somewhere.

So, I would be interested to hear if you experience this problem again…

Is there any intention to implement transport controls/MMC or sysex?

Absolutely, and I want to add a few extra conditions that should be especially useful with sysex

  • WHEN on_new_document
  • WHEN on_tool_initialize
  • WHEN on_song_initialize [+ song name]

So you could set up the tool in a particular way whenever the tool initializes, or if you load a particular song.

And of course, sysex would not support the full spectrum of conditions & actions. Only “equal to/not equal to”, and “set” would be available.

As for MMC, strictly speaking they are also a special kind of sysex message, and I consider implementing them in a way similar to Duplex.

Basically, check if MMC before forwarding to Renoise. If true, simulate the effect by taking control of the transport.

This needs to be done because “raw” MMC messages are not picked up when sending them via the internal MIDI.

How would one filter incoming notes via LUA? CCs get passed through, given x condition of course.

Just like any other property “when note-on and note is between C-4 and C-5” ?

I’m probably just overlooking something. But can’t get the rules to work when I’m making MIDI mappings.

I’m probably just overlooking something. But can’t get the rules to work when I’m making MIDI mappings.

Yeah, sorry for a scantily documented tool.
You need to perform these two steps before you can starting using xRules:

  1. Enable the OSC server (Renoise preferences > OSC). Without this, “internally routed” MIDI won’t reach the pattern.
    Also, you need to set the port number to the same value as the Renoise OSC port - usually 8000

  2. Disable the usual MIDI input device in the Renoise MIDIpreferences, the tool handles this completely on it’s own
    (if you at a later time stop using xRules, any mappings you’ve created should continue to work - so no worries)

I hope this solved the issue :slight_smile:

Thanks for replying. This works for the sliders on my controller. I can also get the note buttons to be able to play instruments. And the log shows the MIDI messages I want. But I can’t MIDI map any of the buttons to effects.

For my sliders I have the rule:

WHEN channel type is not equal to 10

AND message type is equal to controller change

THEN set channel to 01

output message

This does what I want: the slider stays fixed to the mapping while I skip through different banks on the controller. For the buttons I want some with specific values to behave the same. Any ideas what I’m doing wrong?

Hm, I don’t know if re-installing the tool helped you, but from my perspectivethere might still be some problem, somewhere.

So, I would be interested to hear if you experience this problem again…

Absolutely, and I want to add a few extra conditions that should be especially useful with sysex

  • WHEN on_new_document
  • WHEN on_tool_initialize
  • WHEN on_song_initialize [+ song name]

So you could set up the tool in a particular way whenever the tool initializes, or if you load a particular song.

And of course, sysex would not support the full spectrum of conditions & actions. Only “equal to/not equal to”, and “set” would be available.

As for MMC, strictly speaking they are also a special kind of sysex message, and I consider implementing them in a way similar to Duplex.

Basically, check if MMC before forwarding to Renoise. If true, simulate the effect by taking control of the transport.

This needs to be done because “raw” MMC messages are not picked up when sending them via the internal MIDI.

Just like any other property “when note-on and note is between C-4 and C-5” ?

Reinstalled without success, with the exception of the first time I opened after installation.

Also sometimes when “channel” “between” setup doesn’t split the third column into 2 values.

It also autostarts on my PC with autostart deselected.

I thought maybe it was MIDI Yoke running amok, but I deleted that and the value selection problem still occurs.

MMC functionality like duplex would be :clownstep:

Sysex would be :badteethslayer:

Thanks for replying. This works for the sliders on my controller. I can also get the note buttons to be able to play instruments. And the log shows the MIDI messages I want. But I can’t MIDI map any of the buttons to effects.

Your rule listens exclusively to CC messages, so you shouldn’t even be able to trigger notes. So, it sounds like you still have the device selected in Renoise MIDI prefs?

You need to disable the device, or you still receive the MIDI messages from the controller. This will mess up things as messages arrive “twice”.

Also, did you enable the OSC server as previously explained? You should be able to see it log the messages (arriving from xRules) in the OSC preferences - if not, then mappings won’t work. xRules needs to be able to pass those message to the Renoise OSC server, right port + address, using the “UDP” protocol.

Reinstalled without success, with the exception of the first time I opened after installation.

Also sometimes when “channel” “between” setup doesn’t split the third column into 2 values.

It also autostarts on my PC with autostart deselected.

That’s strange, I’ve not experienced any of these issues, on any installation.

Can you tell me a bit about your system? OS, Renoise version, and so forth…

That’s strange, I’ve not experienced any of these issues, on any installation.

Can you tell me a bit about your system? OS, Renoise version, and so forth…

HP Pavillion Win7 Home SP1 i3 quad core, 4 GB RAM, renoise 3.1. It seems to only start the issues after trying to add a port_name condition. The ports are Steinberg UR22(1), MPK225 (1-4) and Arturia Beatstep Pro(1-2) The enabled MIDI input and output prefs of the tool match that of Renoise options.

Your rule listens exclusively to CC messages, so you shouldn’t even be able to trigger notes. So, it sounds like you still have the device selected in Renoise MIDI prefs?

You need to disable the device, or you still receive the MIDI messages from the controller. This will mess up things as messages arrive “twice”.

Also, did you enable the OSC server as previously explained? You should be able to see it log the messages (arriving from xRules) in the OSC preferences - if not, then mappings won’t work. xRules needs to be able to pass those message to the Renoise OSC server, right port + address, using the “UDP” protocol.

Yes, did both things. I meant that I was able to write a rule that does what I want for the sliders and I’m able to MIDI map the sliders.

When I write rules for the button grid. I can get it to produce sound. But I’m not able to MIDI map the buttons to effects.
In the OSC preferences the sliders show up as “renoise/trigger/midi (1 arguments)” when using the rule I posted previously.

I can get the buttons to show up as “renoise/trigger/note_on (4 arguments)” and “… note_off (3 arguments)” when trying out some rules. But somehow the MIDI mappings dialog doesn’t recognize the incoming MIDI messages coming from the button grid.

I also encountered another problem. I’m running two instances of Renoise 3.1 on Windows 7. Splitting incoming MIDI using Copperlan into “VMidi 1” and “VMidi 2”. Worked fine before. But the tool only works on one or even none of the instances of Renoise. Any workaround for this?

I can get the buttons to show up as “renoise/trigger/note_on (4 arguments)” and “… note_off (3 arguments)” when trying out some rules. But somehow the MIDI mappings dialog doesn’t recognize the incoming MIDI messages coming from the button grid.

Ah, right - now I get it. This is down to how the internal OSC client works. It basically accepts two flavors of MIDI

  1. Routed MIDI, with the ability to trigger on a specific track & instrument.
  2. Raw MIDI being passed as if it came from outside Renoise.

xRules tries to be clever and always pass notes to the corresponding track and instrument, while anything else is treated as raw MIDI. And apparently, the notes are not MIDI mappable while the raw MIDI is. So that would explain your problem.

Good thing is, if you are looking to map the notes somewhere you probably don’t care about the track and instrument info.
So perhaps the “output_message” could simply be expanded with an extra option - let’s see if we can squeeze this into the next update :slight_smile:

It seems to only start the issues after trying to add a port_name condition

Thanks, that’s useful information

Could this tool be used to solve this problem?
https://forum.renoise.com/t/make-launchpad-matrix-light-up-when-using-keyzones/45743

TL;DR: Send information to the matrix of my MIDI controller to make it light up to indicate which of the buttons is currently used as a keyzone in the current instrument.

TL;DR: Send information to the matrix of my MIDI controller to make it light up

In theory it could, yes. But right now, the tool doesn’t even have the ability to send MIDI out. The next release (which will arrive in a couple of days) will feature MIDI output among other things.

And while it’s possible to do what you describe with xRules, the tool is really designed for more “simple-ish” purposes. If you want to run full-blown “applications” on a controller, I think you should check out the Duplex Keyboardinstead (and feel free to bump that other topic; Duplex already supports several AKAI controllers and we likely could make it support the APC key25 as well…)

Good thing is, if you are looking to map the notes somewhere you probably don’t care about the track and instrument info.
So perhaps the “output_message” could simply be expanded with an extra option - let’s see if we can squeeze this into the next update :slight_smile:

Awesome! Well yeah, I want some buttons to trigger instruments on a specific track, but I already found how to do that, and some to be mapped to effects. But I assume it’s easy to write rules for that, such as “when note is between … and …”

Do you have any idea how I could get this tool running on two instances of Renoise on Windows 7? When I open a second Renoise file the tools stops working on one or all the instances of Renoise.

I want some buttons to trigger instruments on a specific track […] and some to be mapped to effects

Yes, that would indeedbe a nice way to use this tool.

Wondering about the note → effect mappings. How are you doing this? Because, one thing I don’t really understand about Renoise is why we can’t MIDI-map individual notes to parameters.

In the Renoise MIDI mapping dialog, you can assign a note but then you have to control the parameter using the notevelocity. In practical terms, when playing something by hand this is really hard to do (and some pad controllers doesn’t even transmit velocity). I guess xRules is really handy here!

As for the multiple instance setup, it really depends on the audio/midi drivers that are installed on your system. Here, I can open multiple instances and they can all receive, send MIDI just fine. Lucky me :badteeth:

But apart from the device-driver issue, running multiple instances is actually a challenge to do right. Most often, you’d want each copy of Renoise to run with a slightly different configuration - see this topic for a more in-depth description of how that could be done.

Wondering about the note → effect mappings. How are you doing this? Because, one thing I don’t really understand about Renoise is why we can’t MIDI-map individual notes to parameters.

In the Renoise MIDI mapping dialog, you can assign a note but then you have to control the parameter using the notevelocity.

Maybe effects was not really the right word. I’m using some buttons on the Livid Ohm to control general stuff (start/stop song, loop section, record samples, …). As far as effects go I just toggle dsp’s on and off with them, apart from maybe the repeater dsp. I use the sliders to control the actual parameters.

As for the multiple instance setup, it really depends on the audio/midi drivers that are installed on your system. Here, I can open multiple instances and they can all receive, send MIDI just fine. Lucky me :badteeth:

But apart from the device-driver issue, running multiple instances is actually a challenge to do right. Most often, you’d want each copy of Renoise to run with a slightly different configuration - see this topic for a more in-depth description of how that could be done.

The thing is, I was able to do this just fine on Windows 7, before using the tool. But I need something like this tool, so that some of my mappings keep working while switching through banks on my controller (https://forum.renoise.com/t/create-midi-mapping-coming-from-any-channel/45527). Something that’s strangely enough not a native feature.

My audio interface (Komplete audio 6) can handle multiple instances of Renoise. And I can split the MIDI messages from my controller using Copperlan. The only thing I needed to do on startup was select “VMidi 1” in one instance of Renoise and “VMidi 2” in the other instead of my controller. Each time I opened a new file those preferences remained. Using this tool on one instance of Renoise works fine. But once I open a second Renoise screen, one or both the OSC servers can’t receive MIDI and the tool gives error screens. Each time I open a new file it also messes with the preferences of the tool itself. This has probably more to do with how the OSC server handles data, then with your tool. So sorry for messing up this topic.

The thing is, I was able to do this just fine on Windows 7, before using the tool. But I need something like this tool, so that some of my mappings keep working while switching through banks on my controller [/url])

Hm, if you are already able to initialize the devices across multiple instances then yeah, I wonder why running the tool would break things - it really shouldn’t.

Also, you made me think a bit more about this whole multiple-instance scenario. The batch-launching trick I linked to above will make it possible to launch each instance of Renoise with certain tools enabled or disabled. This would be one way to go, having xRules interpreting MIDI in one instance, with the other one running ‘standard’ mappings.

To improve on this, xRules itself could have a “multiple-instance” option, which would automatically detect if other instances were running when launched, and (if this is the case) make it use a separate configuration. So you would start Renoise A and then Renoise B, each with a different set of options/rules/devices/etc.

OK, just finished v0.61
Download:http://www.renoise.com/tools/xrules

IMPORTANT: If you have created rules of your own, take a backup of the /rulesets folder. The new install will overwrite the existing ones!
(you can find the folder from Tools > Tool Browser > rightclick and ‘reveal’ )

This is only the second release, so I’ve fixed a number of the reported issues. Probably introduced some new ones too :smiley:

But really, the big news is that now it can both send and receive OSC and MIDI.
Before, it was limited to receiving MIDI and passing that into Renoise - now, you can do quite a bit more. This also means that the user interface has been re-organized a little bit to more room for new stuff.

If you want to work with OSC data, the pattern syntax is quite simple:

-- interpret incoming pattern with two integer values
/some/pattern %i %i

-- of course, you can also specify a literal value
-- (these two are interpreted as integer and float, respectively)
/some/pattern 42 3.145

-- you can assign names like this (will show up in the UI)
/some/pattern %i:foo %i:bar

-- all supported value types:
-- %i int32
-- %f float32
-- %n "number" (can be both integer or float)
-- %s string

-- define an output pattern like this
/another/pattern $1 $2

-- the "tokens" determine the order of incoming values 
-- so, in order to flip the "foo" and "bar" around you would do this
/another/pattern $2 $1 

-- note also that if no output pattern is defined, the output is 
-- based on the input pattern

Btw: I just realized that I have not yet implemented OSC prefixes on a device level. So if you need to use prefixes, simply apply them to the patterns themselves.

When I write rules for the button grid. I can get it to produce sound. But I’m not able to MIDI map the buttons to effects.

This should be now be possible. To pass messages to Renoise without the extra routing information, select “internal_raw” as the target.

This should be now be possible. To pass messages to Renoise without the extra routing information, select “internal_raw” as the target.

Tested and it works. Thanks!

Now I just need to get this tool running on two instances of Renoise. Found that when enabling the OSC server in the Renoise preferences of one instance, the OSC tab in the preference screen of the other instance stops receiving MIDI messages and the other way around. With the new update of the tool, the settings in the options tab remain the same when opening a new xrns file. Was previously not the case. And I also don’t receive any more error messages coming from the tool. So it’s clearly a problem with how the OSC server functions.

Will try the link you posted above. But I have no knowledge of scripting.