Forums > Max For Live

can a M4L patch route midi to different ports?

Nov 26 2013 | 3:29 pm

Is it possible to write a max4live patch to send midi to different ports? Here’s what I’m trying to do:

Using a virtual midi cable like loopMIDI (Windows) or IAC (OS X), I’ve set up a large number of internal midi ports. I want to send all non-note midi like CC messages to all the ports. I want to send note-ons and note-offs to a single port. I want to allocate the ports on a first-come first-served basis. So the 1st note, say A4, goes to port #1, the 2nd note, say F4, goes to port #2, then A4 is released, freeing up port #1 for the next note, etc. The voice number outlet of the poly object seems perfect for this. I want to set up the patch so that it runs automatically without any user input. The exact number of ports used will vary depending on the particular musical piece. Ideally, one patch should handle it all, with a single user input specifying the number of ports. Alternatively, there could be a 4-port patch, a 5-port patch, etc. The maximum would probably be 12 ports, but could be higher.

Background: This is for microtonal purposes. The only way to retune most synths, including Live’s instruments, is to run multiple instances of the synth and send each midi note to a different instance, using the pitch bend message to fine-tune the note. (Yes, I know, very kludgey. *Sigh*) Usually this is done by using midi channels, with the retuning software receiving a single-channel midi stream and sending out a multi-channel midi stream. Each synth instance then receives on a different channel. The retuning software I’m using is a midi-only VST plug-in. But Live puts all midi on channel 1, so that won’t work. So I’m trying to use ports instead of channels. Each synth instance would then receive from a different port.

If there’s some way a max4live patch can send midi to different channels, that would of course be preferable. But as the picture shows, it seems Live won’t let that happen. The output meter in sampleTank shows midi on channel 1. BUT I am not very knowledgeable about Live or max/msp, perhaps there is a way?

  1. AL-5a


Nov 26 2013 | 4:02 pm

A related question: max4live lets you set the port for noteout and midiout. But the patch sits on a Live track with its own "MIDI To" setting. Does this setting override the max4live setting? Or does max4live bypass the Live track setting and talk directly to the midi port?

Nov 27 2013 | 2:35 am

m4l sends midi output out of the device and onto the Live track. if you want to target different midi destinations you need to use a java/C external to do this for you.

Nov 27 2013 | 4:57 pm

Please tell me more about java/C externals. I’m currently looking for a Windows one, and an OS X one later.

Are you saying that the port argument of the midiout and noteout objects is ignored in Live?

Nov 28 2013 | 2:10 am

I believe lh_midi_tools is the standard solution for OSX. There isn’t a version for windows, tho I believe Stray has some in beta:

I wrote my own Java one for my specific purposes, but it only supports a small subset that I currently need to my apps…

And yes, the port argument is ignored. Data can only be sent out of the device onto the track (or whatever the track routing is set to I believe)

Nov 28 2013 | 9:01 pm

Thanks much for the info.

Viewing 6 posts - 1 through 6 (of 6 total)

Forums > Max For Live