Name | python-osc JSON |
Version |
1.9.0
JSON |
| download |
home_page | None |
Summary | Open Sound Control server and client implementations in pure Python |
upload_time | 2024-08-17 17:09:51 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.10 |
license | This is free and unencumbered software released into the public domain. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means. In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. For more information, please refer to <http://unlicense.org/> |
keywords |
osc
sound
midi
music
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
==========
python-osc
==========
Open Sound Control server and client implementations in **pure python**.
.. image:: https://github.com/attwad/python-osc/actions/workflows/python-test.yml/badge.svg
:target: https://github.com/attwad/python-osc/actions/workflows/python-test.yml
Current status
==============
This library was developed following the
`OpenSoundControl Specification 1.0 <https://opensoundcontrol.stanford.edu/spec-1_0.html>`_
and is currently in a stable state.
Features
========
* UDP blocking/threading/forking/asyncio server implementations
* UDP client
* int, int64, float, string, double, MIDI, timestamps, blob, nil 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
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.dispatcher 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], args[1](volume)))
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.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)
Raw data
{
"_id": null,
"home_page": null,
"name": "python-osc",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "osc, sound, midi, music",
"author": null,
"author_email": "attwad <tmusoft@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/2f/c9/d529263be224e4e093f4f5903025c0014a3e8a35505d15d82660378b31ef/python_osc-1.9.0.tar.gz",
"platform": null,
"description": "==========\npython-osc\n==========\n\nOpen Sound Control server and client implementations in **pure python**.\n\n.. image:: https://github.com/attwad/python-osc/actions/workflows/python-test.yml/badge.svg\n :target: https://github.com/attwad/python-osc/actions/workflows/python-test.yml\n\n\nCurrent status\n==============\n\nThis library was developed following the\n`OpenSoundControl Specification 1.0 <https://opensoundcontrol.stanford.edu/spec-1_0.html>`_\nand is currently in a stable state.\n\nFeatures\n========\n\n* UDP blocking/threading/forking/asyncio server implementations\n* UDP client\n* int, int64, float, string, double, MIDI, timestamps, blob, nil OSC arguments\n* simple OSC address<->callback matching system\n* extensive unit test coverage\n* basic client and server examples\n\nDocumentation\n=============\n\nAvailable at https://python-osc.readthedocs.io/.\n\nInstallation\n============\n\npython-osc is a pure python library that has no external dependencies,\nto install it just use pip (prefered):\n\n.. image:: https://img.shields.io/pypi/v/python-osc.svg\n :target: https://pypi.python.org/pypi/python-osc\n\n.. code-block:: bash\n\n $ pip install python-osc\n\nExamples\n========\n\nSimple client\n-------------\n\n.. code-block:: python\n\n \"\"\"Small example OSC client\n\n This program sends 10 random values between 0.0 and 1.0 to the /filter address,\n waiting for 1 seconds between each value.\n \"\"\"\n import argparse\n import random\n import time\n\n from pythonosc import udp_client\n\n\n if __name__ == \"__main__\":\n parser = argparse.ArgumentParser()\n parser.add_argument(\"--ip\", default=\"127.0.0.1\",\n help=\"The ip of the OSC server\")\n parser.add_argument(\"--port\", type=int, default=5005,\n help=\"The port the OSC server is listening on\")\n args = parser.parse_args()\n\n client = udp_client.SimpleUDPClient(args.ip, args.port)\n\n for x in range(10):\n client.send_message(\"/filter\", random.random())\n time.sleep(1)\n\nSimple server\n-------------\n\n.. code-block:: python\n\n \"\"\"Small example OSC server\n\n This program listens to several addresses, and prints some information about\n received packets.\n \"\"\"\n import argparse\n import math\n\n from pythonosc.dispatcher import Dispatcher\n from pythonosc import osc_server\n\n def print_volume_handler(unused_addr, args, volume):\n print(\"[{0}] ~ {1}\".format(args[0], volume))\n\n def print_compute_handler(unused_addr, args, volume):\n try:\n print(\"[{0}] ~ {1}\".format(args[0], args[1](volume)))\n except ValueError: pass\n\n if __name__ == \"__main__\":\n parser = argparse.ArgumentParser()\n parser.add_argument(\"--ip\",\n default=\"127.0.0.1\", help=\"The ip to listen on\")\n parser.add_argument(\"--port\",\n type=int, default=5005, help=\"The port to listen on\")\n args = parser.parse_args()\n\n dispatcher = Dispatcher()\n dispatcher.map(\"/filter\", print)\n dispatcher.map(\"/volume\", print_volume_handler, \"Volume\")\n dispatcher.map(\"/logvolume\", print_compute_handler, \"Log volume\", math.log)\n\n server = osc_server.ThreadingOSCUDPServer(\n (args.ip, args.port), dispatcher)\n print(\"Serving on {}\".format(server.server_address))\n server.serve_forever()\n\nBuilding bundles\n----------------\n\n.. code-block:: python\n\n from pythonosc import osc_bundle_builder\n from pythonosc import osc_message_builder\n\n bundle = osc_bundle_builder.OscBundleBuilder(\n osc_bundle_builder.IMMEDIATELY)\n msg = osc_message_builder.OscMessageBuilder(address=\"/SYNC\")\n msg.add_arg(4.0)\n # Add 4 messages in the bundle, each with more arguments.\n bundle.add_content(msg.build())\n msg.add_arg(2)\n bundle.add_content(msg.build())\n msg.add_arg(\"value\")\n bundle.add_content(msg.build())\n msg.add_arg(b\"\\x01\\x02\\x03\")\n bundle.add_content(msg.build())\n\n sub_bundle = bundle.build()\n # Now add the same bundle inside itself.\n bundle.add_content(sub_bundle)\n # The bundle has 5 elements in total now.\n\n bundle = bundle.build()\n # You can now send it via a client as described in other examples.\n\nLicense?\n========\nUnlicensed, do what you want with it. (http://unlicense.org)\n",
"bugtrack_url": null,
"license": "This is free and unencumbered software released into the public domain. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means. In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. For more information, please refer to <http://unlicense.org/> ",
"summary": "Open Sound Control server and client implementations in pure Python",
"version": "1.9.0",
"project_urls": {
"Repository": "https://github.com/attwad/python-osc"
},
"split_keywords": [
"osc",
" sound",
" midi",
" music"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "2b91435d6a132c120136bcae4a6f3017c312acbbe41f31dc48568e9210928956",
"md5": "b261b79e6574ff03d914b8138c60f7ab",
"sha256": "4b16d8c4ae6a8a291037b2216a188d8654a4babe721387b8a37f89470b0c82c1"
},
"downloads": -1,
"filename": "python_osc-1.9.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b261b79e6574ff03d914b8138c60f7ab",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 43659,
"upload_time": "2024-08-17T17:09:50",
"upload_time_iso_8601": "2024-08-17T17:09:50.248557Z",
"url": "https://files.pythonhosted.org/packages/2b/91/435d6a132c120136bcae4a6f3017c312acbbe41f31dc48568e9210928956/python_osc-1.9.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "2fc9d529263be224e4e093f4f5903025c0014a3e8a35505d15d82660378b31ef",
"md5": "9c343b61f6ecef1797ab3a46fcf4b6d4",
"sha256": "ab50f66b1a19efd5bff722f26ab6450df19cdd84ba868f08c9a33e7c78514456"
},
"downloads": -1,
"filename": "python_osc-1.9.0.tar.gz",
"has_sig": false,
"md5_digest": "9c343b61f6ecef1797ab3a46fcf4b6d4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 33027,
"upload_time": "2024-08-17T17:09:51",
"upload_time_iso_8601": "2024-08-17T17:09:51.741735Z",
"url": "https://files.pythonhosted.org/packages/2f/c9/d529263be224e4e093f4f5903025c0014a3e8a35505d15d82660378b31ef/python_osc-1.9.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-17 17:09:51",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "attwad",
"github_project": "python-osc",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "python-osc"
}