OSC Server does not write notes in P.E. (Instr. Editor window)

I have a strange behavior with the following case. I will try to explain it by steps, see if you have the one that does not have anything in the code that makes it not work correctly:

STEP 1. I have used this code as a basis to control OSC Server, and so make the notes sound from the tool, as well as writing them in the pattern editor:

Class "VPD_OscClient"
 
function VPD_OscClient:__init( osc_host, osc_port, protocol )
  self._connection = nil
  local client, socket_error = renoise.Socket.create_client( osc_host, osc_port, protocol )
  if ( socket_error ) then 
    renoise.app():show_warning( "Warning: Failed to start the internal OSC client" )
    self._connection = nil
  else
    self._connection = client
  end
end

-- Trigger instrument-note
--- note_on (bool), true when note-on and false when note-off
--- instr (int), the Renoise instrument index 1-254
--- track (int), the Renoise track index 
--- note (int), the desired pitch, 0-119
--- velocity (int), the desired velocity, 0-127
function VPD_OscClient:trigger_instrument( note_on, instr, track, note, velocity )
  if not self._connection then
    return false
  end
  local osc_vars = { }
    osc_vars[1] = { tag = "i", value = instr }
    osc_vars[2] = { tag = "i", value = track }
    osc_vars[3] = { tag = "i", value = note }
  local header = nil
  if ( note_on ) then
    header = "/renoise/trigger/note_on"
    osc_vars[4] = { tag = "i", value = velocity }    
  else
    header = "/renoise/trigger/note_off"
  end
  self._connection:send( renoise.Osc.Message( header, osc_vars ) )
  return true
end

vpd_osc_client = VPD_OscClient( "127.0.0.1", 8000, 2 ) --the user needs to activate it! Port: 8000, Protocool: UDP (2), IP (localhost): 127.0.0.1

Then I use these lines to press and release the button:

  • to pressed: vpd_osc_client:trigger_instrument( true, instrument, track, note, volume )
  • to released: vpd_osc_client:trigger_instrument( false, instrument, track, note, volume )

As the code is now, it works correctly. The notes sound and they are written correctly in the pattern editor (with its volume, delay and note-OFF). Renoise does this internally.

STEP 2.The next step is to detach the instrument editor in a separate window [ALT D].Now you will have 2 separate windows.

STEP 3.Now use the code provided normally, with the button to sound the notes and write in the pattern editor.Ok, the notes sound correctly, and stop correctly. But the pattern editor does not write the notes!For some reason if the instrument editor is in a separate window, Renoise loses the ability to write the notes in the pattern editor, (they do sound, but they do not write) :unsure:.

Can anyone review all this of the OSC Server code, in case there is something missing that guarantees that when the instrument editor is in a separate window, Renoise keeps recording the notes in the pattern editor?

@Danoise ,Can you help me here? Is this a Renoise problem or is there something missing in the code used related to the OSC Server that makes the writing of the notes not work because of the separate window of the instrument editor?

The objective is simple. That the OSC Server code used also allows writing notes in the pattern editor, even if the separate instrument editor window is there. It seems that being separated, it is as if it takes precedence over the pattern editor. But even by selecting the pattern editor (with the separate instrument editor window), the OSC Server code is not able to write the notes (it does sound good, but it does not write anything).

Please, could you test the OSC Server code with the instrument editor in a separate window, to see if it is possible for the pattern editor to write the notes when the trigger button is pressed? Is there any way to make it work?

I get the feeling that it is something internal to Renoise, but maybe there is some code trick of the OSC Server that guarantees that it works well in this scenario.

@Joule , have you ever been able to experiment with this?

@Joule , have you ever been able to experiment with this?

I’ve used OSC but didn’t find anything strange with it.

It will indeed record notes so long as the pattern editor is in edit mode and - I think - the pattern editor is focused. I assume that Renoise treats the data you’re sending via OSC exactly as if you would have played the notes via a midi keyboard.

My guess is that you will have to work around it by entering the notes via normal renoise.song() access (into the selected_line) whenever the pattern editor isn’t focused and in edit mode. Granted, it won’t catch delay values as the OSC input would have.

It will indeed record notes so long as the pattern editor is in edit mode and - I think - the pattern editor is focused. …

This is the problem, that if you have the separate instrument editor window, even if you have the pattern editor in edit mode and focused, do not write the notes. The fact of having the window separated, prevents writing the notes.

You focus the pattern editor and activate the editor mode of the pattern editor, and it will not write if you have the separate instrument editor window. If you do not have the separate instrument window, it will write. What is the cause?For me, it’s a strange behavior.

Maybe something is missing in the code?

I think you’re correct and that it’s a bit of an oversight/inconsistency. I’m just guessing that the visual keyboard and/or phrase mechanism of instruments overrides the route of the midi data internally in Renoise, whenever it is visible.

It has never been a problem to me. I wouldn’t rely on entering note data via OSC and a GUI the way you are intending (maybe it’s not really meant to be used that way). Rather, enter it via renoise.song() and disable edit mode beforehand to avoid any duplicate entering. That’s what I do.

… I’m just guessing that the visual keyboard and/or phrase mechanism of instruments overrides the route of the midi data internally in Renoise, whenever it is visible.

Actually, it does not matter if the instrument editor window is visible or closed. It is sufficient that Renoise is configured with the separate instrument editor window. Let’s see if Danoise reads all this and can examine it thoroughly.

The fact is that the live recording through the OSC Server, as it is now with this code, works perfect! There is only this problem of separating the instrument editor window.One of my tools writes notes through MIDI Input using the OSC Server, and it works exactly as I wish, mainly because it enters the delay and the notes-OFFs. Having to add another function to write notes through renoise.song () would not work the same. In fact, this is how I had it before, but I do not like the result, since it does not work the same.

If there was any way to patch the OSC Server to work in both scenarios…

I break down here all the cases in which OSC Server loses the ability to write the notes in the pattern editor:

Case 1 :you have selected any tab within the instrument editor, without separating the instrument editor window.

Case 2 :you have the separate instrument editor window [ALT D].In this case, it is not important to select the pattern editor to write, OSC Server is not able to write the notes.In this case, it does not matter if you select the pattern editor to write, OSC Server is not able to write the notes.

Case 3, 4 and 5 :Similar to the previous case. You have the separate instrument editor window, but either it is in the background or is maximized or minimized. Is the same. OSC Server is not able to write the notes in the pattern editor, even if you have the pattern editor selected.

In all cases OSC Server is able to reproduce the sounds, and also obviously, the pattern editor is with the edition activated.

I have been investigating what could be the problem of this limitation, which maybe is a mistake or case not contemplated by the developers.When you select the instrument editor, Renoise automatically protects the writing in the pattern editor, since you are working in the instrument editor.

But if the instrument editor window is separated [ALT D], there are two cases. The compositor may have selected the pattern editor, since they are 2 separate windows, or he may have selected the instrument editor window. In either case, Renoise protects the writing in the pattern editor, when it should not be like that. It seems a forgetting of programming. Maybe it is due to add later the possibility of separating the instrument editor in a window?


I have still deepened more here.In the live recording through OSC Server, Renoise records the notes with the delay and note-off parameters (including delay in the note-off). This is great, because it allows you to record exactly what the composer plays.So, in the Renoise: Preferences/MIDI ,There are two sections in Record & Play Filter (among others):

  1. Velocities
  2. Note Offs

These two boxes allow you to eliminate the recording of the volume values and Note Offs (a checkbox for delay is not available) using OSC Server (using the code shown above.).The issue is that these options are within the Renoise MIDI preferences. So, does OSC Server use MIDI to write the notes? Is this the responsible cause of not being able to write the notes inside the pattern editor, when you have the selected instrument editor?The instrument editor has a large tab called MIDI , and a sub-tab called Monitor.

@Danoise or @DBlue. Is there any way to prevent Renoise from stopping writing the notes in the pattern editor, when you have the selected instrument editor, using OSC Server?Is there an arrangement with the code or something, or is it internal to Renoise and is it not possible to fix it?

This topic does not seem like an error, but rather a scenario not contemplated, or a forgetting when programming Renoise.Please, can you review all this and report here what happens, and if there is a solution?

Thanks!

These two boxes allow you to eliminate the recording of the volume values and Note Offs (a checkbox for delay is not available) using OSC Server (using the code shown above.).The issue is that these options are within the Renoise MIDI preferences. So, does OSC Server use MIDI to write the notes? Is this the responsible cause of not being able to write the notes inside the pattern editor, when you have the selected instrument editor?The instrument editor has a large tab called MIDI , and a sub-tab called Monitor.

Hmm, actually not sure about this. I guess you’re using the ‘/renoise/trigger/midi’ OSC command? That should work pretty much like any regular MIDI input, but I’m not sure if those filters apply.
My own tools are mostly using the more explicit ‘/renoise/trigger/note_on’ and ‘/renoise/trigger/note_off’ commands, which allow for specific instrument/track routings.

@Danoise or @DBlue. Is there any way to prevent Renoise from stopping writing the notes in the pattern editor, when you have the selected instrument editor, using OSC Server?

Yes, although it’s a workaround: just position the cursor in a non-sequencer track and no notes should be recorded (but notes will still sound - I guess this is what you’re after?).
If you’re using the ‘/renoise/trigger/note_on’ or ‘/renoise/trigger/note_off’ commands you can specify it from there as well - might be easier…

@Danoise.

Mmm, the only problem I have is that the OSC server does not allow writing notes when the instrument editor window is separated. It seems that Renoise has a problem here.

I am using these codes at all times to press and release in two separate functions:

To press:

vpd_osc_client:trigger_instrument( true, instrument_value, track_value, note_value, volume_value )

To release:

vpd_osc_client:trigger_instrument( false, instrument_value, track_value, note_value, volume_value )

With the previous OSC Server code:

Click to view contents
Class "VPD_OscClient"
 
function VPD_OscClient:__init( osc_host, osc_port, protocol )
  self._connection = nil
  local client, socket_error = renoise.Socket.create_client( osc_host, osc_port, protocol )
  if ( socket_error ) then 
    renoise.app():show_warning( "Warning: Failed to start the internal OSC client" )
    self._connection = nil
  else
    self._connection = client
  end
end
 
-- Trigger instrument-note
--- note_on (bool), true when note-on and false when note-off
--- instr (int), the Renoise instrument index 1-254
--- track (int), the Renoise track index 
--- note (int), the desired pitch, 0-119
--- velocity (int), the desired velocity, 0-127
function VPD_OscClient:trigger_instrument( note_on, instr, track, note, velocity )
  if not self._connection then
    return false
  end
  local osc_vars = { }
    osc_vars[1] = { tag = "i", value = instr }
    osc_vars[2] = { tag = "i", value = track }
    osc_vars[3] = { tag = "i", value = note }
  local header = nil
  if ( note_on ) then
    header = "/renoise/trigger/note_on"
    osc_vars[4] = { tag = "i", value = velocity }    
  else
    header = "/renoise/trigger/note_off"
  end
  self._connection:send( renoise.Osc.Message( header, osc_vars ) )
  return true
end
 
vpd_osc_client = VPD_OscClient( "127.0.0.1", 8000, 2 ) --the user needs to activate it! Port: 8000, Protocool: UDP (2), IP (localhost): 127.0.0.1

I just want to be able to separate the instrument editor window, select the pattern editor, and let OSC Server keep writing the notes.The only problem is that Renoise blocks the writing of the notes through the OSC Server, as long as the window of the instrument editor is separated, although you select the pattern editor.

Look at this image:

7882 osc_server_not_write.png

The instrument editor window is not selected.The pattern editor is selected. OSC Server with this code is not able to write the notes. The notes sound, but he does not write.Renoise should be able to write the notes in this scenario.But for some reason Renose blocks it. What happen?

The instrument editor window is not selected.The pattern editor is selected. OSC Server with this code is not able to write the notes. The notes sound, but he does not write.

Yep, that’s inconsistent with normal MIDI keyboard behavior. I don’t know of a workaround, definitely some quirk of the API.

Apparently, I misread your post. But it’s also a desirable thing to be able to prevent notes from being written in the pattern - if you ever wanted to do stuff like implementing your own “edit” button, for example.

Yep, that’s inconsistent with normal MIDI keyboard behavior. I don’t know of a workaround, definitely some quirk of the API.

Apparently, I misread your post. But it’s also a desirable thing to be able to prevent notes from being written in the pattern - if you ever wanted to do stuff like implementing your own “edit” button, for example.

@Danoise. Thanks for looking at this matter!

This is how I understand the chain of operation of all this (I suppose the scheme is not technical, but it will serve to guide us):

(1) Renoise → (2) OSC Server (scriping API) → (3) /trigger/note_on &/trigger/note_off → (4) button → (5 & 6) pressed, released, notifier button &midi_mapping button

So I understand that the problem is in the link between (1) and (2), between Renoise and OSC Server.Any programmer who builds tools using the LUA script does not have control over this behavior of blocking (I’m trying to guess, I could be wrong).

Unless there is some specific code for OSC Server that avoids this problem.The fact is that it is a very annoying problem. It prevents using a tool configured to write notes through OSC Server with the separate instrument editor window, even if this window is minimized!

This problem of writing notes the OSC server with the instrument editor window is serious. Probably, the solution under the hood of Renoise is something like false change to true in some condition.

Another problem that I remember is not having the option of released in key (key.released) to Key Handlerthat prevents the construction of really interesting tools, to be able to control correctly with the USB keyboard, in addition to the mouse and MIDI Input, as well as to react correctly the illumination of the buttons when releasing a real switch (a USB keyboard key).

So far, these two problems are the most annoying that I have detected, and that prevent me from finishing building certain tools that would be, honestly, really useful.

There is a thread, the famous one about RAS, that talks about building an effective accompaniment system. But this is not really possible to build if there are these problems mentioned in Renoise. The programmer has to have “full” control of the USB mouse, the USB keyboard, and the MIDI input, to be able to combine the 3 peripherals as desired, and that means being able to do something as simple as being able to execute a function when you release the key from your USB keyboard.

I am a little sad about this topic, because I think that solving these issues is really easy under the hood of Renoise. They seem like forgotten or unforeseen scenarios, lack of programming, not a problem as such.

I do not even know if youselves (Renoise Team) are taking note of these problems to solve them, or they are simply ignored.

Will Taktik know about these issues at some point? Is it necessary to send an email or something?

Please, I would like these issues to be resolved, and do not forget.At least these two issues (OSC Server-Instrument Editor Window & Key released to Key Handler).

If necessary, I would ask you to contact me when you start developing the next version of Renoise, to remind you of these most important problems. I would not mind helping to do beta tester if necessary.Most requests are unimportant matters. But at least there are 3 fundamental things that would greatly help to improve complex tools, especially related to the control of peripherals.