How can I use Max to communicate with other devices over a network?

Linda Lowe's icon

I am delving into the possibilities of creating an interactive performance setup where Max needs to communicate with various devices over a network. My goal is to send and receive data between Max and other devices like computers, smartphones, and digital instruments that might be connected to the same local area network (LAN).

In particular, I'm looking to:

  1. Synchronize real-time performance data across multiple machines.

  2. Remotely control parameters within Max patches from devices like tablets or phones.

  3. Receive sensor data from external hardware that could influence audio/visual elements within my Max environment.

Could someone provide guidance on the following questions?

  1. What specific objects in Max are designed for network communication?

  2. Are there preferred protocols supported by Max for various types of networking tasks (e.g., UDP, TCP, OSC)?

  3. How do I configure these objects to establish a stable and responsive network connection?

  4. Are there any example patches or resources that demonstrate the process of setting up network communication in Max?

  5. What should I be aware of in terms of latency and timing issues when sending data over the network for a live performance?

I appreciate any advice or pointers towards documentation that would help break down the networking capabilities within Max for newcomers to this area of the software.

Thank you for your assistance!

jb@bmbcon.demon.nl's icon

Hi Linda, look at udpsend and udpreceive -

CNMAT have a load of OSC tools as well https://github.com/CNMAT/CNMAT-odot

hope this helps.

best, Justin.

Hector MacInnes's icon

Hi Linda,

I spent a couple of years running an improvisation group in a prison that used a wireless LAN to let several iPads work together through a central max patch. It's not exactly what you are describing but I may be able to help. What I can offer up front is:

  1. - all communication between iPads and Laptop took the form of OSC messages, and the iPads were all running TouchOSC (I used Mk1, and although there is a Mk2 version now, I actually stuck with Mk1 because it was much more straightforward to use and I wanted to keep the iPad interfaces as simple as possible). Anyway this worked really well, and I'd go down the same route again.

  2. - If you create the network using an external router (rather than, for example, "create network" on your laptop) then you can reserve specific IP addresses for specific devices (by linking IP to the MAC address) in the settings of the router. This means any reference to the IP addresses in the Max patch can be fixed rather than needing checked as part of setting up, and generally makes everything more stable and human readable. So for example, I labelled the iPads, and device 1 was on IP 192.68.1.101, TouchOSC was sending and Max's [udpreceive] object listening, on Port 1000. For device 2 this was 192.68.1.102 and port 2000 etc. etc....

    3 - I then parsed all the incoming using the ODot package, [o.route] etc. and by being canny with the names given to control elements in touchOSC - for example if you have an incoming OSC message that is comprised entirely of numbers (e.g. /1/4/17 0.347 ) then it's much easier to strip out the slashes and send that value to a particular place in a dictionary or whatever than if it's /1/page3/zone4/rotary17 0.347 which is how TouchOSC might write it by default.

    4 - In terms of latency, I found the above very responsive - we had some iPads that worked effectively like MIDI controller keyboards playing VSTs, with Max sitting in between, and it worked well. I doubt it would have pleased a jazz pianist. But I was using a single central Max patch within which all the sync happened, and all the audio and MIDI was passed, and only with control and note messages or similar being sent over the network. If you have more than one laptop involved you might need to bring Ableton Link in on things.



    Hopefully some of that helpful and some of it not already known.


    H

Linda Lowe's icon

Thanks for your help.