All Projects → artfwo → aiosc

artfwo / aiosc

Licence: MIT license
Lightweight Open Sound Control implementation for Python using asyncio

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to aiosc

VCVRack-Holon.ist
Holon.ist Receiver for VCV Rack
Stars: ✭ 13 (-50%)
Mutual labels:  osc, opensoundcontrol
pymonome
python library for interacting with monome devices
Stars: ✭ 44 (+69.23%)
Mutual labels:  osc, opensoundcontrol
yutto
🧊 一个可爱且任性的 B 站视频下载器(bilili V2)
Stars: ✭ 383 (+1373.08%)
Mutual labels:  asyncio
pytest-aiohttp
pytest plugin for aiohttp support
Stars: ✭ 110 (+323.08%)
Mutual labels:  asyncio
HibiAPI
一个实现了多种常用站点的易用化API的程序 / A program that implements easy-to-use APIs for a variety of commonly used sites.
Stars: ✭ 427 (+1542.31%)
Mutual labels:  asyncio
sniffio
Sniff out which async library your code is running under
Stars: ✭ 75 (+188.46%)
Mutual labels:  asyncio
timvt
PostGIS based Vector Tile server.
Stars: ✭ 113 (+334.62%)
Mutual labels:  asyncio
trellio
Python3 asyncio based microframework for microservice architecture
Stars: ✭ 19 (-26.92%)
Mutual labels:  asyncio
duckpy
A simple Python library for searching on DuckDuckGo.
Stars: ✭ 20 (-23.08%)
Mutual labels:  asyncio
eventkit
Event-driven data pipelines
Stars: ✭ 94 (+261.54%)
Mutual labels:  asyncio
hikari
A Discord API wrapper for Python and asyncio built on good intentions.
Stars: ✭ 631 (+2326.92%)
Mutual labels:  asyncio
async retrial
Python package for retrial of asyncio based coroutines
Stars: ✭ 14 (-46.15%)
Mutual labels:  asyncio
linux-show-player
Linux Show Player - Cue player designed for stage productions
Stars: ✭ 147 (+465.38%)
Mutual labels:  osc
triviaroyale
Trivia game in the browser using websockets and asyncio.
Stars: ✭ 13 (-50%)
Mutual labels:  asyncio
aiotinydb
asyncio compatibility shim for tinydb
Stars: ✭ 42 (+61.54%)
Mutual labels:  asyncio
bolsa
Biblioteca feita em Python com o objetivo de facilitar o acesso a dados de seus investimentos na bolsa de valores(B3/CEI) através do Portal CEI.
Stars: ✭ 46 (+76.92%)
Mutual labels:  asyncio
knxmap
KNXnet/IP scanning and auditing tool for KNX home automation installations.
Stars: ✭ 97 (+273.08%)
Mutual labels:  asyncio
antirobot aiogram
Телеграм бот для блокировки спама
Stars: ✭ 26 (+0%)
Mutual labels:  asyncio
thanker
Don't be a wanker, be a thanker! Automatically give thanks to Pypi packages you use in your project.
Stars: ✭ 25 (-3.85%)
Mutual labels:  asyncio
python-logi-circle
Python 3.6+ API for Logi Circle cameras
Stars: ✭ 23 (-11.54%)
Mutual labels:  asyncio

aiosc

aiosc is a minimalistic Open Sound Control (OSC) communication module which uses asyncio for network operations and is compatible with the asyncio event loop.

Installation

aiosc requires at least Python 3.7. It can be installed using pip:

pip3 install aiosc

Or use --user option to install aiosc locally:

pip3 install --user aiosc

Usage

To send an OSC message just use aiosc.send:

import asyncio
import aiosc

async def main():
    await aiosc.send(('127.0.0.1', 9000), '/hello', 'world')

asyncio.run(main())

To implement an OSC server with aiosc you should create an UDP endpoint using aiosc.OSCProtocol as the protocol. OSCProtocol can be subclassed or directly constructed with a dictionary mapping OSC address patterns to handler methods for incoming messages:

class EchoServer(aiosc.OSCProtocol):
    def __init__(self):
        super().__init__(handlers={
            '/sys/exit': lambda addr, path, *args: sys.exit(0),
            '//*': self.echo,
        })

    def echo(self, addr, path, *args):
        print("incoming message from {}: {} {}".format(addr, path, args))

async def main():
    loop = asyncio.get_running_loop()
    transport, protocol = await loop.create_datagram_endpoint(EchoServer,
        local_addr=('127.0.0.1', 9000))

    await loop.create_future()

asyncio.run(main())

For more examples, see examples/.

OSC address patterns

aiosc dispatches messages to handler methods using glob-style address pattern matching as described in the OSC 1.0 specification. The // operator from OSC 1.1 preliminary specification is also supported.

Examples:

  • /hello/world matches /hello/world.
  • /hello/* matches /hello/world and /hello/sarah.
  • /{hello,goodbye}//world matches /hello/world and /goodbye/cruel/world.
  • //* matches any address.

Notes

Bundles are not yet supported.

OSC data types are picked from the preliminary spec documented in Features and Future of Open Sound Control version 1.1 for NIME paper. For example, I typetag is decoded to Impulse (aka "bang") which is passed around as aiosc.Impulse singleton.

Suggestions, bug reports, issues and/or pull requests are, of course, welcome.

License

Copyright (c) 2014 Artem Popov <[email protected]>

aiosc is licensed under the MIT license, please see LICENSE file for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].