MIDI file events to "real-time" without PPQ or SMPTE in header

Viewed 118

I am writing simple c++ synthesizer with MIDI playback. I've already implemented playback, but in some midi files information about PPQ or SMPTE(or data invalid, eg. all data bytes is 0) is absent and if i use "default" values of PPQ(ex. 24) and tempo from event(in this files tempo event is only one) playback is too slow or too fast. In this case i correct this value by hand. But if I import this midi in any DAW, they read file correctly and play melody with target BPM. How to correctly convert events tick to real-time in this case? What am I missing and what do DAWs do in this case?

1 Answers

The ticks-per-quarter-note value is part of the header chunk, so it is present in every file. If this value is zero, then the file is invalid and cannot be played at all.

For tempo and time signature, the default values are defined in the SMF specification:

All MIDI Files should specify tempo and time signature. If they don't, the time signature is assumed to be 4/4, and the tempo 120 beats per minute.

(120 BPM is the same as a tempo value of 500,000 microseconds per quarter note.)

Related