ABCjs integration now available

Please contribute to Which questions/answers would most benefit from music markup like ABC? and How could ABC notation be embedded in our posts' Markdown?

It's probably safe to say that everybody here would be glad if we finally got a proper way of typesetting music on this StackExchange.

Not that this hasn't been discussed earlier on meta. In particular, the request for Lilypond was very popular. Lilypond offers fully-fledged, professional grade music typesetting, with any microtonality quirks you could possibly wish for. Which is great and for some of the questions here certainly relevant... however, if we're honest, most of the features would very seldom be used.
The flip side of Lilypond's power is that it's hard to implement. It may well be possible to do it on a StackExchange site, but it evidently requires some serious work and willingness from the SE developers. As Richard put it:

SE Devs: ...What's Lily? How?

In particular: there seems to be a strong preference in the team to keep every site-specific extension client-side, i.e. JavaScript only. But an implementation of Lilypond in Javascript hasn't turned up yet.

(There is apparently a MediaWiki extension that can do Lilypond already, but it's server-side. Has been brought up already.)


Lilypond may be clearly the most powerful music markup language, but it's not the only one.

  • MusicXML is easy to parse etc. and can in principle rival Lilypond feature-wise, but it would be unwieldy to write even for an experienced user, and probably not accessible at all for newbies.
  • VexFlow looked quite promising, but the project site says pre-pre-pre-alpha since five years. That doesn't seem reliable.
  • ABC is a simple and concise markup language, that's able to create ordinary western staff notation. It has a JavaScript implementation, ABCjs, you can try it out here.

Why ABC now?

A poll last year concluded that Lilypond is much more popular than ABC. But this wasn't really news, Lilypond had already gained votes in a earlier posts.

Unfortunately, it's still not here! The SE team has plenty of stuff to do, and apparently Lilypond doesn't fit in their plans. So, in the foreseeable time, the decision appears to be between

  • Decide that ABC (or some other Javascript-implemented language) is good enough and convince the developers to adopt it.
  • Just keep waiting, or pay some developers to implement Lilypond in JavaScript, or hope for a miracle or whatever.

Would it be the sensible thing to settle on ABCjs, now?

  • These questions always really confuse me, as I would have thought the SE devs would want to choose the exact implementation, and we just give them requirements. But whatever, we need something, getting these questions any attention seems to be the hardest problem! Is there any official channels for raising such issues, Mods, or are you reliant on posting to Meta as well? Presumably other channels have been tried before?
    – Chris
    Commented Apr 2, 2016 at 10:10
  • 1
    @Chris: well, I fear the previous meta questions pretty much had the message “we want Lilypond, nothing less”. I suppose the SE devs are willing to choose an implementation for the requirements, but if the requirement appears to be something that has no implementation they're happy with, then what can they do? Commented Apr 2, 2016 at 10:24
  • Yeah, I agree. Just I'd have thought the process would be more - Us: "We want music markup" Devs: "How about this?". But you're right, a question like this can't hurt!
    – Chris
    Commented Apr 2, 2016 at 10:47
  • 1
    I've closed all the previous discussions as a duplicate of this one so that the "Linked" sidebar gathers it all together (and so anyone with something new to say will add it here rather than burying it elsewhere).
    – user28
    Commented Apr 2, 2016 at 20:45
  • 2
    Just so this is here: Here's the Javascript implementation I'm most familiar with: github.com/paulrosen/abcjs
    – Josiah
    Commented Apr 6, 2016 at 15:46

7 Answers 7


Myself, I'd certainly love Lilypond, which I'm familiar with. Though, truth be told, I find Lilypond not exactly simple, and indeed often rather a bit clunky.

I hadn't used ABC until yesterday, and wasn't particularly enthusiastic when it was last proposed. But after playing around with the language a bit, I must say I'm actually rather pleased. This isn't just little more than a dumb tabulature generature, it's actually capable of producing decent score material. No crazy stuff as you could do with Lilypond, but if you really need that (which, I daresay, won't happen in that many posts) then you can always still fall back to externally generating the score and simply posting a rendered png.

Like you now must do for all music snippets. And that's particularly annoying for really small, simple melody sketches, which ABC could handle totally fine.

All considered, I'm now not even sure that Lilypond is preferrable over ABC, which would probably be easier for beginners and come out with more concise code, for many posts.

Hence, I vote for ABCjs, and hope that it will be adapted.


I think an ABC.js solution is the most reasonable, but I have reasons beyond availability if we're constrained to client-side rendering.

I just did a quick check, and the latest version of Lilypond is >185000 lines of code, not counting blanks or comments.

For comparison, I did a compilation of a project about half that size to javascript, using emscripten, and ended up with an (unoptimized) file of about 2MB. You'd add a huge amount of overhead to the site, not to mention the time to render any scores on the page. On mobile, this could be painful.

So what we really need is a Lilypond-lite suitable for rendering in the browser. I think ABCjs IS a lite version of Lilypond and strikes a good balance.

  • I'm also new to ABC notation, but after having a look, it seems that when it comes to note lengths, they diverge quite a bit...
    – nightcod3r
    Commented Apr 4, 2016 at 21:01
  • Also, since Lilypond is mainly written in C++ and Scheme (and some Python, apparently... potentially the GUI?) there is A LOT of code that may be added just to port to Javascript. Assuming that functionality even directly exists in JS (probably not).
    – user6164
    Commented Apr 5, 2016 at 13:11
  • @nightcod3r, it should be pretty simple to modify abc.js to use Lilypond's note duration markup as a plugin. Put a custom header on the file ("lily-compat") and there shouldn't be any confusion. I think once we have ABC.js on the site we should revisit this or maybe open an issue for discussion on the ABC.js project itself.
    – Josiah
    Commented Apr 6, 2016 at 15:42

I vote for Abc.

Partly self-interest, because I use Abc a lot, and am very comfortable with it.

But also because Abc, whilst capable of reasonable sophistication in layout etc., has also got a low entry bar in terms of learning enough of the basics quickly to express what the user wants to do.

As leftroundabout has already said, I'd expect that Abc should be more than capable of expressing the vast majority of queries; if the question really requires markup that the full Abc syntax can't handle, the example can be generated in a format of personal choice and a graphic embedded from that.


I'm a guitarist, and thus I barely have knowledge of reading music. I am unlikely to use either solution in answers. But, ABC seems like a solution that could be implemented fairly quickly and would handle the general case. I vote ABC.

  • 1
    What does being a guitarist and not being able to read music have in common? It just means you never spent the time to learn.
    – scrowler
    Commented Apr 13, 2016 at 5:04
  • In my experience, there's a high correlation between being a guitarist and not reading music. In general, guitarists communicate more in chord charts and tablature than in sheet music. I know that, if an answer requires sheet music to explain, I'm very likely to punt and say "someone like Matthew Read can handle it", rather than fumble through something I barely understand. Commented Apr 13, 2016 at 16:25
  • Does tablature not constitute reading music?
    – scrowler
    Commented Apr 13, 2016 at 19:43
  • This could a valid topic outside of meta. Within meta, I'm saying "I'm unlikely to use the tool, but by the arguments, it seems valid". Commented Apr 14, 2016 at 14:49

I would suggest ABC Notation support instead of Lilypond because there is already an open-source ABCNotation to Javascript renderer available, abcjs, which would lower the effort that SE techs would have to make to add musical markup to our site.

It should be noted that I'm platform-agnostic. Whatever notation has a low enough barrier of entry for SE developers to quickly implement it for this SO is fine by me. I'd just like to get the alternatives out there.


With the question "Request Lilypond support from the SE developers" marked as a duplicate of this one I am responding here. Doing something such as enabling MathJax on a site involves asking a Community Manager to change a setting, while a DIY approach such as enabling MathJax on the Mathematics Chat involves using a bookmarklet.

Installing support for ABCjs (which uses ABC2) or Lilypond is a more involved procedure which caters to a single site, this one. The effort undertaken doesn't divide by a number of sites wanting the feature, as it does with MathJax.

Short list of software:

As you can see Lilypond is either too old or too unstable to install on the server, regardless of any other considerations. With bookmarklets or online editors available it becomes a tough sell to have someone maintain a program that they may not understand for one site.

There are questions on our Stack Overflow and Latex sites asking about Lilypond and other notation systems:

According user musarithmia's answer:

"Lilypond originally was developed using LaTeX, but the current version does not use TeX at all to produce its output of graphical music scores. So questions about Lilypond's syntax (or the Scheme syntax used to modify it) are off topic."

Music notation is too complex to simply enable MathJax and load a font file to get everything working. Installation wasn't too difficult for Wikipedia, and there are 1000's of webpages showing scores rendered with Lilypond and a 'play button' to hear the song. Example: Hesperusbahnen by Josef Strauss.

As explained on the Lilypond documentation page for Latex once installed the markup would be very easy to use:


While some effort has been made to implement Lilypond in sile (along with MathJax) there's not a simple way to integrate Lilypond into MathJax anymore than there is support for it in TeX (other than to inline the images Lilypond produces).

The easiest way to use Lilypond (or any other notation language) is to edit it locally on your own computer or using an online editor. Next copy the source and place it within HTML comments (<!-- comment -->) within your question or answer. Now upload the image. Anyone (with 'Edit Privileges') can view the commented out notation, enter it into an editor, make modifications, and upload a new image or insert a line of text into an answer.

  • 1
    Thanks. Though I find it hard too see what you're actually arguing here – that Lilypond is too old/unstable, or that the Wikipedia path seems to be doable? — I personally am quite satisfied with the ABC we have now, and hardly miss Lilypond support. It's good that you add an explanation of how Lilypond can be embedded with code, but IMO people should preferrably use the ABC feature as it renders automatically. Commented Jul 19, 2019 at 6:07
  • @leftaroundabout I was brought to this site by an automated spam detector that complained about a post consisting mostly of punctuation, a cobbled together music staff to ask a question. I thought it unfortunate that this site had no means to markdown notation neatly and searched 10 minutes looking around the site to see what was being (or had been) done. Further searching finds ABCjs is implemented - it's a waste of people's time this question is canonical and not tagged as completed.
    – Rob
    Commented Jul 19, 2019 at 12:47
  • I'm sorry, I wasn't aware that there's a status-completed tag. Commented Jul 19, 2019 at 12:49
  • And actually I can't add it, only moderators can... Commented Jul 19, 2019 at 12:51

Why not support both?

I don't see what would be wrong with supporting both, ABCjs can be used for quick markups, simple examples etc. but there may still be cases where lilypond's versatility is necessary.

In response to:

pay some developers to implement Lilypond in JavaScript

I don't see why this is necessary, the Mathematics SE site (for example) renders (or at least used to, I couldn't find much up-to-date stuff) all TeX server-side, and receives much more traffic than this site does, so I don't see what's wrong with rendering music notation server-side as well.

  • 6
    At least now, Maths.SE uses MathJax, which is client-side JavaScript. And, LaTeX is apparently quite a bit easier to render than Lilypond. Commented Apr 2, 2016 at 11:30
  • 6
    It's always been client-side. They don't want server-side customizations for sites and they won't enable two different client-side libraries due to overhead (not to mention redundancy). That's why this proposal is being made. A separate service they could host might be an option, but as yet we haven't been able to figure out if Wikipedia's implementation would fit the bill.
    – user28
    Commented Apr 2, 2016 at 20:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .