Osc Discussion (How Where What To Use Osc)

samBiotic, you can add these to the GlobalOscActions.lua

  
add_action {   
 pattern = "/transport/edit/on",   
 description = "Start Editing(boolean)",  
 handler = function(edit_mode)  
 renoise.song().transport.edit_mode = true  
 end,  
}  
  
add_action {   
 pattern = "/transport/edit/off",   
 description = "Start Editing(boolean)",  
 handler = function(edit_mode)  
 renoise.song().transport.edit_mode = false  
 end,  
}  
  
add_action {   
 pattern = "/transport/edit_step",   
 arguments = { argument("edit_step_value", "number") },   
 description = "Set the songs edit step [0-64]",  
 handler = function(edit_step)  
 renoise.song().transport.edit_step = clamp_value(edit_step, 0, 64)  
 end,  
}   
  
add_action {   
 pattern = "/transport/tpl",   
 arguments = { argument("tpl_value", "number") },   
 description = "Set the songs ticks per line [1-16]",  
 handler = function(tpl)  
 renoise.song().transport.tpl = clamp_value(tpl, 1, 16)  
 end,   
}  
  

In the scripting editor, select GlobalOscActions.lua, then a little way through the file you will see a section for transport. that is where these go.

It would be better to put all of these in a file GlobalOscActions.lua would call, but I don’t know how that’s done yet. For lists of everything that can be addressed, look in the documentation of the files with “~.API.txt”.

Like Taktik wrote make sure you have a copy of this as when B3 comes it .will be written over.

Thanks Taktik for clearing that up for me. :)

cool, midi note on:

/renoise/trigger/note_on -1 -1 48 127

address currently selected instrument currently selected track Note C-4 Vol/Vel 7F

I wasn’t clear about those. It should be:

  
add_action {   
 pattern = "/transport/edit_mode",   
 arguments = { argument("edit_mode", "boolean") },   
 description = "Set global edit mode on or off",  
 handler = function(edit_mode)  
 renoise.song().transport.edit_mode = edit_mode  
 end,  
}  
  

And/Or:

  
add_action {   
 pattern = "/transport/enable_edit_mode",   
 description = "Set global edit mode on",  
 handler = function()  
 renoise.song().transport.edit_mode = true  
 end,  
}  
  
add_action {   
 pattern = "/transport/disable_edit_mode",   
 description = "Set global edit mode off",  
 handler = function()  
 renoise.song().transport.edit_mode = false  
 end,  
}  
  

Got it now?

Hi Taktik,

In the last 2 examples you are using a more descriptive and concise address pattern.
In the first example, I can’t figure out what is accepted to send it.

What is the input the api accepts for a boolean with an argument?
I just can’t make sense of what the interpreter is actually accepting in several cases.

like for instance with this:

  
add_action {   
 pattern = "/transport/edit_step",   
 arguments = { argument("edit_step_value", "number") },   
 description = "Set the songs edit step [0-64]",  
 handler = function(edit_step)  
 renoise.song().transport.edit_step = clamp_value(edit_step, 0, 64)  
 end,  
}   
  

From pd I can send this:

[pd]send /renoise/transport/edit_step 7[/pd]

No problems at all sending this with pd, I don’t need to specify it’s an integer as the type tags are already turned on by default, I think.

Then for your first example, essentially I would think first to send:
[pd]send /renoise/transport/edit_mode[/pd]
Since it’s a boolean with an argument, I know something else needs to be sent with it but, I can’t find what else to send.

I would think
[pd]send /renoise/transport/edit_mode true[/pd]
would work but… it doesn’t want that.

If that supposed to be the correct message format… i’m still getting Rejected in my test scenario…

In general 0 stands for true and -1 stands for false if specifically numbers have to be send as boolean values.
Or try vice versa or try with 0/1 instead of 0/-1.

FYI, I’ve been using this to test pd-extended with renoise’s api.
So far quite a bit is accepted, a few of them are miswritten because I’m simply a gorilla with a keyboard. :D

the file
http://wikisend.com/download/477426/MRsendOSC-help.pd

in case you or anyone else wants to have a look.
I’m not sure if it is actually using anything from pd-extended, I just grabbed pd-extended since it had more.

Ehm. No. A boolean in OSC is a boolean and not some kind of number.
Same in Lua: the number 0 evaluates to true in Lua.

Moonrider:
Sorry, I don’t know how to send boolean arguments in PD. But if that doesn’t work, then simply use the “edit_mode_on” “edit_mode_off” patterns?

that example works with pd

[pd] send /renoise/trigger/note_on -1 -1 48 127 [/pd]

it fires current inst & track C-4 7F
in the pd file I uploaded to wikisend it should work.

something like this:
[pd] send /renoise/transport/edit_mode 1 [/pd]

will get rejected with boolean with an argument, I guess it could be from pd’s side sending it as an integer, and renoise seeing it as incorrect?
That would make sense.

I think I just deduced pd is sending the argument “1” as an integer. :S

Is that right? I should be sending 0 or 1? or should I be sending True or False?

That makes more sense then indeed…
Quite confusing how parameters should be send…

This doesn’t work from within the Lua script (connecting works but the message gets rejected):

[phpbox] function connect_to_server() client, client_error = renoise.Socket.create_client(osc_host,osc_port) connection_status = IN_PROGRESS if client ~= nil then if client.is_open then print(“client open”) client:send(OscMessage(“/renoise/trigger/note_on(-1,-1,48,127)”)) else if client_error then local err_msg = “Could not connect to server reason: [”…client_error…"]\n\nPlease check your network connection and try again " local choice = renoise.app():show_prompt(“Network error”,err_msg,{‘close’}) end end else local cl_err = “Client connection-establishment failed.” if client_error ~= nil then cl_err = client_error end local err_msg = "Could not connect to server reason: “…cl_err…”\n\nPlease check your network connection and try again " local choice = renoise.app():show_prompt(“Network error”,err_msg,{‘close’}) end end [/phpbox]

I would expect this supposed to work from within Renoise.
Parameterless commands like transport_start and transport_stop work flawlessly though.

Regarding the Boolean stuff in PD, this page seem to give a good description how to deal with those:
http://en.flossmanuals.net/PureData/OSC

You can not pass arguments by simply adding them to the pattern.
Please see XRNX/Trunk/Snippets/Osc.lua on how to send and receive OSC in the Renoise Lua API.


Looks like we badly need a tutorial for all this OSC stuff. I’ll try to do one in the next days. If someone else is familiar with OSC and wants to help with this, this would be very appropriate.

From the GlobalOSCActions.lua i clamped myself to this description in the hope to get somewhere:

  
 /renoise/trigger/note_on(instr(int32/64), track(int32/64),   
 note(int32/64), velocity(int32/64))  
  

There comes the confusion from.
I tried using the tags, but i used the wrong ones…
I got it now:

  
  
-- send a OSC note_on message with the Renoise Lua API:  
local note_on_message = OscMessage(  
 "/renoise/trigger/note_on", {  
 {tag="i",value=-1},  
 {tag="i",value=-1},  
 {tag="i",value=48},  
 {tag="i",value=127}  
 }  
)  
  
client:send(note_on_message)  
  

I would be glad to help.
However, I’m moving house this week and will be busy until next weekend.

Something that I think needs doing is creating a master GlobalOscActions.lua for possible distribution with 2.6 final.
With an address space created of say everything in the midi mapping dialogue initially.

This would allow anyone fluent in other osc capable software to be able to control renoise externally straight away without diving into the lua scripting environment. And for those that are getting stuck in with lua, another possible way of hooking up osc hardware (monomeserial to duplex for example) by remapping the incoming data easily to the standard methods contained.

Discuss!

Great!

I simply wasn’t sure how big the interest would be in OSC and Renoise. So I kept the default impl very very basic and easy, also hoping that we get some help to finalize, extend from the community.

Also it felt wrong top copy and paste all we got in the MIDI mapping to OSC.

Finally, you can do nearly everything with the “evaluate” message, so we should encourage people to use it. Osc is not easy, scripting is not. They pair up quite nicely then ;)

Could you provide an example of creating another osc method from a received osc evaluate string?

[edit] scrap that! I have it working now. this is not obviously not needed.

Here is a little MaxMSP 5 patch demonstrating sending an evaluate message to control bpm.
[luabox]
{
“patcher” : {
“fileversion” : 1,
“rect” : [12.0, 78.0, 318.0, 159.0],
“bglocked” : 0,
“defrect” : [12.0, 78.0, 318.0, 159.0],
“openrect” : [0.0, 0.0, 0.0, 0.0],
“openinpresentation” : 0,
“default_fontsize” : 12.0,
“default_fontface” : 0,
“default_fontname” : “Arial”,
“gridonopen” : 0,
“gridsize” : [15.0, 15.0],
“gridsnaponopen” : 0,
“toolbarvisible” : 1,
“boxanimatetime” : 200,
“imprint” : 0,
“enablehscroll” : 1,
“enablevscroll” : 1,
“devicewidth” : 0.0,
“boxes” : [ {
“box” : {
“maxclass” : “flonum”,
“numinlets” : 1,
“fontsize” : 12.0,
“numoutlets” : 2,
“outlettype” : [“float”, “bang”],
“patching_rect” : [15.0, 15.0, 50.0, 20.0],
“id” : “obj-3”,
“fontname” : “Arial”
}

}
, {
“box” : {
“maxclass” : “newobj”,
“text” : “print”,
“numinlets” : 1,
“fontsize” : 12.0,
“numoutlets” : 0,
“patching_rect” : [165.0, 105.0, 34.0, 20.0],
“id” : “obj-52”,
“fontname” : “Arial”
}

}
, {
“box” : {
“maxclass” : “newobj”,
“text” : “prepend /renoise/evaluate”,
“numinlets” : 1,
“fontsize” : 12.0,
“numoutlets” : 1,
“outlettype” : [""],
“patching_rect” : [15.0, 75.0, 149.0, 20.0],
“id” : “obj-15”,
“fontname” : “Arial”
}

}
, {
“box” : {
“maxclass” : “newobj”,
“text” : “sprintf symout renoise.song().transport.bpm = %f”,
“numinlets” : 1,
“fontsize” : 12.0,
“numoutlets” : 1,
“outlettype” : [""],
“patching_rect” : [15.0, 45.0, 270.0, 20.0],
“id” : “obj-10”,
“fontname” : “Arial”
}

}
, {
“box” : {
“maxclass” : “newobj”,
“text” : “udpsend localhost 8000”,
“numinlets” : 1,
“fontsize” : 12.0,
“numoutlets” : 0,
“patching_rect” : [15.0, 105.0, 137.0, 20.0],
“id” : “obj-1”,
“fontname” : “Arial”
}

}
],
“lines” : [ {
“patchline” : {
“source” : [“obj-3”, 0],
“destination” : [“obj-10”, 0],
“hidden” : 0,
“midpoints” : []
}

}
, {
“patchline” : {
“source” : [“obj-10”, 0],
“destination” : [“obj-15”, 0],
“hidden” : 0,
“midpoints” : []
}

}
, {
“patchline” : {
“source” : [“obj-15”, 0],
“destination” : [“obj-1”, 0],
“hidden” : 0,
“midpoints” : []
}

}
, {
“patchline” : {
“source” : [“obj-15”, 0],
“destination” : [“obj-52”, 0],
“hidden” : 0,
“midpoints” : []
}

}
]
}

}

[/luabox]

There is a 30 day demo or a free runtime at http://cycling74.com/downloads/
copy the text in the expandable box and hit ‘file->new from clipboard’

Examples of methods for sending messages from renoise as a client to renoise as a server would be lush. :)
Then we could have a 1:1 (terminal to terminal) on what is accepted between instances of renoise?
Is this right? could we send messages from the Terminal?

In the future I would really like to see the terminal more verbose with rejected messages, or what it’s interpreting before being turned to binary.

Osc examples for addressing tracks and dsp-devices, meta-devices and the pattern matrix could more than likely really kick start my understanding & usage. From what I’ve noticed this stuff isn’t directly accessible yet. (unless it’s somehow called with midi maybe?)

Oh yeah, and what has everyone been using to test the Osc communication with Renoise?

+1 on a more verbose terminal

I’ve been trying to send messages like these via evaluate to address tracks but some seem to expect a renoise.DeviceParameter object whatever that is.

/renoise/evaluate 'renoise.song().tracks[1].postfx_volume = 1.000000'  
*** expression failed: 'property 'postfx_volume' is read only'  

Also, I’ve updated my little MaxMSP 5 patch to become a port of Conner_Bw’s php example
[luabox]
{
“patcher” : {
“fileversion” : 1,
“rect” : [12.0, 78.0, 318.0, 159.0],
“bglocked” : 0,
“defrect” : [12.0, 78.0, 318.0, 159.0],
“openrect” : [0.0, 0.0, 0.0, 0.0],
“openinpresentation” : 0,
“default_fontsize” : 12.0,
“default_fontface” : 0,
“default_fontname” : “Arial”,
“gridonopen” : 0,
“gridsize” : [15.0, 15.0],
“gridsnaponopen” : 0,
“toolbarvisible” : 1,
“boxanimatetime” : 200,
“imprint” : 0,
“enablehscroll” : 1,
“enablevscroll” : 1,
“devicewidth” : 0.0,
“boxes” : [ {
“box” : {
“maxclass” : “flonum”,
“numinlets” : 1,
“fontsize” : 12.0,
“numoutlets” : 2,
“outlettype” : [“float”, “bang”],
“patching_rect” : [15.0, 15.0, 50.0, 20.0],
“id” : “obj-3”,
“fontname” : “Arial”
}

}
, {
“box” : {
“maxclass” : “newobj”,
“text” : “print”,
“numinlets” : 1,
“fontsize” : 12.0,
“numoutlets” : 0,
“patching_rect” : [165.0, 105.0, 34.0, 20.0],
“id” : “obj-52”,
“fontname” : “Arial”
}

}
, {
“box” : {
“maxclass” : “newobj”,
“text” : “prepend /renoise/evaluate”,
“numinlets” : 1,
“fontsize” : 12.0,
“numoutlets” : 1,
“outlettype” : [“”],
“patching_rect” : [15.0, 75.0, 149.0, 20.0],
“id” : “obj-15”,
“fontname” : “Arial”
}

}
, {
“box” : {
“maxclass” : “newobj”,
“text” : “sprintf symout renoise.song().transport.bpm = %f”,
“numinlets” : 1,
“fontsize” : 12.0,
“numoutlets” : 1,
“outlettype” : [“”],
“patching_rect” : [15.0, 45.0, 270.0, 20.0],
“id” : “obj-10”,
“fontname” : “Arial”
}

}
, {
“box” : {
“maxclass” : “newobj”,
“text” : “udpsend localhost 8000”,
“numinlets” : 1,
“fontsize” : 12.0,
“numoutlets” : 0,
“patching_rect” : [15.0, 105.0, 137.0, 20.0],
“id” : “obj-1”,
“fontname” : “Arial”
}

}
],
“lines” : [ {
“patchline” : {
“source” : [“obj-3”, 0],
“destination” : [“obj-10”, 0],
“hidden” : 0,
“midpoints” :
}

}
, {
“patchline” : {
“source” : [“obj-10”, 0],
“destination” : [“obj-15”, 0],
“hidden” : 0,
“midpoints” :
}

}
, {
“patchline” : {
“source” : [“obj-15”, 0],
“destination” : [“obj-1”, 0],
“hidden” : 0,
“midpoints” :
}

}
, {
“patchline” : {
“source” : [“obj-15”, 0],
“destination” : [“obj-52”, 0],
“hidden” : 0,
“midpoints” :
}

}
]
}

}
[/luabox]

  1. Set the song bpm to 500 /renoise/evaluate ‘renoise.song().transport.bpm = 500.000000’
  2. Start the transport /renoise/transport/start
  3. Wait 5 seconds
  4. Stop the song /renoise/transport/stop

Is there a computational delay when using evaluate?
I have to add 20ms between step 1) & 2)

That seems like a documentation error here or a function problem.
A read-only item is mostly described so in the docs.

Edit:btw, if you are not sure about how to submit stuff, i personally forget this quite a lot of times myself try this in the terminal command-line:
oprint(renoise.song().tracks[1].postfx_volume)

You then get a list of what is behind it:

  
>>> oprint(renoise.song().tracks[1].postfx_volume)  
class: DeviceParameter  
 properties:  
 is_automated  
 is_automated_observable  
 name  
 polarity  
 show_in_mixer  
 show_in_mixer_observable  
 value  
 value_default  
 value_max  
 value_min  
 value_observable  
 value_quantum  
 value_string  
 value_string_observable  
 methods:  
 __STRICT  
 record_value  
  

reported:
http://www.renoise.c…showtopic=26197