Fermata: Flexible tempo detection for MIDI-file quantization