I saw a recent notation software product that seemed to offer a novel and concise way to code your music notation. I can't find it so I'm reaching out for your help.

  • 1
    This is a very fun experiment to notate music this way (especially coming from a front-end software development background) however I've noticed a GUI is so much nicer for engraving purposes. – user6164 Dec 21 '15 at 16:32

There is LilyPond which does what you are looking for. It was first released on 1996, but it still gets updates.

LilyPond is a computer program and file format for music engraving. One of LilyPond's major goals is to produce scores that are engraved with traditional layout rules, reflecting the era when scores were engraved by hand.

LilyPond is cross-platform, and is available for several common operating systems; released under the terms of the GNU General Public License, LilyPond is free software.


On the Wiki page, there is a nice example with some code and the outcome, but it's too big to post here.

We have had many questions tagged in this site, so you can look through these to get a general idea.

There is also ABC Notation, which is text-based notation (not exactly coding), like:

T:Speed the Plough
|:GABc dedB|dedB dedB|c2ec B2dB|c2A2 A2BA|
  GABc dedB|dedB dedB|c2ec B2dB|A2F2 G4:|
|:g2gf gdBd|g2f2 e2d2|c2ec B2dB|c2A2 A2df|
  g2gf g2Bd|g2f2 e2d2|c2ec B2dB|A2F2 G4:|

and gets you the result:

enter image description here

| improve this answer | |

I have not personally used any of them yet, but there are multiple packages for typesetting music with LaTeX.

| improve this answer | |
  • 6
    I don't think any of these can really take it up with Lilypond though (which, incidentally, started out as a LaTeX package too, but became standalone when it was determined that music typesetting diverges from standard document typesetting in too many ways for this to be a really practical approach). – leftaroundabout Dec 21 '15 at 18:09
  • 4
    As a LaTeX professional and an avid LilyPond user, I have to afree with @leftaroundabout that LaTeX is not really suitable for typesetting music. – yo' Dec 21 '15 at 20:30

As mentioned previously, LilyPond might meet your specifications. For one thing, its input is text form, something which some people equate with "programming" (for example, the answer proposing MusicXML does not make any sense without that assumption). For another, one of its implementation languages is Scheme (more exactly, Guile), and Scheme is immediately accessible in its source files as an extension language useful for algorithmic programming. One example of mixing music and programming is in this unrelated answer to a StackExchange question.

Sorry for not linking to LilyPond and Guile, but my reputation allows only for 2 links, so I had to be selective.

| improve this answer | |

An older option is MUP, which has been kicking around since 1995 and is now open-source freeware. It takes in an input file that looks like this and outputs a PostScript file that looks like this.

Note, however, that PostScript is something of an older file format, and you may need to download an extra piece of software to view the files and/or convert them to a different format. On Mac OS, the built-in "Preview" application will do it, but I'm not sure what the equivalent software would be on a Windows or Linux system.

| improve this answer | |
  • 1
    Postscript is not an 'older file format'. It is undwrstood directly by many current printers and can be converted directly to PDF. – Marquis of Lorne Dec 21 '15 at 21:03
  • 1
    @EJP: you're right that PS is not obsolete, but I would argue that it is currently much, much less common than PDF (which is basically now the de facto standard for so-called "fixed-format" printer-ready documents.) Postscript is also literally an old format, having been first introduced 33 years ago. – Michael Seifert Dec 21 '15 at 21:27
  • Ghostscript works fairly well for this, including conversion to PDF. – user16935 Dec 21 '15 at 22:23

MusicXML, in any text editor, is my favorite way to "code" music. A tutorial can be found here. When your code is complete, you can import it into almost any music editing software such as MuseScore, Sibelius, or Noteflight.

| improve this answer | |

Trinket allows you to write music with code. It's rather small at the moment but it works well for smaller projects. I haven't noticed any development though in the last few months so I'm not sure if they mean to continue it.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.