Newbie question - send numeric data between devices

jpgringo's icon

Hello… I'm wondering if it's possible to send numeric data generated by one Live device to another? Specifically, in this case, I would like to send calculated frequency values from a Max MIDI Effect interpreting MIDI input (not "mtof" values!) to a Max Instrument on the same track, built to accept that data and do something useful with it. I want to build a number of different instruments, and the effect has quite a number of user-configurable parameters which I'd rather not duplicate into every one of the instruments, if that's avoidable.

If this is possible, I have no doubt it's obvious… but I'm brand new to M4L and don't yet have the vocabulary to even know exactly what I'm looking for.

Any assistance / hints are much appreciated!!

Home Surgery's icon

send & receive - abbreviated as "s" & "r" can send information between different devices.
Your object could be called "s frq" and "rfrq"

jpgringo's icon

Thanks, Home Surgery… I've tried that, but the problem is that the named "send" is picked up by every "receive" with the same name — even if it's on a different Live track with a different MIDI channel. I want to be able to use this model across multiple tracks in the same Live set without them interfering with one another. Am I missing something about narrowing the focus of "send" and "receive"?

jpgringo's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Okay, I've dug a little deeper and think I have a resolution to this:

The keys were: 1) discovering the "forward" object; 2) getting a small grip on the Live Object Model; 3) discovering the existence of the "regexp" object. (As someone whose day-job is software development, I can't tell you how thrilled I was to discover that last one in Max.)

So what this patcher does is to figure out which track contains the device when it is loaded/updated, build a string consisting of {patchername}_tracks_{tracknumber}_{variablename}, and then ensure that the messages I want to send get sent to that target, thanks to "forward". For testing, I've built a corresponding patcher (not included here) that sets up a "receive" object using exactly the same method.

I have yet to test this approach to see if it works with lists as well as individual bits of data (don't see why not), and to see if there are latency issues… fingers crossed! I also need to 'abstract' the messaging component, and therefore add inputs allowing the {patchername} and {variablename} bits of the "send" message to be set by the containing patcher.

As I said, I am new to Max / M4L, so I'm not sure if this is a completely messed-up way of doing something that can be accomplished more simply. Critiques are welcome… be honest!

And thanks again to Home Surgery for the reply. Your suggestion kept me digging in the right direction in the documentation instead of changing my approach.

Georg Hajdu's icon

I use the same approach to drive a microtonal sampler device but was very disappointed with the timing.

There are two other options though:

1. Timo Rozendaal is the developer of vt and claims that communication between devices is faster with vt than with the forward/receive pairs.

2. I myself replaced forward/receive by udpsend/udpreceive with unique port #'s for each track and noticed a noticeable improvement in terms of timing. Sending udppackets on the localhost usually takes less than a msec.

Nonetheless, I hope that Ableton and/or Cycling '74 will eventually offer a latency-free method to cross device boundaries.

Georg