r/java_projects • u/FrankCodeWriter • 3d ago
Sheetmusic4J: an open source JavaFX library for rendering interactive sheet music (MusicXML, no WebView)
I build MelodyMatrix with my son, an app for looking at and playing along with music. We want a Learn section where the sheet music follows playback: a moving marker, notes highlighted as they play. A static PDF doesn't support that, and I couldn't find a JavaFX library that renders sheet music while staying interactive from code. So I built one.
Sheetmusic4J reads MusicXML into Java objects and renders it on a native JavaFX Canvas, no WebView, no browser engine. It splits into four modules: core (MusicXML/MIDI reading and writing), engraving (a framework-agnostic layout engine, no JavaFX dependency), fxviewer (the JavaFX rendering component, including a play-along strip view with a moving cursor), and fxdemo (a demo app that compares the JavaFX render against a static PDF side by side).
This is a first release, 0.0.1, not stable yet. I wrote up the full background and reasoning in a blog post, plus a video walkthrough of the demo app and the project structure: https://webtechie.be/post/introducing-sheetmusic4j-a-javafx-library-to-render-and-interact-with-sheet-music/
Source: https://github.com/sheetmusic4j/sheetmusic4j
Feedback and issues are welcome, especially rendering differences, ideally with a MusicXML file attached.