Sustain Pedal Events are not working properly
It's great that the pedal functionality has been added. Now that I've experimented with it, it needs just a few tweaks.
1) The time to send the 'on' message is just a tick or two after the note starts, and the 'off' message should have one of two possitions--when the note ends, or just before the next note starts. That way, the notes hold for their full duration, a staccato note won't be blurred by pedal where it's not intended. The most important thing this would do, however, is allow one pedal to release and another to begin on the same note. Currently, this situation causes the 2nd pedal marking to have no effect.
2) If a pedal starts on a note with a grace note, it should probably start on the grace note. This is pretty common usage--to sustain the bottom few notes of a chord that is too wide for one hand, while the other notes are struck.