Skip to main content

Module to get basic information from Behringer digital mixers eg X32/XAir etc.

Project description

behringer-mixer

Python module to get basic information from Behringer digital mixers eg X32/XAir etc.

Initial inspiration (and some code) comes from https://github.com/onyx-and-iris/xair-api-python.

What it does and what is doesn't do.

This module is a simple interface to a series of Behringer digital mixers. It does NOT support all parameters or controls. It is primarily focussed on getting and setting fader information. It supports getting this information, both on a once off basis and subscribing for real-time updates.

It currently supports the following functionality for all channels/busses/matrices/dcas/main/lr:

  • Fader Value (float and dB) [get/set]
  • Fader Mute status(float and dB) [get/set]
  • Fader Name (float and dB) [get]

It also supports

  • Current scene/snapshot [get]
  • Change scene/snapshot [set]

If you want a module that allows you to control the full functionality of the mixer, eg configuring effects/eq etc then I would recommend checking out https://github.com/onyx-and-iris/xair-api-python instead.

Prerequisites

  • Python 3.10 or greater

Usage

Example

from behringer_mixer import mixer_api

def updates_function(data):
    print(f"The property {data.property} has been set to {data.value}")

def main():
    with mixer_api.connect("X32", ip="192.168.201.149") as mixer:
        state = mixer.state()
        print(state)
        mixer.subscribe(updates_function)
        mixer.set_value("/ch/1/mix_fader", 0)

if __name__ == "__main__":
    main()

Property Keys

The data returned by both the state and subscription callback function is based on a number of property keys for the mixer. While these keys are 'similar' to the values used in the OSC commands they are not always the same.

Each key is a mixture of a base 'group' key eg /ch/1/ and a more specific key.
They keys have also been altered slightly to maintain a consistent approach between different mixers. eg. For channel/bus numbers the leading zero has been removed. on the XAir mixers the main fader is /main/lr whereas on the X32 it is /main/st. This modules returns both as /main/st.

mixer_api.connect("<mixer_type>", ip="<ip_address>")

The code is written to support the following mixer types:

  • X32
  • XR18
  • XR16
  • XR12 (I currently only have access to an X32.)

The following keyword arguments may be passed:

  • ip: ip address of the mixer
  • port: mixer port, defaults to 10023 for x32 and 10024 for xair
  • delay: a delay between each command, defaults to 20ms.
    • a note about delay, stability may rely on network connection. For wired connections the delay can be safely reduced.

On connection, the function requests the current state of the appropriate faders from the mixer. This results in a number of OSC messages being sent. If you have problems receiving all this data, then tweaking the delay setting may be appropriate.

mixer.state()

Returns the current state of the mixer as a dictionary of values

{
	'/ch/1/mix_fader': 0.75,
	'/ch/1/mix_fader_db': 0.0,
    ...
	'/ch/1/mix_on': False,
	'/ch/2/mix_on': False,
	'/ch/1/config_name': 'VOX 1',
	...
	'/bus/1/mix_fader': 0.37829911708831787,
	'/bus/1/mix_fader_db': -19.7,
	...
	'/bus/4/mix_on': True,
	...
	'/bus/2/config_name': '',
	...
	'/dca/3/config_name': 'Drums',
	...
	'/main/st/mix_fader': 0.7497556209564209,
	'/main/st/mix_fader_db': -0.0,
	'/main/st/mix_on': True,
	...
	'/scene/current': 6
}

mixer.reload()

Causes the the mixer to be requeried for it's current state. This only updates the modules internal state. You would then need to call mixer.state() to receive the updated state.

mixer.subscribe(callback_function)

This registered a callback_function that is called whenever there is a change at the mixer on one of the monitored properties. The callback function must receive one dictionary parameter that contains the data that has been updated. The content of this data paramter is as follows

{ 
    'property': '/ch/01/mix_fader',
    'value': 0.85
}

Updates will automatically be stopped when the code passes outside the with context.

mixer.set_value(address, value)

Tells the mixer to update a particular field parameter to the value specified. address should be in the format returned by the mixer.state() call. `value should be in a format appropriate to the address being used. The module does no checking on the appropriateness of the value. This call also updates the internal state of the module.

mixer.load_scene(scene_number)

Changes the current/scene snapshot of the mixer. scene_number is the index

mixer.send(address, value) (Low Level Call)

This is a low level call to send an OSC message to the mixer. As this is a low level call, the address of the OSC message being sent would have to conform to that required by the mixer in its documenation, no changing of the address is performed. This call does not update the internal state

mixer.query(address) (Low Level Call)

This is a low level call and returns the response of a previous send call.

Tests

These tests attempt to connect to a mixer to exercise get/set from the channels. The tests will change the state of the mixer, so it is recommended you save the current settings before running. It is also recommended that any amplifier is turned off as feedback could occur if signals are present on the channels.

To run all tests:

pytest -v.

License

This project is licensed under the MIT License - see the LICENSE file for details

Documentation

XAir OSC Commands

X32 OSC Commands

Special Thanks

Onyx-and-Iris for writing the XAir Python module

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

behringer_mixer-0.0.1.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

behringer_mixer-0.0.1-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file behringer_mixer-0.0.1.tar.gz.

File metadata

  • Download URL: behringer_mixer-0.0.1.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.10.12 Linux/6.2.0-32-generic

File hashes

Hashes for behringer_mixer-0.0.1.tar.gz
Algorithm Hash digest
SHA256 fa88cba6e41994febfc2d3a09e17c1658177421b42ae22b65cfe1b39cd2f06d7
MD5 447f965604ac7d2077c13714baa4791e
BLAKE2b-256 5aa19d5d61898648fdb0ee9b01a284515bd1331416b993b78f5bfe0c1bd287cc

See more details on using hashes here.

File details

Details for the file behringer_mixer-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: behringer_mixer-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.10.12 Linux/6.2.0-32-generic

File hashes

Hashes for behringer_mixer-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 178d6dfabae8d5fdb2f8882ddd84e0a9cacdfab37589ee8ddd61cac57901d199
MD5 c35027fc2aaf401c793fb2f2fdd233c7
BLAKE2b-256 ac9ca83932a2d9e34c11c8263c2771d6365685ebab2c433268837d07cc310085

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page