All Projects → attwad → Python Osc

attwad / Python Osc

Licence: unlicense
Open Sound Control server and client in pure python

Programming Languages

python
139335 projects - #7 most used programming language

Labels

Projects that are alternatives of or similar to Python Osc

framework
A creative coding library.
Stars: ✭ 35 (-87.23%)
Mutual labels:  osc, sound
linux-show-player
Linux Show Player - Cue player designed for stage productions
Stars: ✭ 147 (-46.35%)
Mutual labels:  osc, sound
TouchOSC
A collection of examples and modules for TouchOSC MK2
Stars: ✭ 30 (-89.05%)
Mutual labels:  osc
morse-pro
Library for manipulating Morse code text and sound. Understands prosigns and Farnsworth speed. Can create WAV files and analyse input from the microphone or audio files.
Stars: ✭ 85 (-68.98%)
Mutual labels:  sound
CodeChampion
Plays epic sound clips when you write epic code on sublime Text!
Stars: ✭ 30 (-89.05%)
Mutual labels:  sound
sonipy
Sonification tool for turning scatter plots into perceptually uniform sound files for science and science access.
Stars: ✭ 20 (-92.7%)
Mutual labels:  sound
MrPlayer
This is Mp3 Player made on python
Stars: ✭ 23 (-91.61%)
Mutual labels:  sound
timbre painting
Hierarchical fast and high-fidelity audio generation
Stars: ✭ 67 (-75.55%)
Mutual labels:  sound
catnip
terminal audio visualizer for linux/unix/macOS/windblows*
Stars: ✭ 79 (-71.17%)
Mutual labels:  sound
WoodenBeaver
The WoodenBeaver sound theme
Stars: ✭ 18 (-93.43%)
Mutual labels:  sound
XPS-17-9700-Ubuntu-Soundfix
A simple script to install the necessary firmware to fix sound output (dummy sound).
Stars: ✭ 19 (-93.07%)
Mutual labels:  sound
denver.lua
a simple library to help you play custom waveforms with LÖVE
Stars: ✭ 66 (-75.91%)
Mutual labels:  sound
sound field analysis-py
Analyze, visualize and process sound field data recorded by spherical microphone arrays.
Stars: ✭ 61 (-77.74%)
Mutual labels:  sound
fmod-gdnative
FMOD Studio integration and bindings for the Godot game engine
Stars: ✭ 102 (-62.77%)
Mutual labels:  sound
bg-sound
Web Component to emulate the old-school <bgsound> HTML element
Stars: ✭ 93 (-66.06%)
Mutual labels:  sound
pydiogment
📣 Python library for audio augmentation
Stars: ✭ 64 (-76.64%)
Mutual labels:  sound
SoundProcesses
A computer music framework to describe, create and manage sound processes in the Scala programming language. Issue tracker: https://codeberg.org/sciss/SoundProcesses/issues
Stars: ✭ 29 (-89.42%)
Mutual labels:  sound
pymonome
python library for interacting with monome devices
Stars: ✭ 44 (-83.94%)
Mutual labels:  osc
Ofxpdsp
openFrameworks addon for audio synthesis and generative music
Stars: ✭ 255 (-6.93%)
Mutual labels:  sound
Modiy
Modiy is an open-source hardware interface for modular synthesis.
Stars: ✭ 21 (-92.34%)
Mutual labels:  sound

========== python-osc

Open Sound Control server and client implementations in pure python (3.5+).

.. image:: https://travis-ci.org/attwad/python-osc.svg?branch=master :target: https://travis-ci.org/attwad/python-osc

Current status

This library was developped following the specifications at http://opensoundcontrol.org/spec-1_0 and is currently in a stable state.

Features

  • UDP blocking/threading/forking/asyncio server implementations
  • UDP client
  • int, float, string, double, MIDI, timestamps, blob OSC arguments
  • simple OSC address<->callback matching system
  • extensive unit test coverage
  • basic client and server examples

Documentation

Available at https://python-osc.readthedocs.io/.

Installation

python-osc is a pure python library that has no external dependencies, to install it just use pip (prefered):

.. image:: https://img.shields.io/pypi/v/python-osc.svg :target: https://pypi.python.org/pypi/python-osc

.. code-block:: bash

$ pip install python-osc

or from the raw sources for the development version:

.. code-block:: bash

$ python setup.py test
$ python setup.py install

Examples

Simple client

.. code-block:: python

"""Small example OSC client

This program sends 10 random values between 0.0 and 1.0 to the /filter address, waiting for 1 seconds between each value. """ import argparse import random import time

from pythonosc import udp_client

if name == "main": parser = argparse.ArgumentParser() parser.add_argument("--ip", default="127.0.0.1", help="The ip of the OSC server") parser.add_argument("--port", type=int, default=5005, help="The port the OSC server is listening on") args = parser.parse_args()

client = udp_client.SimpleUDPClient(args.ip, args.port)

for x in range(10):
  client.send_message("/filter", random.random())
  time.sleep(1)

Simple server

.. code-block:: python

"""Small example OSC server

This program listens to several addresses, and prints some information about received packets. """ import argparse import math

from pythonosc import dispatcher from pythonosc import osc_server

def print_volume_handler(unused_addr, args, volume): print("[{0}] ~ {1}".format(args[0], volume))

def print_compute_handler(unused_addr, args, volume): try: print("[{0}] ~ {1}".format(args[0], args1)) except ValueError: pass

if name == "main": parser = argparse.ArgumentParser() parser.add_argument("--ip", default="127.0.0.1", help="The ip to listen on") parser.add_argument("--port", type=int, default=5005, help="The port to listen on") args = parser.parse_args()

dispatcher = dispatcher.Dispatcher()
dispatcher.map("/filter", print)
dispatcher.map("/volume", print_volume_handler, "Volume")
dispatcher.map("/logvolume", print_compute_handler, "Log volume", math.log)

server = osc_server.ThreadingOSCUDPServer(
    (args.ip, args.port), dispatcher)
print("Serving on {}".format(server.server_address))
server.serve_forever()

Building bundles

.. code-block:: python

from pythonosc import osc_bundle_builder
from pythonosc import osc_message_builder

bundle = osc_bundle_builder.OscBundleBuilder(
    osc_bundle_builder.IMMEDIATELY)
msg = osc_message_builder.OscMessageBuilder(address="/SYNC")
msg.add_arg(4.0)
# Add 4 messages in the bundle, each with more arguments.
bundle.add_content(msg.build())
msg.add_arg(2)
bundle.add_content(msg.build())
msg.add_arg("value")
bundle.add_content(msg.build())
msg.add_arg(b"\x01\x02\x03")
bundle.add_content(msg.build())

sub_bundle = bundle.build()
# Now add the same bundle inside itself.
bundle.add_content(sub_bundle)
# The bundle has 5 elements in total now.

bundle = bundle.build()
# You can now send it via a client as described in other examples.

License?

Unlicensed, do what you want with it. (http://unlicense.org)

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