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.
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.
----------begin_max5_patcher---------- 3423.3oc6c01aiabD9yN.4+.gPAxWzsX2Yeueq85K3.ZABZR+TtBCZIZalPQ JPQe24Dz+6clk5Ua8BsEoH80Dfy1gjZ4rO6LyNyvmg5291u4pQ2T7kjEih9i Q+TzUW8a3QtJbL5HWs5.WMZV7WljEuHbgilTLaVRd0nwKOYUxWpBm38YIwkQ 2lVtnJZx8wo4r0WysE4UKR+0D55DbFe0wyeXVZdVRUXjEqNZ5zv3UbyO+Nmb 8XLuLYAdeiqRKxutLYRUsXKbVlCbFvONB+SgFzb03HgltM3YY7n+y1hQd7rf XL5OUlFmE8mKxlNZKwo3gpUxyZobdb0j6Syuaq6pV4XJs2JriijdKSozJu4. 21sk7vDMb7+629MzuweMtsv9EISJxm1dfObJvWhSWg.LVw3HO9mZq0Z5bvWZ 8LkP5wkYk1xzZtw24P+MOTUgiQyAO9IAOGfSCO.nPKDLgWociifvrf94lYwt Py56V8wpdbdR8.N5l376Fs0j+4PmBuQVfqP7RYcLsypHXbe2z1C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Zft6rT17UggZXdMeeA4WAQpJacageuQcu.M p6Ojrr6xhV7p3Fz9aeE+oXukmAJthdSL6XTGk369u+RjZ85apDN9cs6okU44 PHZ9da3fK8q9XoWy3FNmdrGZhNFJsvfKnhtjrzTCd+o3rGRh9CsA46MWbJtx Al1JEqeELq0BpSGM1mTK11TYaO0a8bZDnKNYyoWJxVEpdQ0uVSuXi1eIUa79 CGnLpmiG1tuihd0eqKb7uCJpaBs.48EgdPGnuZiZkVJ5f657O+ve4CzqLg+A pXtejQrAYts7taVQgQIQbQoh9I469Ibr9Dudz2QNlTjUygySLrG.pi9PUbV5 jW0WXCLHzc+3MRYXzWeTDUVs00U12g.9skEytrPtYf.4x0PNTi3T+Q6bs.he HydLH2zWrY+dClpCL5shMpffcMfzosQHAHo4mOdz9MF9Iav9sfK0VnEuCQqv N1z6GmZRC2Bu1MruRbSd7lUY759h3jvnw5YNC2SuhSHFIo8.8FN05OHNVOb6 9DjVhqOMY1Un6yRhk9RoaqbXOP9q1cyzcOotdfzV26hdiENqtQBmqeDNSiEN wkW3rMR3T8CxoZjvYFxBmtWDNiuQBGuWz4LtFKb8vxJzDg6o36vR3bCYCB4. F4rhdQ3zMxIrtez4ThlHbP+rwunQ5bgovk2OWnThmV55Gq0F4CNTWu9vfnQB m12SKqPyEudvdU1XShKuvAMC55m8HDMJnInehKArCX2vMbYUMjEt9IPcP0L+ v8ivoarvIFnVqB0.1UhnmBZpQkxQzOaeIZl0ZHddw.MdSnmJCVyhT+rEM5.3 u9e.Pq1E0 -----------end_max5_patcher-----------
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.
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.
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.
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!
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.
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.
Forums > Max For Live