logoalt Hacker News

ramses0today at 3:39 PM1 replyview on HN

Lilypond isn't well-known enough!

https://en.wikipedia.org/wiki/LilyPond#Integration_into_Medi...

https://www.mutopiaproject.org

https://lilypond.org/text-input.html

     \relative c' { 
        \key d
        \major
        fis4 fis g a
        a g fis e
        d d e fis
        fis4. e8 e2
     }
...but why is it so complicated? A novice interpretation of "music" is "a bunch of notes!" ... my amateur interpretation of "music" is "layers of notes".

You can either spam 100 notes in a row, or you effectively end up with:

    melody   = [ a, b, [c+d], e, ... ]
    bassline = [ b, _, b,     _, ... ]
    music = melody + bassline
    score = [
       "a bunch of helper text",
       + melody,
       + bassline,
       + page_size, etc...
    ]
...so Lilypond basically made "Tex4Music", and the format serves a few dual purposes:

Engraving! Basically "typesetting" the music for human eyeballs (ie: `*.ly` => `*.pdf`).

Rendering! Basically "playing" the music for human ears (ie: `*.ly` => `*.mid`)

Librarification! Basically, if your music format has "variables" and "for-loops", you can end up with an end score that's something like: `song = [ intro + chorus + bridge + chorus + outro ]`, and then not have to chase down and modify all the places you use `chorus` when you modify it. (See this answer for more precision: https://music.stackexchange.com/a/130894 )

...now imagine doing all of the above for multiple instruments and parceling out `guitar.pdf`, `bass.pdf`, `drums.pdf` and `whole-song.pdf`

TL;DR: Music is haaard, and a lot closer to programming than you think!


Replies

sporkltoday at 9:17 PM

Lilypond is the only music engraving system I'm aware of that can handle polytempo scores. The TEX-ness really comes in handy.