VST to auto-quantize MIDI on input?

VST, AU, AAX, CLAP, etc. Plugin Virtual Effects Discussion
RELATED
PRODUCTS

Post

I know there are plenty of ways to auto-quantize, but I was recently playing around with BlueArp and I set the sequence to a simple 1/8th note gate. Then I started playing against a beat. Obviously, all the notes I play are forced into a 1/8th grid.

The reason I like this better is because I can compose in a rigidly quantized way, rather than playing in humanistically and then hearing it play back mechanistically.

This got me wondering: is there a way to snap my input so when I play a note, it waits until the next 8th note to play, and the release also waits for the next 8th note? When I use BlueArp for this experiment, and hold down a note, it will play this note over and over.

Post

Which DAW are you using ?
Some have realtime input quantize natively, e.g. Ableton Live I think.

Post

The implementation for such a "MIDI Quantizer" plug-in is trivial except for latency issues.

In the best possible situation (zero latency) it's simply a variable delay on MIDI events. Obviously accuracy is limited by buffer length but this isn't too much of an issue since typical keypress latency is greater than 1ms anyway.
Free plug-ins for Windows, MacOS and Linux. Xhip Synthesizer v8.0 and Xhip Effects Bundle v6.7.
The coder's credo: We believe our work is neither clever nor difficult; it is done because we thought it would be easy.
Work less; get more done.

Post

No_Use, I'm using Reaper.

Apparently, PIZ (of course) attempted this in the past: http://www.kvraudio.com/forum/viewtopic.php?t=192282

They called it 'noteonoffq'. But their site is down now so I can't try that one out.

Post

The reason you're having difficulty trying to find a plugin like that is because the effectiveness would be mediocre. For instance, the DAW takes an input signal and logs it as say, a MIDI note. However, the first note you hit has no reference by which to determine if that note is supposed to be played at that moment other than using the current project time tempo and beat. If that's the case, then the program doesn't know if the key played is a downbeat, syncopated beat, or some other type of beat. Also, the plugin will have to introduce latency by a certain amount to guess if the note you're playing was intentional by snapping it to the closest beat relative to the previous beats. It would still be guessing.

So, in other works, the plugin would always be guessing and it could only be as accurate as the quantization parameters you set. It will introduce latency that you easily avoid by simply practicing to be on beat.

Still not buying it? Read on...

Take for example a plugin like this did exist. You play a note but it guesses a different beat on which to play on. That off-note will mess you up for the next note you had in mind. This is why quantization is done as a post process and not real-time. Ever tried playing a piano with a 150-150ms latency? It's based on the principle of delayed audio feedback which disrupts one's ability to speak properly or think perpetually while doing a task. In psychology, this is similar to the Choral Effect. Imagine now, something similar to that while you're trying maintain a beat. You'll end up like this girl:

https://www.youtube.com/watch?v=9_EmE8c6CME
Why do some DAWs have this feature built in? For simple repairs to a melody and to fill in a drum beat for a couple bars at most. It's wasn't meant to be a practical tool quantize incoming notes for an entire session. While Ableton can launch clips quantized to the start of every measure, it has an entire measure to setup the times lauch and your brain has enough time to prepare to launch that single clip.

I'm NOT saying that it cannot exist, I'm merely stating reason why it probably doesn't. I'm not a developer but I do have a technical background in physics which I use as the basis for certain explanations in everything...but in this case, I'm using it for software programming. In other words, it empirical analysis and logic on which I base my explanation. You can poke at the explanation all you want but once you understand fundamentally how one composes and that electrons do experience time like you and I do, as well as some basic programming, you'll see the logic and possibly find a better reason why developers don't put too much effort in something like this.

I suggest to practice playing on the beat rather than try to find something to essentially cheat your way through.
Last edited by Mathematics on Mon Jul 23, 2018 5:31 am, edited 2 times in total.
...and the electron responded, "what wall?"

Post

The plug-in has the same information the host has.

There is absolutely no difference in the information they have available. Any plug-in can effectively quantize any incoming MIDI data equally as effectively as the host can both real-time and non-real-time.

Why don't many plug-ins exist? There is no real need for them! Real-time quantization is a mostly pointless endeavor due to some of the reasons you list regarding how its application is arbitrary and subjective.

You did not list the most critical factor though: why remove information when we want that information? For example it's possible to easily decimate any audio signal down to a rate like 2 kHz so why don't we? Well, probably because for those of us who can hear the parts between 2k and 20k are also important.

It's a rarely needed tool so it simply doesn't exist. There is no wide market demand for such a product. Audio plug-ins are ridiculously niche already and when you narrow something down to having one or two customers world-wide your market prospects aren't looking great.

That said - the implementation of such a plug-in is trivial. Say you want to quantize all incoming events to occur only on exact 8th note boundaries: this requires a 8th note long event buffer. A FIFO design is likely the best option like so:

Code: Select all

int quantize(int i) { return i < next : 0 ? next; }
fifo.add_event(event, quantize(event.delta));
...
foreach (fifo as event, while event.delta <= position) { transmit(event); }
Since events are already quantized to integer sample offsets it isn't difficult to estimate the maximum number of events that may occur during the quantization period and dynamically resize the FIFO buffer when the estimate was short.

I believe we need sr / (tempo / 15) for a 16th, so /30 for an 8th.

At 48000 that gives 11520 samples per 8th for 125 bpm.

I'd guess off the top of my head that a multiplier of 8 per-sample events is likely to be enough in most cases giving 92160 events total. In case of under-estimate I'd just increase the size by 8 at a time. A MIDI event is minimally 64-bits wide giving 737280 bytes of buffer per step.

Now we're assuming 8 events per sample which is obviously a massive over-estimate in the majority of cases. It may be far more efficient to start with a much shorter buffer like say 16 events per 8th in total. This would be just 128 bytes to start and the buffer could be grown from there.

The most efficient method may be to poll ahead to count events occurring before the next quantization step(s) and dynamically resize the buffer only once per process call. The total number of events might increase by only 16 at a time (or some multiple thereof) to fit the total events encountered in the input stream.

Honestly I'd just shut up and do it. Unfortunately though I still haven't even gotten around to doing that x0xbox drum sequencer thing I've wanted to do for years, so...

Unless there are unforeseen complications it seems to be a simple implementation to me. As usual 90% GUI and interfaces and 10% real implementation. In this case the 10% real implementation is also 90% algorithm and predefined objects with 10% real implementation-implementation.

Every arpeggiator handles quantization by necessity. Basically the method is typically to add up notes in a buffer and copy/process the buffer when it's finally needed (on the edge of the quantization step/frame). Since we're talking real-time it means there is no possibility for push/pull or "fitting", only hard "forward only" quantization via delaying events until quantization boundaries.

Since only notes are handled it means the number of possible events are very small and the implementation is extremely simple.

Quantizing all MIDI input this way though is a bit more complex but nonetheless still very trivial.
Last edited by aciddose on Mon Oct 15, 2018 3:42 am, edited 1 time in total.
Free plug-ins for Windows, MacOS and Linux. Xhip Synthesizer v8.0 and Xhip Effects Bundle v6.7.
The coder's credo: We believe our work is neither clever nor difficult; it is done because we thought it would be easy.
Work less; get more done.

Post

AUTO-ADMIN: Non-MP3, WAV, OGG, SoundCloud, YouTube, Vimeo, Twitter and Facebook links in this post have been protected automatically. Once the member reaches 5 posts the links will function as normal.
Is this what you're looking for?

Set both these files in a folder as a js effect in reaper

https://raw.githubusercontent.com/IanHa ... ntize.jsfx (https://raw.githubusercontent.com/IanHalbwachs/gianniMIDI/master/input_quantize.jsfx)
https://raw.githubusercontent.com/IanHa ... b.jsfx-inc (https://raw.githubusercontent.com/IanHalbwachs/gianniMIDI/master/my-lib.jsfx-inc)


Total credit to the author of the script. Someone on the reaper forum hooked t up.

Post to original thread and its frustrating banter: https://forum.cockos.com/showthread.php?t=170339 (https://forum.cockos.com/showthread.php?t=170339)

Post

Mathematics wrote: Sun Jul 22, 2018 2:40 am The reason you're having difficulty trying to find a plugin like that is because the effectiveness would be mediocre. For instance, the DAW takes an input signal and logs it as say, a MIDI note. However, the first note you hit has no reference by which to determine if that note is supposed to be played at that moment other than using the current project time tempo and beat. If that's the case, then the program doesn't know if the key played is a downbeat, syncopated beat, or some other type of beat. Also, the plugin will have to introduce latency by a certain amount to guess if the note you're playing was intentional by snapping it to the closest beat relative to the previous beats. It would still be guessing.

So, in other works, the plugin would always be guessing and it could only be as accurate as the quantization parameters you set. It will introduce latency that you easily avoid by simply practicing to be on beat.

Still not buying it? Read on...

Take for example a plugin like this did exist. You play a note but it guesses a different beat on which to play on. That off-note will mess you up for the next note you had in mind. This is why quantization is done as a post process and not real-time. Ever tried playing a piano with a 150-150ms latency? It's based on the principle of delayed audio feedback which disrupts one's ability to speak properly or think perpetually while doing a task. In psychology, this is similar to the Choral Effect. Imagine now, something similar to that while you're trying maintain a beat. You'll end up like this girl:

https://www.youtube.com/watch?v=9_EmE8c6CME
Why do some DAWs have this feature built in? For simple repairs to a melody and to fill in a drum beat for a couple bars at most. It's wasn't meant to be a practical tool quantize incoming notes for an entire session. While Ableton can launch clips quantized to the start of every measure, it has an entire measure to setup the times lauch and your brain has enough time to prepare to launch that single clip.

I'm NOT saying that it cannot exist, I'm merely stating reason why it probably doesn't. I'm not a developer but I do have a technical background in physics which I use as the basis for certain explanations in everything...but in this case, I'm using it for software programming. In other words, it empirical analysis and logic on which I base my explanation. You can poke at the explanation all you want but once you understand fundamentally how one composes and that electrons do experience time like you and I do, as well as some basic programming, you'll see the logic and possibly find a better reason why developers don't put too much effort in something like this.

I suggest to practice playing on the beat rather than try to find something to essentially cheat your way through.
I'm sorry, you triggered me, and I have to respond to your post. Please accept my apologies in advance.

You are obviously very clever with all your physics knowledge, and your awareness of the failure of the human brain to be able to deal with response/feedback latencies (although some can train themselves to counter the delay), unfortunately I think your knowledge has limited your way of thinking with regard to DSP, electronic music environments and the associated problems derived from creative desire.

As others have noted, it is in fact quite easy to deliver a device which delays 'note on' and 'note off's to a specified time division; I've done it myself. Many EDM artists/composers learn, without really realising I suspect, to trigger their sound/loop just before they want it to start playing, much like how a DJ spinning a record anticipates the beat in order to let go and push at the right time. This is as important to a performance as knowing when to take a breathe while playing your tuba, or where your hand needs to on your guitar neck to make the next shape. This technique, along with <a few ways we can delay or hold the data> is absolutely playable as an interface to electronic instruments.

As you've seen, other developers have solved the auto-quantize problem already, for free in Reaper, the OP's host.

And ease off with the 'learn to play better' stuff until you've actually heard what the guy's music sounds like! He wants to hold down notes quantised to 8th notes, not play Chopin.

Post

Apart from the question "what for", I want to say that BlueARP actually does this.
To do this select factory program 3 as I remember (it's called "MIDI thru dummy").
When number of steps is set to 1, bluearp works as real-time midi quantizer (input quantize setting still takes effect). All the arp core works, so try to set different options for Key select, input key order and see what happens.
Although I must agree I don't use it much, but only to play bass drones, when I want them to be 1/4 quantized. This makes sense for multi-layered performance.
But it requires some skill - you always need to press a key a little before the beat, otherwise it will be delayed for the whole beat.

Post

If you have Kontakt, there is already a script in the factory scripts for this (can't remember the name of it but it is self-evident when you check the script presets). Just create an instrument with no samples, insert the script, set it to pass midi to the outside world, set your quantize to next '?' (1/4 or whatever) and place Kontact in the chain between your input source and your target.

Post

As for 'what for'... for live work of course, for instance, as one example. When you are running multiple arps, step seq's, drum seq's, you want that stuff to fall in line like good little soldiers. I rule my rig with an iron fist :).

Post

Protocol_b wrote: Fri Jan 11, 2019 4:33 pm As for 'what for'... for live work of course, for instance, as one example. When you are running multiple arps, step seq's, drum seq's, you want that stuff to fall in line like good little soldiers. I rule my rig with an iron fist :).
Of couse for live multi-layered performance quantizing arp input is a must-have feature. BlueARP has this too and it's enabled by default. Input quantize is less necessary in thru mode, when you just play a lead over the top of your arpeggiated lines. I usually turn it off for leads. But still it's possible to turn it on and real-time quantize your playing say to 1/8. Again, it requires some skill of pressing the keys a little earlier than you would normally do.

Post

! I have BlueArp installed but was not aware of the quantization function - thank you for that info. And yes, I have learned to play just before the beat. I use a midi guitar, so it is literally impossible to place a strum with every note falling on exactly the same tic - I use a quantizer to 'gather up' the notes of the chord and then release them all simultaneously, splitting channels and recombining them in various ways to various destinations. A powerful feeling when everything lights up in response and the 'band' begins to play :). Now I need a 'qualitizer' to fake compositional talent for me :(.

Post

"which delivers a delay to a specified time division"

Division of what? Auto quantize to a given division means it knows the tempo before it hits the DAW. Yes, a plugin can 'sync to host' but I don't see a plugin as the solution, get a DAW with a transfer function, less moving parts.

Post

Technically that's more moving parts they're just built in to the host rather than as a plug-in.

The whole idea of modularity is to make things more flexible and easier to use, not narrow your options to a single vendor on a single OS.
Free plug-ins for Windows, MacOS and Linux. Xhip Synthesizer v8.0 and Xhip Effects Bundle v6.7.
The coder's credo: We believe our work is neither clever nor difficult; it is done because we thought it would be easy.
Work less; get more done.

Post Reply

Return to “Effects”