Sonic Visualiser can export MIDI files, but only from Notes type layers. If a note layer is the current layer, then when you go to File -> Export Annotation Layer, you will see MIDI as one of the exportable file types.
If you have data in some other layer (such as a time-value layer) that you want to export as MIDI, it may be possible to do this by copy-pasting the data points into a new Notes layer and exporting that. You'll always get some sort of MIDI file that way -- but SV is often not clever enough to determine what the correct pitch for each note should be when it is pasted from a non-note layer, so the results may not actually be useful.
There is probably room for improvement in this area, if you have specific test cases that you would like to see working.
Chris