GithubHelp home page GithubHelp logo

pyssc's Introduction

pyssc

A Sennheiser Sound Control Protocol (SSC) Client Implementation for Python

Introduction

The Sennheiser Sound Control Protocol is a specific adaption of Open Sound Control. Pyssc is a simple client implementation that allows users to discover SSC Devices in their networks and subsequently communicate with those Devices via SSC.

Installation

Pyssc is published to pypi.org/pyssc.

pip install pyssc

Usage

Initially you will have to find out the IP Addresses of your SSC Devices. If you don't know them you can try and find them using zeroconf.

import pyssc as ssc
found_setup = ssc.scan()

When you know all the IPs you can store the setup as a JSON file.

found_setup.to_json('setup.json')

Here's an example setup JSON:

{
    "Device 1": "fe80::2a36:38ff:fe60:7515",
    "Device 2": "fe80::2a36:38ff:fe60:784f",
}

Once you have defined your setups as a JSON you don't need to scan anymore. Simply import your setup at the beginning of your session.

found_setup = ssc.Ssc_device_setup()
found_setup.from_json('setup.json')

Now you can send and receive SSC either to and from a single device

device_1 = found_setup.ssc_devices[0]
ssc_transaction = device_1.send_ssc('{"audio":{"out":{"mute":true}}}')

or the whole setup.

found_setup.send_all('{"audio":{"out":{"mute":true}}}')

Please note that Unix systems require you to specify the network interface. The default value here is "%eth0". On Windows you can specify an empty String as the Value for "interface".

ssc_transaction = device_1.send_ssc('{"audio":{"out":{"mute":true}}}', interface = "")

To find out which commands work for your specific SSC Device please refer to the SSC Documentation.

pyssc's People

Contributors

jj-wohlgemuth avatar schwinn avatar

Stargazers

Edon avatar  avatar Frédéric Larochelle avatar  avatar Matt Dale avatar  avatar Aiden Garrett avatar  avatar sparklinfish avatar Max avatar Ben avatar Charlie Brown avatar Lasse Broer avatar

Watchers

James Cloos avatar Max avatar Chris Hold avatar  avatar  avatar

pyssc's Issues

Demo commands not working

I tried exactly according doc first 4 lines on Windows 10, Python 3.11, Idle. Problem on set_transaction:

import pyssc as ssc
found_setup = ssc.scan()
device_1 = found_setup.ssc_devices[0]
ssc_transaction = device_1.send_ssc('{"audio":{"out":{"mute":false}}}')

WARNING:root:socket connection closed. Reopening. 'NoneType' object has no attribute 'sendto'
Traceback (most recent call last):
File "C:\Python\P311\Lib\site-packages\pyssc\ssc_device.py", line 43, in send_ssc
self.socket.sendto(request_raw, (self.ip + interface, self.port))
AttributeError: 'NoneType' object has no attribute 'sendto'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "<pyshell#9>", line 1, in
ssc_transaction = device_1.send_ssc('{"audio":{"out":{"mute":false}}}')
File "C:\Python\P311\Lib\site-packages\pyssc\ssc_device.py", line 46, in send_ssc
self.connect()
File "C:\Python\P311\Lib\site-packages\pyssc\ssc_device.py", line 28, in connect
self.socket = socket.create_connection((self.ip + interface, port))
File "C:\Python\P311\Lib\socket.py", line 826, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
File "C:\Python\P311\Lib\socket.py", line 961, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11001] getaddrinfo failed

Buffersize too small

Hi,

thanks for providing this library. I had a problem were the buffersize in the ssc_device.py was too small. If a query with a long answer is performed, parts of the answer will be returned in the answer of further queries. This was the case for me with queries to /osc/schema. Changing the buffersize to 512 solved the problem.

    def send_ssc(self,
                 command: str,
                 interface: str = "%eth0",
                 buffersize: int = 512,
                 wait_time_seconds: float = .001,
                 port: int = 45):
        self.port = port

I have published a small tool with which I can query my Neumann KH 80 loudspeakers.

Thanks,
Thorsten

GUI

Hi, I have some ideas for future pyssc GUI as discussed in ASR. Take it only as first ideas for discussion.

  1. Should be as simple as possible at least in the beginning.
  2. Best would be all parameters and actions accessible from one screen if it will fit.
  3. Should be created not only for stereo or 2.1, but also for more monitors (I use currently 4.1), maybe something like matrix table: columns - array of monitors, rows - list of parameters, maybe also column like Set parameter to all monitors for some parameters where it has sense and button Send this parameter or button row Send all parameters to this monitor. Loops thru monitor or parameter arrays.
  4. Parameter can be added to the list once function for it is in test or developed. 1-3 parameters are enough for initial GUI testing.
  5. If the window would be expandable according number of rows/columns - nice feature for future.
  6. Parameters logically grouped/ordered according their sense.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.