Replication among max for live devices?

sky rat's icon

I've got a weird situation.

I've built a max for live device that receives 10 separate streams of OSC data, each stream has its own port. You can use a drop down menu on the max for live device to choose which User (ip/port combo) you will be receiving data from and which User you will be sending data to. the system involved has 21 components 10 senders (heart rate monitors), 1 central computer with Max for Live, and 10 Receivers (LED strips hooked up to a microcontroller). The device I built allows me to select a user, take in all the incoming data from that user, process it, and send it out to the associated led strip. This device also allows me to control RGB/CHSV/a number of other functions on the micro controller that I currently have selected. This device works fine, but only if 1 instance is running, the problem I have is I need 10 instances running.

Example of current situation: Lets say track 1 has 1 user set up with the master device, he's dialed in, so I make a new track, place the master device on the new track, and select user 2, user 1's device is now broken, it'll brake in a number of different ways, (ex: user 1 now starts taking in user 2's data or vise versa, or everybody just shuts down). but the point is it breaks.

If i keep the device on one track and cycle through users I can control everybody fine, and, as a measure for testing I made 10 separate max for live devices, each with the user ip/ports statically typed and placed them on 10 separate tracks and it works fine, but this is redundant and I'd like to have one master device.

I think the problem is with max, the way that it instances multiple devices that all stem from a master device. I'm not sure how it handles variable replication in this setting and can't find any documentation explaining what's going on behind the scenes.

I've attached the master patch that allows you to select the user you'd like to control.

I tried to give as much context to the system as I can without being this being a really long paragraph, if your confused on anything I apologize please comment and I will clarify:

Quick context: This system will run in a meditation setting 10 people will be hooked up to HRM (Heart Rate Monitors), and each person has a corresponding led, I will have the led's doing a "pulse" animation every the person heart beats, I handle my beat detection in max for live, and I also have a variety of controls for the LED's also (RGB/CHSV/etc), the max device can also run some other functions on the board that allow me to get debug info, reset the board, etc. I'll be playing live while people are all hooked up into the system. but the current problem is that the device will only work if there is one instance, multiple instances of the devices cause the system to break, most likely due to the way max handles variable replication for devices that propagate from a master device.

Thank you for your time.

Max Patch
Copy patch and select New From Clipboard in Max.


es_84's icon

Hi,
did you take in account that some objects function globally? Send/return objects do not only share data within a single instance, but with all instances in a live set. So in your case in each instance there is a "receive hb". And each instance´s "send hb" will talk to all receives in the live set, resulting in a chaos of data traffic. If I understand correctly you testet with multiple instances of that master patch.

If you want to share the data only within the instance, sends in my opinion are not the best idea. Today you make a patch and call the send hb for some reason. In 1 year you make another patch and call a send hb for another reason. They work both great. Then you use both patches in your live set and zaq, they send each other stuff and you don´t have a clue of whats going on! Longterm you could run into something like this just by accidentally using the same name twice.

I don´t really see why you would need multiple instances of the master in first place. I´m sure you can bring it down to one instance.


loadUnique.maxpat
Max Patch


Jan M's icon

For global names like in send/receive or buffers you can prefix the name with three dashes [send ---someName] to restrict them to the instance.

es_84's icon

I remember this somebody writing here! I tried it in the past, but I think it did not work for me. Will test again tomorrow. Maybe this does not apply to m4l?

hollyhook's icon

make sure that you configure the port to receive OSC during runtime, so that each device uses a different port. The way it is done in your patch all devices try to bind to all ports, without control which device does what (had only a quick look, so correct me if i'm wrong here)

Had a similar setup with multiple (3) M4L devices, this is how i solved it