A minimal OSC client and server library for MicroPython.
  • Python 98.2%
  • Shell 1.8%
Find a file
Christopher Arndt 043e0e2151 docs: link to micropython-st-lib repo for encoder library
Signed-off-by: Christopher Arndt <chris@chrisarndt.de>
2022-10-16 17:38:34 +02:00
examples docs: link to micropython-st-lib repo for encoder library 2022-10-16 17:38:34 +02:00
tests fix: failing tests due to insufficient float precision 2022-09-28 03:17:41 +02:00
uosc fix: code in comment showing how to get NTP epoch delta using datetime 2022-10-16 17:38:34 +02:00
.gitignore Ignore '.cache' dir 2019-04-10 13:28:15 +02:00
README.md feat: refactor server module 2022-09-28 02:08:51 +02:00
run_async_server.sh feat: refactor server module 2022-09-28 02:08:51 +02:00
run_server.sh feat: refactor server module 2022-09-28 02:08:51 +02:00
run_tests.sh feat: refactor server module 2022-09-28 02:08:51 +02:00
setup.cfg Add flake8 configuration and fix one of its complaints by explicitly importing the needed names from 2016-09-05 00:11:23 +02:00

Micropython-OSC

Micropython-osc (aka uosc) is a minimal Open Sound Control (OSC) client and server library for MicroPython and CPython 2 or 3.

Status / Supported Boards

It should work on the Unix, stm32 (Pyboard) and esp8266 port of MicroPython and under CPython 2.7 and 3.3+. Since OSC is a protocol commonly using an IP network and UDP or TCP packets as a transport, the main requirement is a working and compatible socket module. Currently this module only supports UDP as the transport.

The server code so far has only been tested under the Unix port and CPython 2 and 3, but the client portion has been confirmed to work on a ESP-8266 board running MicroPython 1.8.x.

Usage

Here's a minmal usage example for the client. Further documentation is currently only available by looking at the docstrings and the source code (the whole package has a total LLOC of < 400).

from uosc.client import Bundle, Client, create_message

osc = Client('192.168.4.2', 9001)
osc.send('/controls/frobnicator', 42, 3.1419, "spamm")
b = Bundle()
b.add(create_message("/foo", bar))
b.add(create_message("/spamm", 12345))
osc.send(b)

Examples

The examples directory contains some simple example scripts using this library to implement special OSC clients or simple OSC UDP servers.

To use the server examples with the unix port of MicroPython, the following required modules from the micropython-lib are included in this directory:

  • argparse
  • ffilib

Either use the provided shell wrappers to run the server examples or install these two modules to ~/.micropython/lib.