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()
# Register a 3 channel Fixture at address 0 at universe 0 which will execute my_rgb_handler when called
@server.new_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.1.tar.gz
.
File metadata
- Download URL: DmxOscServer-1.0.1.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 | fa7780ad39c295a57cb4682253457352db3530c79f5b280ed4325e4bfcbd2efc |
|
MD5 | 5f8074ee58f8e0be8502d0ec5befaab6 |
|
BLAKE2b-256 | 0b0f72b368e6fede83ca86a6fb553453ec07cf7c814d023a5db9fc225cfaf1f1 |
File details
Details for the file DmxOscServer-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: DmxOscServer-1.0.1-py3-none-any.whl
- Upload date:
- Size: 4.2 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 | 063742d0e04bd56a08924c7787a976f67814318ea09b6020ac4ba615db874e00 |
|
MD5 | 64cf993d9cb08d65ff6c37f593a92d55 |
|
BLAKE2b-256 | f9459c5839d0fe927cf9babd472c6091decf302420a58ed8db61f0641631f4f9 |