Forums > Max For Live

Microtuner Patch

January 11, 2012 | 6:51 pm

Hi Everyone,

For the past week or so I’ve been working on a midi device microtuner patch. The idea is to use pitch bend messages to move individual notes off the normal tuning. There’s already a free plugin that does this, but it doesn’t work in Live because Live doesn’t recognize midi channels internally. So currently I’m trying to do it using an instrument rack’s chain selector to switch to a different device for each voice. The patch works by switching to the device with the chain selector, sending 14 bit pitch bend midi message, and then sending the note on or off message.

And this works great for scales, but not for chords. When I play two notes simultaneously, the chain selector switch doesn’t work and the notes get sent to the same device, which screws everything up. It appears to me that the chain selector controls and the midi messages are on separate threads within Live.

Anyways, I’m still going to fiddle with it some, and I might have a more specific question eventually, but for now I was just curious if anyone has any ideas about what could be going on here? I’m new to M4L coding and so I feel like I might be missing some key piece of the puzzle. Thanks.


January 12, 2012 | 6:23 am

Okay, I suppose that was too vague so I’ve created a test case. It requires some setup in Live so I’ve attached a zip file containing the project folder with the live set and a M4L patch demonstrating my roadblock. The patch contains buttons so you can play two notes separately and switch the chain, but playing one right after the other causes the last chain selection to affect both notes and they both get sent to the same chain.

Attached is the aforementioned patch.

– Pasted Max Patch, click to expand. –

January 12, 2012 | 10:50 am

you could set up the device so that on all 16 channels the same
patch is present, then split your chords across channels, each note
with its individual pitchbend setting.

January 12, 2012 | 7:42 pm

Hi Roman,

I’m not sure what you mean exactly by channels. Do you mean midi channels or voices? (I tried putting the midi messages for each voice on separate midi channels, but that didn’t work within Live.)

Sharing state between multiple patch instances would work great though! Is that what you’re getting at? For some reason I never thought that would be useful so I’ve been automatically putting — in front of everything. Thanks for the wakeup call! :)

I think I’d have to use two patches; one to send out the voice and note info (via a send object without the — prefix), and the other in front of each instrument device to receive this info and either use it or not depending on some local parameter. Is that about what you were thinking or did you have something else in mind?

If this works I suppose I don’t care so much about the chain select issue. Still would be nice to know why that’s not working.

Thanks for the help.


January 12, 2012 | 9:51 pm

I figure that you’re seeing this because even though it may appear that the rack selector is making the change, the internal routing changes in Live are not in place before you change the selector. I modified the patch a bit and was able to see that this starts to happen at around a 30 msec pause between notes, which I guess is the lower limit for the time it takes Live to reroute MIDI to a rack.

Not sure how you could do this in MFL as it is. If your instrument is a VST plugin, then you could do it all inside the MFL device.


January 12, 2012 | 10:32 pm

Hi Andrew,

Oh ok. I suppose I could poll the chain selector to make sure it’s set before continuing, but I think the delay might be too much. I’ll try multiple patch instances with shared data next and see how far that gets me. Thanks a lot!


January 12, 2012 | 10:41 pm

The thing about the API to remember in general is that it runs in the Live UI thread. As such it is asynchronous, you cannot rely on API events to happen in the same way as you can max events, with a defined order of operation.

It wouldn’t surprise me if Live could actually switch channels faster than this, but this is all you get through the MFL API.

It’s likely that a polling solution would not work, or be pretty slow. I just used a delay to arrive at my number.



January 13, 2012 | 9:22 am

i meant midi channels, sure. pitchbend works per channel, not per running note, which is why you see this.

normally should give another answer … i.e. dont try that pitchbend stuff – get hardware which
supports tuning table. :) but i know that there are many which dont.

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