FULL-STACK DEV
CMU SCS '26.5
Last updated: 8/10/26
Musescore printer

I spent a morning rewriting a script to download sheet music off of MuseScore. I made a PR, it got merged, and people still use it to this day!

Fantastic. I just tested in a few browsers and it works great for me. Thank you for the update!!

It was the summer of 2024, and I wanted to print some sheet music from MuseScore. Despite being the Library of Alexandria for crowdsourced sheet music, MuseScore is a rather scammy website, and I refused to be accidentally looped into their unrefundable yearly subscription just to print out a few pages of music.

Luckily, I found a GitHub repo that did the same thing and ran its provided JavaScript code. Unfortunately, it didn’t work. MuseScore had updated its site to only show one or two image URLs at any point in time, and the script assumed that it could still naively collate all the URLs in one go.

I had a choice at this point.

I could continue searching for other ways to download sheet music. Or, I could spend my morning reworking the code to re-exploit the sheet music rendering process, fixing a random script on a random person’s repository.

I went with the latter.

There was no rational explanation for this. No sane calculation of expected value or return on investment would’ve dictated that I spend the next few hours reverse-engineering the MuseScore frontend. But when did consequences ever influence decision-making?

The feedback loop was quick and satisfying. I eventually worked out that MuseScore was figuring out which pages to render based on scroll position, scroll height (h), viewport height (v - visible height of the scroll container), and the number of pages (p). I worked out that all the pages could be rendered at once if (h/p)*(p-2) < v ⇒ v/h > (p-2)/p. The more pages there were, the closer v and h had to be. (v also had to be less than h to generate a scrollbar and trigger the image loading code). I settled on v = 9999px and h = 10000px to render hundreds of pages in one go. I submitted a PR. The maintainer tested, approved, and merged. I got my sheet music printed, and the yak shaved.

At the time my PR was merged, the repository had 7 stars. Today, it has 148.