I've been working on a project for a while and I'm a bit stuck with something.
The project is an application where a user can record a melody using a virtual keyboard or a MIDI controller. I've implemented a simple metronome he can use for temporal reference, as well as a bpm slider in order to choose the tempo.
To record the melody I use tables and tabwrite.
I've also got a chord sequence implemented that starts to play together with the melody when a "play melody" bang is pressed, but the recorded melody isn't quite in sync with the tempo. The duration of the chords is 1 whole bar (each bar has a 4/4 structure) therefore depends on the bpm.
For the quantization I simply have a metro at a rate of a quarter note of the current bpm value, so the tabwrite will be divided in grids with this precision.
Since the quantization precision of the melody is a quarter note, it doesn't end up being precisely "in tempo". I'm not really sure if I've explained myself well enough, but if I have and anyone has any idea how I could fix this I would appreciate it !