midi realtime quantize module

ive been long looking into an auv3 midi processor which can do that without success (maybe with a custom script into mozaique)

Pardon my ignorance if it’s doable in drambo, i have tried without success - a feature really needed for live playing with keyboard, different from arpeggio.

drambo does auto quantize once a clip is recorded, but having a midi process in real time quantizing timing of notes into selectable grid (16ths, 8ths, triplets etc) would be game changer probably not only for me. Incoming gate length should be relatively preserved

cubase has a midi plugin which snaps incoming midi into a grid, very simple to implement: we can have few adjustable ms for tolerance of a late note, otherwise it goes to the next quantized grid step. if a note is early obviously its even simpler.


  • edited January 25

    Hmmm. This would have to add latency, since you cannot make an event happen earlier, only later. This could be a nuisance for live playing. Also, preserving the gate length would be tricky in MIDI, since you only have Note On and Note Off events. Each Note Off would have to be delayed the same as its associated Note On. But isn't the natural slop in the timing part of what makes live performance sound live?

    That said, it should not be too difficult to implement in StreamByter or Mozaic, using MIDI Clock as the timebase.

    Edit: Doing this in the obvious way would make all notes late by the given lateness tolerance. I suspect that Cubase delays its internal clock (and audio playback) by the tolerance, so everything lines up perfectly. This is something only a host can do, so a perfect implementation requires modification in the host setting the tempo.

  • It can be done using the S&H modules for the gate and pitch (and velocity), as it works polyphonically if needed. I've just tried it.

    But like uncle Dave said, that would mean that you have to "play everything a little early" in order for the quantisation to work as expected.

  • Very curious how exactly did you made the patch`? Can i see it please?

    I am a piano player, and often play synths with keys. 145 bpm can be hard to hit 16th notes right, of course a “humanize” factor is nice and welcome but in this electronic music situation i need more snappiness, expressiveness comes from many other parameters.

    Cubase great and simple midi plugin can also introduce swing needed for some electronic styles, it lacks soft quantize for live thou.

    I have a low latency system and never noticed the need to “play a little earlier “ as you said - it’s only when i play late that a note goes to next 16th, which wouldn't sound as a mistake on stage for example, its seems like syncopations. But generally it just works fine and very usable for stage. Compared to audio latencies, midi is usually in sub millisecond ranges. Ans then why not just skip quantize notes which are too close to the grid , with adjustable range, like a micro-humanize factor? or get relative Q, the further away the more the shift.

    its also great for lets say a sample in koala which is at a certain bpm and definitely needs to be triggered on time, which can be bad if midi is played live with pads etc. Game changer 😃😇

  • OK. Are you saying you'd be satisfied with the following:

    1. If a Note On is early, delay it to the next grid line, and do the same with Note Off.
    2. If a Note On is slightly late, just let it through.
    3. If a NoteOn is significantly late, delay it to the next grid line.

    Your original post implied that you wanted the slightly late notes to be made earlier, which really complicates things. Handling it as described above is relatively simpler.

  • I am sorry i havent made myself clear in the original post. Never intended to build a modular midi rack which can actually see the future 😄

    i wouldn’t mind to have a tool for 1 and 3 only, i.e. strictly quantizing. Gate length is important.

    Tried what rs2000 suggested with SH but i am stuck with that note on/off thing. Drambo jumps notes and doesnt retirgger the gate when playing legato. It seems so easy to do anf i can’t find the logic to do it.

    thanks for your time!

  • Now I'm wondering what exactly you're trying to achieve.

    Delaying a gate signal until the next quantization step is easy but keeping the gate length makes me wonder if you really expect the actual played note length to be kept unchanged because that's a lot more tricky to achieve (and much easier to get by recording and quantizing in the sequencer).

  • If I’ve interpreted this correctly it would be like the BM3 option where the quantization for both Note ON and Note OFF can be enabled or disabled. I prefer to quantize Note On but keep the quantization for Note Off disabled.

    This since I very seldom hold the note down for the entire duration of the quantize length and don’t want it to be cut off early or stretched too long…

    In some apps it’s called quantize note end.

  • edited January 27

    Well i need a realtime quantizing function. As for example Samplr has. When you trigger in Samplr blue mode, you are always on grid, and gate length matters for as how long sustained a note will be i.e. how long the sample will sound. You simply can’t play not in tempo, whatever grid u choose, 16th 32th etc unless disabled.

    In monophonic example, as the gate length doesnt need quantisation (that would be a nice option to have but not too important), as a key is hold, the next note will retrigger the gate only when it comes to its next grid position if the previous hasnt ended yet. I dont think this technology is any different for polyphony, its just midi quantise of any number of notes.

    it looks like in drambo that’s not really possible with the given tools, thats why i request such a module here. Going midi to cv splits the concept of note into CV gate and velocity further complicating things like note on/off messages reinterpreted into logic gates relationships. That’s why arp and latch modules are midi, just way simpler for use.

    If its still not clear now, i can post a video how i use this in cubase with my midi keyboard, as Samplr is pretty self explanatory. Wondering why they are so few apps who use this time quantize feature in the realm of touchscreen music tools, while a ton of scale quantizers are available. Another one is beat surfing 2. None of those can be used with drambo.

    Thanks for your time, i am still curious how you proceed with SH module as your initial idea.

  • edited January 27

    In short:

    You connect the signal input of S&H to the gate out of MIDI2CV and the gate input of the S&H is triggered periodically, with the speed that equals your quantization grid.

    If you want to do it correctly, you do the same for the pitch signal from MIDI2CV.

    Thids will quantize both the note starts and note ends.

    Immediate, unquantized note off is possible too by applying a logic AND to the original and S&H'ed gate signals.

    Playing a sample exactly as long as it is can be done by using Flexi's Trigger playback mode.

  • At first glance, this doesn't sound difficult to do in a Mozaic script. I'll try to take a crack at it later today.

  • edited January 27

    Personally, I don't think I could stand any kind of live quantize. Tapping a note and having nothing happen for any period of time more than typical short latency is completely unplayable for me. I remember Beathawk used to do that, and it was terrible. But I'm up for some scripting as a diversion today. 😉

  • i did try this, but i need to stop holding a note and only then play a new one, ie no legato retrigger. Some notes even skip at all. But it was only with gate and no pitch so thank you will try that.

    wow thanks will get mosaic immediately if you do this for me and start learning coding :)))

    I play piano, i do scores sometimes withVSL and kontakt so work a lot with relative (soft) quantize and or dragging notes by hand (cubase has now 980ppq) so i understand well what do you mean. But this is another project, fast electronic music played with a funny baby keys controller and pads in dark rooms.. 909, basslines on 16ths etc. If time factor expression is needed then there are ways to do jitter in drambo, re-humanize or swing or random factor post quantize, but most of all its live situation. I use arpeggios but can’t hold a note for longer than the arpeggio clock, it always plays, and the gate length is set in the arp.

    also playing time dependant samples (loops) by hand can be tricky, imagine a crash or hihat loop which doesnt start on time. Flexi sampler is not yet ableton session view clip launcher, even loopy pro doesnt work in this case, still waiting a repitch algorithm there to play sounds on different than original bpm without time stretching.

    i even suggested to the Koala (which has the enormous bonus of having all samples next to eachother) devs to implement the same thing but the guy insisted that people who are not into music production i.e. the large majority will have a hard time understanding it so he introduced the note repeater which is, well a note repeater.

    thanks for your efforts!

  • Here's a quick and only lightly tested attempt. I didn't spend a lot of time on it but am more than happy to fix any found bugs and to make functional changes within reason ... short of inventing time travel to move notes earlier in time anyway. 😉

    It might be worthwhile to see if anyone will spend some time testing before investing in Mozaic. On the other hand, there are so many useful Mozaic scripts that even if this one doesn't work out, it's still one of the best things you can own on iOS.

    After writing this, I found there is another live quantize script on patchstorage.com. That would could be better - I haven't tried it.

  • God bless you! i bought mozaic and your patch is working marvelously so far! Thank you so much man, i will check tomorrow with the live template where it needs 8 instances of it but as far as it goes it is very stable.

    i will start learning mozaic a bit, in order to upgrade the script to handle tripplets/dots but so far its all I needed. Especially gratefull for that tolerance control extra😍

    the other script you posted looks like a fixed gate length, will try it but definitely yours is going to sound soon on parties!

    all the best

  • edited January 28

    I'm glad it's working for you @loreamon ! I usually do more extensive testing before releasing something, but this was a simple enough script that I crossed my fingers and let it loose.

    The script can already do triplets. There are selections for 1/3, 1/6, 1/12 quantize. Are there other triplet settings that you'd like to see?

    Dotted notes would be a cool addition. I may take a crack at that and will update the plugin if it looks like it will be effective.

    It just occurred to me that stuck notes could become a problem. Let's say you hit a longish note and it gets quantized to the next division, then you hit the same note before the previous one has finished playing. The could result in some confused Note-on / Note-off messages. Most synths don't react well when they get a new note-on before the previous note-off has arrived. I need to think this through and build in handling for this kind of situation.

    Any ideas on what should happen to the notes in this scenario? Different approaches that come to mind:

    • Terminate the old note just before the new one plays. That would result in a shortening of the first note.
    • Delay the second note until the next grid position after the first one ends. Possibly not a good choice because it could drastically alter the result.
    • Ignore the second note.
    • Extend the first note until the point where the second note would have ended and ignore the second note.

    The first seems like the most logical to me. Your thoughts?

  • amazing you are even willing to develop this! my bad i see the triplets now, except for 1/6th

    ive tested it so far only with drambo instruments, and didnt came across stuck notes. But yes the first option sounds definitely the best - hope that this termination would result in a brief note off-on message, especially when converted to cv gate.


  • edited January 29

    No problem. I find coding a good distraction provided the scope isn't too large. Ironically I rarely use any o the scripts I write. 😂

    If stuck notes aren't an urgent issue then I'll work that fix into the script when I add a dotted note grid option. Neither should be too difficult to deal with. I'll add 1/3 notes too. I somehow overlooked that.

  • @number37 👍🏼

    Your contributions are fantastic.

    I bet you'd do miracles if Drambo only had a code module 😉

  • edited January 29

    Just tried live quantize mozaic with the new punch in FXs and also sugarbytes turnado and it’s absolutely mind blowing, i love sooo much tight quantized fx changes. lovely little quantize revolution 😊😇 still can’t understand why i am the only one who needed such a live midi module. Thanks again number 37🤗

  • I have to say that this should be part of the Punch In FX module imo

    It only lacks configurable note on and note off quantisation.

  • If it's to quantise the Punch Fx module?

    I think you could do that with the Loop quantise you made ages ago

    though I do agree it would be a really cool addition to the punch In Fx module.

  • I'm glad it's useful! To my surprise, I found it more workable and fun than expected while testing the next version. 👍🏼

    Speaking of which...

    v0.2 adds 1/3 notes, fixes grid larger than 1/4 note not working, and adds dotted option to grid.

    Right now, overlapping notes will not play. For instance, if you play a long note and it's delayed to the next grid division, then you play the same note before the first has finished sounding, the second one won't play. Additionally, there is the potential for stuck notes in this scenario since two note-on events are received before the first note-off. This is bad juju.

    However, changing this will add significant complexity and processing overhead to the script. I'm on the fence about whether or not this is worth it at this point.

    I do plan to add Swing to the next version. Should be pretty easy I think.

    Keep the old version around! There's a lot of rewriting in this version and it could well not work as well as the previous one. Normally I don't throw things like this out there without more testing, but my time is a little bit limited at right now.

  • So we got a nice and simple midi quantize module in last update 😅 sorry for making u work number 37

    nevertheless thanks again for mozaic script, already played with it and while i ll replace with the native module, it will be a new world of things imside mozaic!

  • edited February 19

    Indeed, this is worth mentioning!

    It's a great utility module for use with the Punch-In FX rack: Now you can trigger effect layers precisely in time with 16ths, beats, bars etc.

    Thanks @giku 🙏🏼

  • No loss here and I always prefer a native solution! I just did that script for a distraction.

    By coincidence, someone mentioned a script that looks much better than mine in the comments on patch storage. https://patchstorage.com/midiq/. From the description, it really looks like it's worth checking out.

Sign In or Register to comment.