I've been having a fight with Max4Live recently about using midi devices. I'd like to make a gigantic patch which integrates all my control surfaces, and replaces lots of the automap functionality with something that fits my playing style better. The problem is:
- m4l replaces max's midi functionality with its own driver, which takes midi from the Live channel the device is on.
- so you can't use multiple devices in a patch. At least, you can't differentiate them.
- a workaround would be to put each device on a different midi channel, and then separate the midi data inside the patch. But, Live "helpfully" forces everything to appear on channel 1. So, no luck there.
- another workaround would be to have a max patch running, using max's midi drivers, and send/receive the data into max4live. This looks like it works while you're editing the patch, but as soon as you close it, it goes back into Live, and then send/receive doesn't work any more.
So, I think I'm left with two options:
- use something like OSC to send midi data from standard max to m4l
- use different midi drivers
option 2 seemed easier, so being a java kid, I wrote a real quick MXJ object to wrap java's midi functionality, and spit it out to Max. The result is in the attached zip.
Usage is like this:
MXJ MidiIn use
It's been only very very lightly tested (I plugged a controller in and numbers came out what looked sorta right), and doesn't do anything fancy. In particular, I've got no idea about latency/jitter issues.
Source is included in the jar, feel free to do anything with it. No responsibility is implied whatsoever. Comments and suggestions welcomed!
Installation
Put this jar: http://www.mo-seph.com/files/midiIn.jar into a directory that MXJ is scanning for jars (look at the max.java.config.txt file in your max installation)
BTW, anyone using a Mac: the java/midi situation on OSX is a mess. Apple didn't include a java SPI in their java distribution, so you need to install one. Humantic used to make a free one (http://www.humatic.de/htools/mmj.htm) but I couldn't get it to work, and they've discontinued development. I've been using Mandolane's one (http://www.mandolane.co.uk/swMandoMidi.html) which is not free, but works. Apparently, recent versions of Snow Leopard have it built in, but I can't confirm that.
Enjoy!

Technorati Tags:
Comments
Hi, In order to make your
Hi,
In order to make your MIDI object work on my Windows box, I had to change the condition in the setDevice method to:
if( m.getName().startsWith( name ) && dev.getMaxTransmitters() != 0 )
You had a check "> 0" before, but Windows seems to report -1 for "unlimited".
I'd like to add outputs, too. If you want me to send changes to you, let me know how.
Thanks, Hans
Thanks!
Thanks for the feedback. I'll put that in, and maybe a MIDI out, and then put it up on google code so others can contribute as necessary.
hello, this workaround works
hello, this workaround works fine: http://forum.ableton.com/viewtopic.php?f=35&t=128795 and doesn't involve any java. you can send 16 midi channels and receive 16 midi channels too. It works not only in edit mode (this mode shouldn't be use for testing as the documentation says), but in "playing" mode too :) but indeed, it sucks because of send/receive objects that consume CPU (by the way, java consumes CPU too)
julien/protofuse
Great!
I saw that, and it looked good, but in the end I figured that:
I think really it would probably be better to get a c based solution, as that should be really efficient, but right now I want to get something I can make music with! Too much coding, not enough noise.
I'm very glad that there are now multiple ways to get round this.
Another option...
Hi,
in fact, I want to do exactly the same thing: Integrate all my control surfaces in one large Max patch and send only the MIDI to Live that I really want. My plan is (was?) to use a Max patch outside of Live to do the MIDI processing and a MIDI loopback device (using LoopBe1) to send the MIDI to Live. Communication between the Max patch and the Max for Live patch would go through send/receive. I wonder if you considered such a configuration? Am I, being a relative newbie, missing something?
Thanks! Hans
hans.huebner@gmail.com
Send/recieve
Only works between Max patches or M4L patches - you can't send from standard Max to M4L. It's easy to get fooled that it does work, though - it'll work while you're editing the patch in Max, but as soon as you close the edit window, it stops.
Attached?
Is it me or did you forget to attach the zip file?
Thanks! Hans
Zip file
Oops, the zip file only shows up in admin mode. Link added! Thanks!