This is great! My son, who normally loses interest in long songs that are a bit harder than his level, got through The well tempered clavier (one of the sample songs).
The timing/spacing of the notes is a bit off though, I wish it scrolled according to beats instead of speeding up and down depending on what type of note was being played. I understand it has to stop and wait for the note to be played, but some of the whole notes threw me off.
Yes, this is one of the harder problems, a lot of brain cycles got spent on getting it as accurate as it is now but there definitely is still room for improvement. Keep in mind that the browser is a super hostile environment for this kind of application and accurate (millisecond level) time tracking in the browser is next to impossible. The solution we picked was to reduce/increase the speed of the scroll based on the error term between where we are and where we should have been. This keeps the scolling reasonably smooth while giving the smallest error in time. If we'd prioritize the scrolling it would look better but the timing would be further off. Suggestions for improvements to the code are of course very welcome, the code is extensively commented. There are some really nasty gotcha's in the interaction between the setup of the original midi file on the score leading to some decisions that retrospectively were probably sub-optimal but I will definitely revisit those in the near future to improve on them. Fun fact: the score is drawn three times to get it as close to time correct and visually attractive as possible, first a rough plan to get everything in the right bar and in the right order, then as close as possible to the right point in time and finally any odd space is used to spread out the note heads so it looks visually attractive. The plan is to remove all that and to first create an intermediary representation and then to draw that in one go.
The timing/spacing of the notes is a bit off though, I wish it scrolled according to beats instead of speeding up and down depending on what type of note was being played. I understand it has to stop and wait for the note to be played, but some of the whole notes threw me off.