Monday, May 6, 2013

Programming with Pure Data and Open Sound Control for the Behringer X32

Pure Data is an easy graphical programming environment. It can speak the OSC (Open Sound Control) protocol, so you can write programs to communicate with Behringer X32 digital mixers using their published X32 OSC Remote Protocol. Don't worry, it's easier than it sounds.


1. Download Pure Data Extended (which includes things that we'll need).
2. Unzip and/or install it.
3. Run the program Pd-extended.
4. If you're using Windows, it will likely ask you if you want to allow it to communicate on the network. Click Allow access and input your Administrator password if necessary.


5. In the window that pops up, choose New under the File menu.

6. You now have a blank canvas to put commands, controls, and such on to.

7. Under the Put menu choose Object (or hold the Ctrl key and press 1).
8. In the newly-created object type  import mrpeach  to tell it that you need to use that package.

9.  Under the Put menu choose Message and type in it  connect x.x.x.x 10023  but replace the x values with the IP address of your X32 mixer. For testing purposes you can have it connect to localhost (the computer that you're sitting at) instead.
10. Create a  disconnect  message and a  udpsend  object as well.
11. Drag from the bottom left corner of each of those messages to the top left corner of the udpsend object in order to connect their outputs to the udpsend input.

12. Now everything is set up to communicate, but we need to actually compose some messages to send. To start let's set up a fader to control a channel level, and a button (toggle) to control the mute for that channel. Under the Put menu choose Vslider to place a vertical slider and Toggle to place your mute button.

13. Put messages for sending mute on/off and fader levels for a particular channel following the X32 OSC specifications. For example,  send /ch/01/mix/on $1  will take the input value ($1) to send the message  /ch/01/mix/on 0  to mute channel one or  /ch/01/mix/on 1  to unmute it.

14. You'll also need to put in a  packOSC  object to create the OSC messages, and connect its output to the  udpsend  object.

15. One last thing you'll need to do is change the Vslider's properties to output values from 0 to 1 as the X32 expects. Right-click the Vslider, choose Properties and change the top value to 1 instead of 127. You can also change the size and color here if you'd like.

16. Your program is now all set up. To run it, go to the Edit menu and choose Edit Mode (to turn off the edit mode) or hold the Ctrl key and press the e key. Once the program is running, click on one of your connect messages to connect to the X32, then drag the slider and click the toggle to see their effects.

Optional: If you'd like to test without connecting to the X32, create another Pure Data program by choosing New under the File menu and make it look something like the following. Remember that the Vslider range should be 0 to 1.

When your new OSC receiving program is running (not in edit mode), you should be able to click connect localhost 10023 in your original program and then see that the slider and toggle there will affect the corresponding ones in your new program.

Hopefully that's enough to get your started in writing Pure Data programs for you X32 digital mixer.

7 comments:

RAR said...

Can I ask how the volume data from 0 to 1 instead of 1 to 127 like in midi.. Works? I suppose I can see how db correspond mapped from 1 to 127.. How do they map from 0 to 1?

David Hay said...

@RAR The mapping from 0 to 1 corresponds to the fader position for that channel, 0 being the bottom, 1 being the top.

Jared McDonald audio engineer said...
This comment has been removed by the author.
GospelSinger said...

Receiving responses from the x32 with puredata seems to not be possible. The x32 responds to the udp port from which the command was sent, and that port number is not provided to the user in puredata, so there is no way to set up a udp listener to receive the response. Do you have any ideas?

David Hay said...

@GospelSinger You should be able to specify the OSC port in PureData with either "dumpOSC 10023" connected to "print osc" or "connect 10.0.0.100 10023" connected to "sendOSC". Let me know if that works or not.

b said...

unfortunately, to my knowledge it's correct what gospelsinger says – you need to be aware of PD's own sending port (which differenciated from the port it is sending *TO*) in order to receive data changed on the x32.

David Hay said...

Right, I hadn't thought of or tested that. I actually just used Pure Data for some initial testing, I've mostly used Python and pyOSC.

I wonder, perhaps if you set up a Python receiver to test which UDP port Pure Data is sending from...