DMX OSC Server
DMX OSC Server is a python lib to make it easier to create OSC Servers for the DMX Protocol.
It allows you to register fixtures are the wanted universe, starting address and channels. You will also be able to add an handler which will be called when a message is received for that fixture.
Originally designed for QLC+, but it should work with any program that sends to the /<universe>/dmx/<addr> path
It can receive single argument messages, like /<universe>/dmx/<addr> <value> (so you can set the channels to 3 and do channel 1 for red, 2 for green and 3 for blue)
It can also receive an array argument, like /<universe>/dmx/<addr> [<R>, <G>, <B>]
And it can also receive 3 arguments, like /<universe>/dmx/<addr> <R> <G> <B>
Installation
pip install DmxOscServer
Get Started
To create a simple DMX OSC Server that will listen on 0.0.0.0:9000 you can use this code:
from DmxOscServer import DmxOscServer
server = DmxOscServer()
# Define a 3 channel Fixture at address 0 at universe 0 which will execute my_rgb_handler when called
@server.define_fixture(0, 0, 3)
def my_rgb_handler(fixture, address, *args):
print ("{} got {}".format(address, args))
server.run()
To make the define more readable, you can use the argument names
# Define a 3 channel Fixture at address 0 at universe 0 which will execute my_rgb_handler when called
@server.define_fixture(universe=0, starting_addr=0, channels=3)
def my_rgb_handler(fixture, address, *args):
print ("{} has been set to {}".format(address, args))
To change the IP and/or port, you can specify that at the .run() method
server.run("10.10.123.5", 1234) # Will listen on 10.10.123.5:1234
If your addresses receive arrays or multiple args, add the channel_as_array=True argument
# Define a 3 channel array based Fixture at address 0 at universe 0 which will execute my_rgb_handler when called
@server.define_fixture(universe=0, starting_addr=0, channels=3, channel_as_array=True)
def my_rgb_handler(fixture, address, *args):
print ("{} has been set to {}".format(address, args))
It is also possible to use the Fixture class and the add_fixture method
from DmxOscServer import DmxOscServer, Fixture
def my_rgb_handler(fixture, address, *args):
print ("{} has been set to {}".format(address, args))
server = DmxOscServer()
server.add_fixture(Fixture(0, 0, 3, my_rgb_handler)) # Register a 3 channel not array based Fixture at address 0 at universe 0
server.add_fixture(Fixture(0, 3, 3, my_rgb_handler, True)) # Register a 3 channel array based Fixture at address 0 at universe 0
And for the add_fixture method, you can also add multiple fixtures at once using:
from DmxOscServer import DmxOscServer, Fixture
server = DmxOscServer()
server.add_fixtures(
Fixture(0, 0, 3, my_rgb_handler), # Register a 3 channel not array based Fixture at address 0 of universe 0
Fixture(0, 3, 3, my_rgb_handler, True), # Register a 3 channel array based Fixture at address 3 of universe 0
)
You can use the fixture.values property to see all the current values
@server.define_fixture(0, 0, 3)
def my_rgb_handler(fixture, address, *args):
print (fixture.values)
The handler
The handler receives a call when a message is received for that fixture
Arguments: (fixture, address, *args)
fixtureis the fixture, so you have a referenceaddressis the message address (it starts at the starting_address, so useaddress - fixture.starting_addrif you want to have the internal address)*argsare the args of the message. It is almost always 1 int going from 0 to 1, so you can just useargs[0]in your code and multiply it by your max value
The handler should never receive an address out of its address range, if the fixture is called correctly
More Documentation
More Documentation can be found at https://dmxoscserver.readthedocs.io/en/latest/
Release files for DmxOscServer 1.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| DmxOscServer-1.0.5.tar.gz | 4.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| DmxOscServer-1.0.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.4 kB
Release files / DmxOscServer-1.0.5.tar.gz
| Download URL | DmxOscServer-1.0.5.tar.gz |
|---|---|
| Size | 4.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6da7ac3be419719550692b51694a4cc1cc8a951cf18d90b247b4c8b90f27175a
|
|
BLAKE2b-256 checksum How to use checksums |
0b345356641d95ed6b7b860e45a9da5611f4b5e0ac823271b5a0e981a722fc5e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.7.3
|
Release files / DmxOscServer-1.0.5-py3-none-any.whl
| Download URL | DmxOscServer-1.0.5-py3-none-any.whl |
|---|---|
| Size | 5.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e302f480e17ab6bbefbc3df9db69784153f5b182af9a7d41515dd4ac3779a795
|
|
BLAKE2b-256 checksum How to use checksums |
c09af0b10206d6d44d707576d9932004098b9bc66e2b62b4e7f526e552a5aeb4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.7.3
|