Rounding?

LXConsole support and feedback
Post Reply
freadZdead
Posts: 211
Joined: Sat Jun 01, 2013 8:23 am
Location: Adelaide, Australia

Rounding?

Post by freadZdead »

On a minor side note, how are the OSC and/or MIDI values derived? and how the displayed percentages of the software? I am using the MIDI channels for display purposes, and something odd is happening with the rounding, I believe... probably not even in LXConsole, but it would help me to understand how LXconsole is doing it, i.e. - are the OSC/MIDI values being derived straight from the DMX value? which is derived from the percentage entered? or which way around/with what rounding algorithms is is done?

Thanks for the info :)!
Cheers,

Freddy
admin
Site Admin
Posts: 1643
Joined: Mon Nov 05, 2007 1:26 am
Contact:

Post by admin »

All levels in LXConsole are internally represented in floating point format in the range 0.0 to 100.0. They are converted to DMX (0-255) output using the standard formula:

dmx = round((level/100)*255)

The values are stored in a file in hex format using standard USITT ASCII and converted to and from percentages as outlined above.

A similar formula is followed for MIDI, except the range is, of course, 0-127 rather than 0-255.

midi = round((level/100)*127)

OSC arguments are floating point, either 0.0-1.0 or 0.0-100.0. For example, TouchOSC controls generally send arguments in the range 0.0-1.0 and are converted to a level by multiplying by 100.
freadZdead
Posts: 211
Joined: Sat Jun 01, 2013 8:23 am
Location: Adelaide, Australia

Post by freadZdead »

Hi Claude,


Thanks for the info - makes sense and is sensible, so I passed it on and will hopefully be able to solve it :).
Cheers,

Freddy
Post Reply