Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: Hacklily – sheet music editor (hacklily.org)
285 points by jnetterf on Sept 10, 2018 | hide | past | favorite | 49 comments

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?

Very cool work -- I'm a fan.

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.

For Hacklily, it turns out that the audio is rendered clientside via https://github.com/hacklily/hackmidi

Caching sheet music rendering is a hard problem. For example, a note later in the score can affect the spacing of notes before it.

If you have considered using a queue, what were your reasoning to prefer lambdas?

I'm not familiar with LilyPond. Is there no possible client-side generation?

For example VexFlow (http://www.vexflow.com/) or, even with music, abcjs (https://abcjs.net/). Both of those use their own language.

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.

[1] See, for example, https://www.amazon.com/Behind-Bars-Definitive-Guide-Notation...

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.

Oh neat.. I used to maintain a similar WordPress plugin well over a decade ago. https://chris-lamb.co.uk/projects/figurerender

Funnily enough, I spend the weekend making almost the exact opposite of this:


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.

Neat! Want to play with this. Does it also do voice leading?

No, it's pretty crude so far, but that's a great idea!

How would you want that implemented?

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.

That's awesome! Do you have any suggestions on how Hacklily could help you typeset & share music?

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.

At first, I thought: 'Kinda cool Latex inspired markdown editor for notes, but the play button is missing.'

Then I saw the play in the top bar :D

Pure awesomeness!

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.

Is this an online editor for lilypond? What are you using to render?

Yes! It uses lilypond in docker.


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?

Right now, there are 183 active users, and the CPU is staying around 5% on my Ryzen 7 1700. Keeping LilyPond running as a server helps.

Can you tell me more about your goals? I'm open to collaborating if practical.

Thanks! That's pretty encouraging performance.

Further details on my project in private e-mail.

That's super motivating, thanks for taking the time to comment!

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.

I've been describing it as a code editor for sheet music, but I guess it's just as much a sheet music editor for coders?

Very cool! If you're a guitar player, you might like: http://public.vexflow.com/vextab/

Could that be modifed to produce banjo tabs (five lines, perhaps with fingerpicking notation)?

As someone who has tried making a sheet music renderer, VexFlow is extremely impressive.

Yeah, I got as far as rendering the tab and the notes - but then trying to tie the “tied” notes together... that’ll drive you crazy.

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?

+1 for the Lilypond documentation. It's very informative.

I use Frescobaldi ( http://frescobaldi.org ) for my Lilypond editing and find it pretty good.

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/

Could really use a more complex example. Anything I could paste in?

Here's an arbitrary example from mutopiaproject.org: https://www.hacklily.org/?edit=jnetterf/sheet-music/BWV857BW...

This looks beautiful! Here's a related tool my friends made: http://partifi.org

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact