MidiFile noteOn missing

Hello everyone!

I am trying to send a MidiMessageSequence to a midi file that I can then use in a DAW. I use MidiFile::writeTo and the file is created but the noteOn messages do not appear. Also when I try to open the file in a MIDI reading program it fails to load. In some other forum posts it seems that the timing is in ticks instead of seconds. I’ve tried setting tick timestamps and second timestamps and it compiles but is not running as I hoped.

The ticks per second are setup as follows:
MidiFile mf;
mf.setTicksPerQuarterNote( 24 );
mf.addTrack( midiMessageSequence );

I first tried to add the MidiMessages as follows:

midiMessageSequence.addEvent(midiMessage, 0.0f);

and then as follows:

midiMessageSequence.addEvent(midiMessage, 48);

still the same issue.

What am I missing? How do I create a working MIDI file that can be read by external Applications.