More accurate midi parser. (Actually the previous was wrong, it's just not noticeable)