Quantize chords while keeping their relative intervals

Methinks it would be a bit more complex than that, and take a lot more than 5 minutes to program!

The algorithm should not shift the group of notes simply based on half the time between the first and last notes, but instead find the harmonic “snap-point” of the chord. Imagine playing an arpeggio with a trailing note; the task becomes, how does one recognise a “chord” versus a “fast arpeggio”?