Very cool! I run LilyBin (http://lilybin.com), which I've unfortunately let languish. I compile using AWS Lambda and stay within the free tier. Did you consider using Lambda?
I considered Lambda and similar, but keeping LilyPond running as a server allows for lower latency, which is important given how long it takes for LilyPond to start up.
I don't think I'd be able to have the kind of live reloading I implemented here with Lambda.
The reason I switched to Lambda was to handle bursts. Occasionally some teacher would have a classroom open LilyBin, and my one server couldn't compile 30 scores at once. Lambda made it easy to handle.
Hacklily is great! Obviously doing fine with the HN burst! I may just point people to yours at some point.
This sounds like a really interesting problem. What kind of transformation is taking place during compilation, datatype wise, like are you rendering audio serverside?
I wonder for a classroom setting, if many people compile similar scores, if there's any opportunity to say "the first half of all these scores are the same, compile it once and concatenate it with the unique pieces"...caching composition...I'm sure I'll play with it someday.
A cursory look at the lilypond docs makes it seem like the language is pretty simple and straightforward... although, the source code looks nuts. How hard do you think a JS parser/vm for it would be?
Edit: been looking at some large lily projects from mutopiaproject linked below. Oof. There's more there than the docs let on. Still, would be a very interesting project...
To parse LilyPond you would first need to write a Scheme interpreter. Once you finally get a tree for the sheet music, rendering in a way that is correct, beautiful, and easy to read is no small task either. Sheet music rendering is full of so much nuance [1], and it's really hard to get it right. It took brilliant people many years to get LilyPond to the state it's in today. I picked LilyPond because it's powerful and beautiful. Don't get me wrong, VexFlow and abcjs are impressive projects, but LilyPond has a head start.
I think one day, you'll be able to use emscripten or similar to run LilyPond in the browser. We are not there yet.
The sample music in abcjs has some very clearly wrong things. For example, the spacing near accidentals is too tight and there's open spaces on the left hand side of some of the measures.
That's hilarious, I was working on https://pomax.github.io/music-theory-js/public/ over the weekend (working on adding a chord arranger to complement the cell arranger, so you can write a C3-root I–V–vi–IV as literally a "C3 I" cell with some duration, followed by just dropping in V, vi, and IV cells with some duration.
Short of a genuinely complicated ML system which having been fed a bunch of (say) Jazz Pianists midi data for chord patterns etc, I think you could probably do it with some kind of weighted (let's say by the user) Markov chain/state machine with some kind of graph for which chord voicing should be used relative to those around it: e.g. "This Dm7 has a F in it, the next chord is a Cmaj7#11 so move the F up a semitone[Within the same octave]"
The above system should be able to come up with coherent movement of voicings (and fingers...) although I can't imagien that it would sound very human.
This is so cool. Hadn't heard of LilyPond before this. I browsed mutopiaproject.org for some .ly files and imported them. Works great. Thanks for sharing!
Mutopiaproject and LilyPond are great. I used Mutopiaproject a lot when I was a teenager who enjoyed playing piano. It and imslp changed how I explored music, and helped me develop my interests. I always preferred the LilyPond scores from Mutopiaproject when they were avaialable, because they were usually higher quality. I actually decided to give back to the community by typesetting some scores myself.
The thing that led me to stop contributing was ultimately seeing the progress that was being made toward automated music transcription. I saw this technology as something that would make the process a whole lot faster once it was good enough, and so it wasn't a wise time investment to keep writing out those intricate files by hand, but it also wasn't yet the right time for me to start using that transcription software, either.
At the time, the software that caught my attention was mainly the kind that helps users turn a scan of sheet music into something that could be transformed (with a text editor and some scripts) into a LilyPond source file with far less work than actually typing out all of the LilyPond input yourself.
I can envision software that does this, but it seems like a big project with very uncertain adoption outcomes.
Edit: I think software like this probably already exists, essentially, and definitely if you consider running one of the LilyPond command line conversion tools an acceptable step. The system's main differentiators would be being web-based (which isn't that uncommon anymore for music engraving software), and targeting LilyPond as the best-supported output.
This is quite cool! I do feel like the "code view" interface isn't the best default, the "Insert Notes" interface should be more than just a tool hidden in a menu, because that's more than likely the primary way people would prefer to write music. I would keep the code view to more of a "view source" option.
Thanks! That's useful feedback. Hacklily's audience so far is primarily users who are already Lilypond users, but I'd love to make it more broadly useful.
Agreed. As a lilypond user, hiding some of the extra stuff would be confusing to me. I don't think it would be simple to create a mode for more easy note-only editing.
As context for my comment, I have actually never heard of Lilypond! The "code view" just seems like something I'd export to move to another machine or to send to someone or the like.
Very cool. I dug up an unfinished Lilypond arrangement that I'd been working on in 2008 and pasted it in and everything worked perfectly the first time.
I think if this had existed back then, the much-faster feedback loop would have helped me finish it. :)
Very neat indeed! Similar tools have done a lot to make TeX more accessible, so it makes sense that this also benefits lilypond.
I've started work on a project of my own that will do online rendering of lilypond (rather different design objectives from yours, though). I've been worrying a bit about resource consumption of frequent renders, and your application is occupying a rather extreme point there. Do you have any data about this already?
It would be really neat if I can export to a MIDI. Do you reckon that's easy to do for you? Lilypond in the back is storing this data in abc format right?
Separately, a question, which you guys might know how to solve:
How can I convert a PDF music sheet to a MIDI? I.e., does there exist a music-sheet to digital-music converter? The pdf in question I want to convert is not a scanned copy, it's been digitally produced by some other program (I don't know which program)
Someone requested MIDI and other exports at https://github.com/hacklily/hacklily/issues/2 and I'll try to tackle soon. Hacklily already makes MIDI available (for playback), so it's a matter of actually exposing that.
There are solutions for converting sheet music images to MusicXML/Finale/etc., but I haven't had good results with any of them.
Pretty sweet, I'll just have to learn that LilyPond to make use of it. Is there any good resources out there? It would be nice to include some tutorials or example songs but well that's a minor issue.
To me learning through programming is very natural so I'm excited to try my hands on composing using this language. Didn't ever occur to me that the notation would be that simple. With same effort and time you put into learning say C++ could you become a proficient composer with this?
I think the LilyPond documentation (http://lilypond.org/doc/v2.18/Documentation/learning/index) is a pretty good way of learning LilyPond. It's linked to from "menu > LilyPond manual" within Hacklily. Maybe I should be more aggressive about highlighting that...
Making community features is a natural next step which might help with finding examples.
LilyPond has a bit of a steep learning curve, but you can absolutely use it professionally. http://www.mutopiaproject.org/ shows what LilyPond can do. Personally, I find that I can be more productive with LilyPond than with Finale, and that the results look better.
I've been using Musescore for a lot of the stuff I used to use Lilypond for, but one of the things I absolutely love about Lilypond is that its easy to write scripts that emit lilypond format, it's killer for repetitive stuff like examples, flash cards, etc.
I was never any good with Finale or Sibelius, so I feel like I'm unqualified to say whether Musescore is worth learning, but have been curious what an actual skilled Finale user thinks about it?
I sometimes try to use Denemo but the UI is a bit complicated so that writing LilyPond yourself maybe is easier? But I like that Hacklily hat some other input methods as tools. I would like to click on a virtual piano. http://www.denemo.org/