All Projects → artfwo → pymonome

artfwo / pymonome

Licence: MIT License
python library for interacting with monome devices

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to pymonome

VCVRack-Holon.ist
Holon.ist Receiver for VCV Rack
Stars: ✭ 13 (-70.45%)
Mutual labels:  osc, opensoundcontrol
aiosc
Lightweight Open Sound Control implementation for Python using asyncio
Stars: ✭ 26 (-40.91%)
Mutual labels:  osc, opensoundcontrol
HandPose-OSC
Handtracking using MediaPipe HandPose. Runs as an Electron app and outputs OSC
Stars: ✭ 24 (-45.45%)
Mutual labels:  osc
UnityOpenSphericalCamera
OSC API v1.0 on Unity. Take a picture and Load the texture.
Stars: ✭ 21 (-52.27%)
Mutual labels:  osc
tidal-looper
Different looper variants for SuperDirt to provide live sampling in TidalCycles.
Stars: ✭ 55 (+25%)
Mutual labels:  osc
linux-show-player
Linux Show Player - Cue player designed for stage productions
Stars: ✭ 147 (+234.09%)
Mutual labels:  osc
osc-simulator
A utility to test Open Sound Control sending and receiving from the browser
Stars: ✭ 23 (-47.73%)
Mutual labels:  osc
OSCShark
OSC Shark is a tool for monitoring and analysing OSC (Open Sound Control) packets.
Stars: ✭ 24 (-45.45%)
Mutual labels:  osc
alive
experimental livecoding environment with persistent expressions
Stars: ✭ 29 (-34.09%)
Mutual labels:  osc
mediapipe-osc
MediaPipe examples which stream their detections over OSC.
Stars: ✭ 26 (-40.91%)
Mutual labels:  osc
MidiGyver
No description or website provided.
Stars: ✭ 67 (+52.27%)
Mutual labels:  osc
ofxPubSubOsc
bind OSC messages and values with only writing tiny codes on setup once.
Stars: ✭ 72 (+63.64%)
Mutual labels:  osc
monome-rack
VCV Rack plugin for monome Eurorack modules
Stars: ✭ 161 (+265.91%)
Mutual labels:  monome
HPlayer2
Modular Media Player for Raspberry Pi and more...
Stars: ✭ 28 (-36.36%)
Mutual labels:  osc
kivy service osc
simple UI/Service communication using osc on python-for-android
Stars: ✭ 53 (+20.45%)
Mutual labels:  osc
TinyPixelMapper
a Pixelmapping software for the ESP32 and ESP8266 for addressible LED Strips, with a OSC controll interface and FFT
Stars: ✭ 22 (-50%)
Mutual labels:  osc
SwingOSC
An OpenSoundControl (OSC) server to dynamically instantiate and control Java objects. Its main application is a GUI library for SuperCollider.
Stars: ✭ 22 (-50%)
Mutual labels:  osc
SketchSynth
A drawable OSC control panel
Stars: ✭ 46 (+4.55%)
Mutual labels:  osc
TouchOSC
A collection of examples and modules for TouchOSC MK2
Stars: ✭ 30 (-31.82%)
Mutual labels:  osc
browserglue
Exposes multiple OSC connections to the browser through WebSockets
Stars: ✭ 21 (-52.27%)
Mutual labels:  osc

pymonome

pymonome is a pure Python library for easy interaction with the monome family <https://monome.org> of devices. It supports grid and arc controllers (via serialosc) and provides additional facilities for developing grid- and arc-based applications.

Installation

pymonome requires at least Python 3.6. It can be installed using pip:

pip3 install pymonome

Or use the --user option to install pymonome to the current user library directory:

pip3 install --user pymonome

Basic usage

pymonome does not communicate with any of the devices directly. Like many monome applications, it relies on serialosc for device detection and hardware input and output. As serialosc provides OSC (UDP) ports for all the devices connected to the host system, it is possible to connect to a grid via a known UDP port as follows:

import monome

GRID_HOST = '127.0.0.1'
GRID_PORT = 16816

grid = monome.Grid()
await grid.connect(GRID_HOST, GRID_PORT)
grid.led_set(0, 0, 1)

Alternatively, it is possible to instantiate the protocol class using the loop.create_datagram_endpoint() event loop method:

transport, grid = await loop.create_datagram_endpoint(monome.Grid,
    remote_addr=(GRID_HOST, GRID_PORT))

Service discovery API

In practice UDP ports will be randomly assigned to devices as they are connected to the host computer. serialosc has a discovery and notification mechanism to notify clients about connected devices. It's possible to connect to the discovery service from pymonome too:

grid = monome.Grid()

def serialosc_device_added(id, type, port):
    print('connecting to {} ({})'.format(id, type))
    asyncio.ensure_future(grid.connect('127.0.0.1', port))

serialosc = monome.SerialOsc()
serialosc.device_added_event.add_handler(serialosc_device_added)

await serialosc.connect()

Application classes

For extra convenience pymonome provides base classes for developing grid and arc-based apps, apps on grid sections, or pages on the same grid. Application base classes provide handler stubs for input events and member properties for accessing controllers.

import asyncio
import monome

class HelloApp(monome.GridApp):
    def on_grid_key(self, x, y, s):
        self.grid.led_set(x, y, s)

async def main():
    loop = asyncio.get_running_loop()
    hello_app = HelloApp()

    def serialosc_device_added(id, type, port):
        print('connecting to {} ({})'.format(id, type))
        asyncio.ensure_future(hello_app.grid.connect('127.0.0.1', port))

    serialosc = monome.SerialOsc()
    serialosc.device_added_event.add_handler(serialosc_device_added)

    await serialosc.connect()
    await loop.create_future() # run forever

if __name__ == '__main__':
    asyncio.run(main())

In this example, HelloApp application instance will be connected to the latest discovered grid and pressing a button will light the corresponding LED.

More examples

For more examples see the examples/ directory.

License

Copyright (c) 2011-2021 Artem Popov <[email protected]>

pymonome 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].