Page 1 of 1

16bit artnet in MadRouter?

Posted: Mon Jan 04, 2016 1:24 am
by sorenknud
Can anyone help me with a Python script for MadRouter that can take some 16bit artnet channels and convert to OSC floats? I think the math is pretty simple: take the Fine channel, divide it with 256 and add it to the Coarse channel, then you have the 16bit value. But how do I write it for MadRouter? Thanks a lot! :)

/Soren

Re: 16bit artnet in MadRouter?

Posted: Wed Jan 06, 2016 12:28 pm
by mad-matt
Two options, those ones are forwarding the 10 first DMX 16 bits channels to OSC

Without script:
Source URL = "/dmxin/ArtNetIn-0-0/[1-10][16]"
Target URL = /osc/MadRouterOscOut/channel[1-10]

With script:

Code: Select all

def artNet16BitsToOSC():
  for chIdx in range(1,10):
    chValue = mad.getChannelValue( "/dmxin/ArtNetIn-0-0/" + str(chIdx*2) + "[16]");
    mad.setChannelValue("/osc/MadRouterOscOut/channel" + str(chIdx*2), chValue);

mad.connect("onLoop()", artNet16BitsToOSC);

Let me know