A Python Lib to create a DMX compatible OSC server with handlers
Project description
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.
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):
fixture.values[address] = args[0]
print (fixture.values)
server.run()
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
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):
fixture.values[address] = args[0]
print (fixture.values)
server = DmxOscServer()
server.add_fixture(Fixture(0, 0, 3, my_rgb_handler)) # Register a 3 channel 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 Fixture at address 0 of universe 0
Fixture(0, 3, 3, my_rgb_handler), # Register a 3 channel Fixture at address 3 of universe 0
)
More Documentation
More Documentation can be found at https://dmxoscserver.readthedocs.io/en/latest/
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file DmxOscServer-1.0.2.tar.gz
.
File metadata
- Download URL: DmxOscServer-1.0.2.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 21c6838737d0ad9086681b92b32f7c9b0ad1dbd20d4b433c352091cb8c49c25e |
|
MD5 | 67066e0331d8add89f41b8d6490fd67f |
|
BLAKE2b-256 | d8e7738fda4b339f325ee7bfbc3141cd38ed6d72cec530f4bf4fb11a89c69215 |
File details
Details for the file DmxOscServer-1.0.2-py3-none-any.whl
.
File metadata
- Download URL: DmxOscServer-1.0.2-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33171c055fdcb6e5a5256f26fa05cf834aa708b4c8abc7e3440489c76f6f2e1b |
|
MD5 | 86379d2e37be73ac990c6bb203dbdb50 |
|
BLAKE2b-256 | f4223a4445a7be07d6be9eaf235238c496bfd35c6d16c3c7962190c00428a9ea |