Osc Discussion (How Where What To Use Osc)

You are sending an INT? Not a Bool?

Can you guys please read the OSC spec? Specifically the types tables? Example:

  
OSC Type Tag, Type of corresponding argument  
i int32  
f float32  
s OSC-string  
b OSC-blob  
h 64 bit big-endian two's complement integer  
t OSC-timetag  
d 64 bit ("double") IEEE 754 floating point number  
S Alternate type represented as an OSC-string (for example, for systems that differentiate "symbols" from "strings")  
c an ascii character, sent as 32 bits  
r 32 bit RGBA color  
m 4 byte MIDI message. Bytes from MSB to LSB are: port id, status byte, data1, data2  
T True. No bytes are allocated in the argument data.  
F False. No bytes are allocated in the argument data.  
N Nil. No bytes are allocated in the argument data.  
I Infinitum. No bytes are allocated in the argument data.  
[ Indicates the beginning of an array. The tags following are for data in the Array until a close brace tag is reached.  
] Indicates the end of an array.  
  

So let’s take a bool, in Renoise Lua semantics, this works:

  
client:send(  
 renoise.Osc.Message("/renoise/transport/loop/block", {   
 {tag="T", value=1}   
 })  
)  
  
client:send(  
 renoise.Osc.Message("/renoise/transport/loop/block", {   
 {tag="F", value=1}   
 })  
)  
  

This doesn’t:

  
client:send(  
 renoise.Osc.Message("/renoise/transport/loop/block", {   
 {tag="i", value=1}   
 })  
)  
  
client:send(  
 renoise.Osc.Message("/renoise/transport/loop/block", {   
 {tag="i", value=0}   
 })  
)  
  

Pay special attention to the TAG flag in the examples above. Find the equivilant in your PD or OSCTouch or whatever.

Finally, if you want more info than REJECTED, you can extend the GlobalOscActions.lua file. As described in the file, extend it in your local user space. From there, override the process_message() function and add the debug info you want.

Sending booleans seems to be a problem in many OSC programs, so I’ve made the argument checks a bit more fuzzy in Renoise, trying to convert the arguments to the expected type if somehow possible.

You can download/view the latest version in the XRNX repository:

With this version you can use numbers or strings as booleans (0,1, “true”/“false”) or strings as numbers (“23” -> 23) or numbers as strings (32 -> “32”) and so on.

More examples.

If I want to send a 127.7 (a float) to the BPM (again, see the types tables above), this works:

  
client:send(  
 renoise.Osc.Message("/renoise/transport/loop/block", {   
 {tag="f", value=127.7}   
 })  
)  
  

This doesn’t. It will send 127, and not 127.7:

  
client:send(  
 renoise.Osc.Message("/renoise/transport/loop/block", {   
 {tag="i", value=127.7}   
 })  
)  
  

From Taktik previous post, he is making things more fuzzy, but the concept of “types” is basic programming 101.

Scripting environments like PHP are forgiving (you can use string, ints, floats and PHP doesn’t complain) but in other languages (C++, for example) you can’t do this.

(((\o/)))

I’m going into the red light district on this one:

/renoise/track/XXX/mute

if I use

/renoise/track/-1/mute

it will get rejected,

what is the form for this XXX?

thanks people, i checked out osctestapp (which is great) and found out why i was having a problem.
max is indeed sending ints 1/0 not the bool type values T or F. i can’t even figure out how to do this in max yet.

thanks for the edit of the file taktik. renoise just being stricter to the spec than anything i’ve used so far got me stuck.

for example touchosc sends float values of all things for it’s toggle controls!

edit: just tested the new globaloscactions.
my test patch in max works. thanks.

So it seems we need Alias functions to cover for OSC-filthy apps.
A shame to know that an open format already got raped so badly. It actually pisses me off a bit, it already is an open format and folks simply don’t obey the standards described.
This way there will never be a good standard that allows uncomplicated communication between various hard- and software applications.

Hey Vince, your tool doesn’t register with the SVN checkout.

And your right, there isn’t many industry hardware implementations with DIY as the exception that utilize OSC yet, probably because of how the standard bends.

Its
/renoise/song/track/XXX/mute

Thanks Taktik!

Everything is finally working!

I’ve been cataloging SC3 messages, this is what I have so far:

b = NetAddr.new("127.0.0.1", 8000); // create the NetAddr   
  
b.sendMsg("/renoise/transport/bpm", 80); // set bpm to 80  
  
b.sendMsg("/renoise/song/edit/mode", 1); // turn on edit mode  
b.sendMsg("/renoise/song/edit/mode", 0); // turn off edit mode  
  
b.sendMsg("/renoise/song/edit/octave", 3); // set octave to 3  
  
b.sendMsg("/renoise/song/track/-01/prefx_volume_db", 1.3); // set current track vol to 1.3dB  
b.sendMsg("/renoise/song/track/-01/mute"); // mute current track  
  
b.sendMsg("/renoise/transport/start"); // start renoise  
b.sendMsg("/renoise/transport/stop"); // stop renoise  
b.sendMsg("/renoise/transport/panic"); // panic  
b.sendMsg("/renoise/transport/continue"); // continue  
  
b.sendMsg("/renoise/transport/loop/pattern",1); // turn on loop  
b.sendMsg("/renoise/transport/loop/pattern",0); // turn off loop  
b.sendMsg("/renoise/transport/loop/block_move_forwards"); // move the loop block forward  
b.sendMsg("/renoise/transport/loop/block_move_backwards"); // move the loop block backward  
b.sendMsg("/renoise/transport/loop/block", 1); // true, turn on block looping  
b.sendMsg("/renoise/transport/loop/block", 0); // false turn off block looping  
b.sendMsg("/renoise/transport/loop/sequence", 1, 4); // loop 4 patterns   
  
b.sendMsg("/renoise/song/edit/octave", 3); // set octave to 3  
b.sendMsg("/renoise/song/edit/step", 16); // set step to 16  
b.sendMsg("/renoise/transport/lpb", 8); // set LPB to 8  
  
  
  
b.sendMsg("/renoise/");  
  
  
  
b.disconnect; // disconnect  

With Unreliable i referenced to the fact that UDP doesn’t return acknowledge packages.
http://tunnel.mrq3.c…lain/node2.html

And unfortunately also on the local computer i somehow managed to overrun the Renoise OSC server with messages using UDP protocol, so messages didn’t got processed: That i consider “unreliable” too. The TCP client at least neatly awaits the acknowledge package before sending another package back. It might provide for the little latency that is needed before the first package is processed.
When using UDP, building in latency factors to give the server some breathing space, also seems necessary when many messages are send to it at once. But will this latency value be okay on every system?
With TCP, the client knows exactly when to send the next package, therefor the latency-factor is dynamic and not fixed.

Perhaps having an option to get feedback from the server that a package is processed might also resolve the need for an extra minimum latency factor in between messages.

No sorry, the SVN is not really meant for these kind of examples, so i have removed it. (The OSC snippet file should contain everything you need)
But the most crucial changes i have had included in my post, further nothing much was changed in the file i posted earlier here in this topic.

It was/is a rather useful example of linking OSC messages to ViewBuilder objects.

I just began getting this to work, but the clamp points are not right.
I want to use 09XX precision so I set it 1 to 255 (256) previously, now since this edit it’s 10000, as I just found out the resolution for the loop point placement is governed by the drop down in the editor.

Thinking I need to add something to clamp value to get it to recognize this >>> num_sample_frames.
I have a working pure data file I can upload now to, might do that in a bit after I work out how to do some other things like changing the sample editor’s resolution type.
mainly I just want to do this internally, with a client linking the output of a meta-devices parameter, mainly an lfo meta-device to the loop_end at the moment.

--------------------------------------------------------------------------------  
-- Sample  
--------------------------------------------------------------------------------  
--It Aliens midi loop points experiment, conversion to OSC  
--renoise.song().instruments[].samples[].loop_start, _observable  
-- -> [number, 1 - num_sample_frames]  
--renoise.song().instruments[].samples[].loop_end, _observable  
-- -> [number, 1 - num_sample_frames]  
  
  
  
  
add_global_action {  
pattern = "/sample/loop_start",  
description = "float",  
  
arguments = { argument("loop_start", "number") },  
handler = function(loop_start)  
local sample = renoise.song().selected_sample;  
local number_of_frames = sample.sample_buffer.number_of_frames;  
local maxX = number_of_frames;  
sample.loop_start = clamp_value(loop_start, 1, maxX)  
end  
}  
  
--updated 23/8/2010  
  
  
add_global_action {  
pattern = "/sample/loop_end",  
description = "float",  
  
arguments = { argument("loop_end", "number") },  
handler = function(loop_end)  
local sample = renoise.song().selected_sample;  
local number_of_frames = sample.sample_buffer.number_of_frames;  
local maxY = number_of_frames;  
sample.loop_end = clamp_value(loop_end, 1, maxY)  
end  
}  
  
  

I still need to test this on a clean GlobalOscActions file.

this is like the 3rd day I’ve been trying to get this to work, pretty much started the night or day of.
first day I started watching The Lost Room, and I had this all messed up, f*ckin great story though.
2nd day, yesterday, I started watching Terminator: TSCC, I got pretty far on this but the story as good as it is kept pulling me away. now 3rd day after having completed watching the 1st season I toke a nap and decided to look at this with zero distractions and it’s working. So now I’m going to start the 2nd season of TSCC.

here is the pd file for the above, I added some xtra things.
this needs the code above.
http://wikisend.com/download/553322/renoise-works.pd

are nested bundles supported or not supported?

line 42 “…Bundles may contain multiple messages or nested bundles.”
line 112 “-- Nested bundles (bundles in bundles) are right now not supported.”

just got this to work:

--[[--------------------------------------------------------------------------  
moonrider's xy loop points thing has bugs demo  
Based on  
It Alien's diabolical midi loop points experiment  
  
I hit a wall with how sample frames work,   
and how to use a relative value for the selected sample.   
so for now do whatever this works for small samples,   
if you want to use large samples mess with the number "9289",  
in everything.  
this needs the code in this post:   
https://forum.renoise.com/t/osc-discussion-how-where-what-to-use-osc/29189  
added to your GlobalOscActions file, or it won't work.  
Also, this works best if you just click around in the XY.  
it's awesome. Thanks Renoise Team!  
--------------------------------------------------------------------------]]--  
do  
----------------------------------------------------------------------------  
 -- tools  
  
 local function assert_error(statement)  
 assert(pcall(statement) == false, "expected function error")  
 end  
  
  
 -- shortcuts  
  
 local app = renoise.app()  
 local ViewBuilder = renoise.ViewBuilder  
 local vb = ViewBuilder()  
  
 -----------------------------------------------------------------------------  
  
 -- consts  
  
 local DIALOG_MARGIN = ViewBuilder.DEFAULT_CONTROL_MARGIN  
 local DIALOG_SPACING = ViewBuilder.DEFAULT_CONTROL_SPACING  
 local DIALOG_BUTTON_HEIGHT = ViewBuilder.DEFAULT_CONTROL_HEIGHT  
 local DIALOG_MINI_BUTTON_HEIGHT = ViewBuilder.DEFAULT_MINI_CONTROL_HEIGHT  
  
 local CONTROL_HEIGHT = ViewBuilder.DEFAULT_CONTROL_HEIGHT  
 local CONTENT_MARGIN = ViewBuilder.DEFAULT_CONTROL_MARGIN  
 local CONTENT_SPACING = ViewBuilder.DEFAULT_CONTROL_SPACING  
  
 local CONTENT_WIDTH = 220  
  
  
 -- show_status  
  
 local function show_status(message)  
 renoise.app():show_status(message)  
 end  
local OscMessage = renoise.Osc.Message  
local OscBundle = renoise.Osc.Bundle  
  
-------------------------------------------------------------------------------  
-- Osc client & message construction (send Osc to a server)  
  
-- open a socket connection to the server  
  
local client, socket_error = renoise.Socket.create_client(  
 "127.0.0.1", 8000, renoise.Socket.PROTOCOL_UDP)  
  
if (socket_error) then   
 renoise.app():show_warning(("Failed to start the " ..   
 "OSC client. Error: '%s'"):format(socket_error))  
 return  
end  
  
  
 -- dialog content  
  
 local dialog_content = vb:row {  
 margin = DIALOG_MARGIN,  
 spacing = 4*DIALOG_SPACING,  
 vb:column {  
 margin = CONTENT_MARGIN,  
  
 vb:row {  
 spacing = CONTENT_SPACING,  
  
 vb:xypad {  
 width = 300,  
 height = 700,  
 min = {x=1, y=1},  
 max = {x=9289, y=9289},  
 value = {x=1, y=9289},  
 notifier = function(value)  
  
  
local message1 = OscMessage("/renoise/sample/loop_start", {   
 {tag="i", value=value.x},  
})  
local message2 = OscMessage("/renoise/sample/loop_end", {   
 {tag="i", value=value.y},  
})  
  
client:send(  
 OscBundle(os.clock(), {message1, message2})  
)  
 show_status(("xy pad value changed to '%.2f, %.2f'"):  
 format(value.x, value.y))  
 end  
 },  
 }   
 }  
 }  
  
 -- dialog key handler  
  
 function dialog_key_handler(dialog, mod, key)  
 print(("mod:'%s', key:'%s'"):format(mod, key))  
  
 if (mod == "" and key == "esc") then   
 dialog:close()  
 end  
 end  
  
  
 -- show_custom_dialog  
  
 my_dialog = app:show_custom_dialog("moonrider's xy loop points thing has bugs demo",   
 dialog_content, dialog_key_handler)  
  
 assert(my_dialog.visible)  
  
end  
  
------------------------------------------------------------------------------  
-- test finalizers  
  
collectgarbage()  
  
--[[--------------------------------------------------------------------------  
--------------------------------------------------------------------------]]--  
  

Line 42 simply defines the term bundles as how the OSC protocol describes it. Line 112 tells you what you currently cannot do.

Ah thanks, this was confusing me. I didn’t quite understand message bundles until about an hour ago.

From what I’ve noticed several other OSC enabled programs I’ve used also do not support nested bundles.
Not really sure what they would need to do, I guess that is a similar view point maybe.

A bundle is a just a collection of single messages transmitted as one over the network.
But bundles can be timetagged where as single messages can not (and should be used immediately).

Therefore, a sub bundle can contain a different timetag to the enclosing bundle.

For clarification a sub bundle would be considered a nested bundle though right?
If so, is that an ad hoc definition of how nested bundles work?