From version 4.5 (and maybe earlier versions too)
it is possible to let MusicTEX figure out when flats
or sharps should be inserted. To do this, translate the MIDI file without
specifying any key signature. After the translation proces edit the resulting
MusicTEX file. In the preamble you will find the command
%\relativeaccidentals
. Uncomment it by removing the % sign. Now
edit the \generalsignature
command to the required number of flats
(negative sign) or sharps (positive sign). During processing MusicTEX will now
figure out where to put flat and sharp signs.