musescore/MuseScore — pull request #1251 by trig-ger (2014-08-31 16:24:36+00:00)
Title: Simple key signature detection algorithm

Works surprisingly well on the most of MIDI files. Correct accidentals - more clean resulting score.