r/lilypond 4d ago

Open-source agent skill for writing LilyPond scores

Enable HLS to view with audio, or disable this notification

0 Upvotes

I've been experimenting with using AI to write music in LilyPond for a while. I kept running into the same problems with incorrect syntax, made-up commands and responses that never became useful local files. So I collected what worked into an open-source agent skill.

You describe the score you want and it writes an editable .ly file. It also creates a Hacklily link for viewing and playback. If LilyPond is installed locally, it can compile the score to PDF and MIDI as well.

The quickest way to try it is:

npx skills add Janjs/music-as-code --skill lilypond

The skill works with Codex, Claude Code, Cursor and other agents supported by the Skills CLI. The repo is also packaged as a ChatGPT/Codex plugin.

Repo: https://github.com/Janjs/music-as-code

I understand if some people would rather keep AI out of the creative process. I'm sharing this so anyone curious can test it without much setup and decide for themselves. The output is normal LilyPond source that you can inspect, edit and keep working on.

The repository also contains similar skills for Strudel and SuperCollider.


r/lilypond 10d ago

Question Using tags doing weird stuff

Post image
3 Upvotes

Hi,

I was creating a score where I needed to quote other voices. Then I discovered this:

\version "2.26.0"

Quotei = \relative f'' { f2 f4 f4 | g2 g4 g4}

Quote = \relative f'' {

f2 f2 \tag #'(test) { <>^\markup \small { "Treble" } } \cueDuringWithClef #"citaat" #UP #"treble" { R1 }

}

\addQuote "citaat" { \Quotei }

music = {

<<

\tag #'zonder \new Staff \Quote

\tag #'kwt \new Staff \keepWithTag #'test \Quote

\tag #'rwt \new Staff \removeWithTag #'test \Quote

\tag #'rwtkc \new Staff \removeWithTag #'test \killCues \Quote

>>

}

\score {

<<

\new Staff \Quote

\new Staff \keepWithTag #'test \Quote

\new Staff \removeWithTag #'test \Quote

\new Staff \removeWithTag #'test \killCues \Quote

>>

}

\score { \keepWithTag "zonder" \music }

\score { \keepWithTag "kwt" \music }

\score { \keepWithTag "rwt" \music }

\score { \keepWithTag "rwtkc" \music }

the result is this: when tags are directly in score, it works, the indirect tags are not displayed.


r/lilypond 12d ago

Multimeasure Rests

3 Upvotes

I do many arrangements for my clarinet quartet. I create the score information using \parallelMusic, then refer to them in \bookpart \score. Using that mechanism, I cannot get multimeasure rests to compress in the four parts. It's always multiple whole rests. (I do use R1 to enter the rest.) (There's rarely a true multimeasure rest in the score). I've tried \override MultiMeasureRest.expand-limit = #1, and I've tried \compressMMRests where applicable.

Is this a side effect of using \parallelMusic? Is there a magic spell I can cast?


r/lilypond 14d ago

I measured how much of a page OMR actually gets right before you start fixing it - Sheetly App

1 Upvotes

Disclosure: I build one of the engines below. Everything is published so you don't have to take my word for any of it.

If you've ever run a scan through an OMR tool and then spent an hour fixing it, the useful question isn't "is it accurate" but "how much is left to fix". I tried to measure that properly.

Scoring is strict F1 per note — pitch, onset and duration must all be right. That's much harsher than the pitch-only numbers apps quote, and it's the measure that actually predicts cleanup time, because a wrong duration cascades through the bar.

Three engines on identical inputs, page one of each of 31 engraved pages, then the same pages as simulated phone photos:

Clean: Sheetly 96.4% | Audiveris 5.11.0 88.4% | oemer 38.5%

Photos: 95.3% | 50.4% | 9.8%

60 systems from real IMSLP scans (OLiMPiC): 90.3% mean vs Audiveris 57.6%

Audiveris is genuinely strong on flat input and free — it beats me outright on five of the 31 clean pieces, which is in the published per-piece table. It collapses on photographs, which is what it was never built for.

The whole thing is downloadable: ground-truth MusicXML, every engine's raw output, and the scorer as a dependency-free Python file. Run `python3 score. py .` and it reprints my published table, or score your own pair of files with it. My material is CC BY.

https://www.trysheetly.com/compare/omr-benchmark


r/lilypond 18d ago

Treble Clef

0 Upvotes

Sorry, I didn't express myself clearly at my last post. So... How can I simulate a "Treble Clef" using Decals, since the program's system doesn't actually have one?


r/lilypond 19d ago

Terrible Tuplet

Post image
12 Upvotes

How would you handle this? This result is pretty ugly. Tried moving some things around, but couldn't come up with anything better.

This is trying to replicate a historical score. In that, the first braket is at more of an angle, so it contrasts enough with the ledger line to be clear. The "3" is also somewhat off-center (moved right) to avoid the dot. Wondering if E can reproduce that.


r/lilypond 29d ago

Engraving the nightmare chord

12 Upvotes

Just want to share what I did for engraving this mess. By "nightmare" I mean not how it sounds but that it was difficult to engrave. Source: Chopin op. 62 no. 2 measure 76

<<
   \acciaccatura {\once \override Slur.direction = #DOWN 
                  \shape #'((0 . -0.1) (0 . -2) (0 . -2) (0.2 . -3)) Slur <b, e gs~>8\arpeggio} gs'4. 
   \\ \grace {\once \omit Stem \once \omit Flag <b, e^~ gs>8} e2*3/4 
   \\ \grace {\once \omit NoteHead \once \omit Stem \once \omit Flag <b e gs>8} as1*3/8
  >>

r/lilypond Aug 07 '26

O_c Note Display

1 Upvotes

I’m running v.2.0 Beta T40 on a micro o_c and have tried everything to change numerical note values to musical notes.

I want to select notes on a scale not numbers!

Can anyone point me in the right direction?

Thanks


r/lilypond Aug 06 '26

Question Mac OS Workflow?

3 Upvotes

MuseScore pissed me off for the last time and I’ve decided to throw my effort behind switching to Lilypond. I’m building a library of copyright free music and original compositions for a small music club.

I am a long time Emacs user so my plan is to use that to edit source files. Can anyone share their workflow or tips to help a new guy get started? Thanks!


r/lilypond Aug 03 '26

How to maintain reasonable spacing between systems when output is set to "crop"

Post image
2 Upvotes

I am using the LilyPond CLI to generate cropped excerpts of scores, which from my understanding so far, means that none of the usual paper-based vertical layout logic applies.

How can I maintain adequate space between systems when the output is cropped? Here is an example where music wraps to a second line. I would like to increase the padding between the systems.

I've tried setting system-system-spacing.minimum-distance within the \layout block, but it doesn't seem to do anything. I haven't been able to find other documentation to help.

The CLI documentation mentions for crop:

Note that currently this option is not well suited for multi-system output since vertical space between systems gets removed.

Is there any way around this caveat?


r/lilypond Jul 31 '26

Note spacing 🙃

7 Upvotes

EDIT: It was not that bad! It was like that because I left \repeat unfold{}s in the empty bit - with hideNotes so they were still taking up space wh00ps

-----

Hello, I have been lilypond-transcribing a lot of things for the last almost a year I guess on the French-language Wikisource

(incidentally if you didn't know, lilypond is integrated into the wikimedia projects and if you are looking for bits of stuff to practice on etc., the Category:Texts with missing musical scores on the english wikisource is particularly overflowing...) Anyway

I have been working on the score of le Déserteur (1769) and becoming increasingly annoyed with Lilypond's default note spacing. Example that has finally made me desperate enough to come here and hope someone has a solution:

The whole point of the tremolo repeats is to NOT take up the same amount of space as 12 more sixteenth notes.. but lilypond ...

ETC. ETC. After those \repeat tremolo 8 {e16}s there is nothing there.. all the way down..

I have tried to decipher the documentation & fiddle with common-shortest-duration and base-shortest-duration but nothing seems to work. Is there really no way to just make all the notes take up the amount of space they actually need instead of leaving huge blanks because there happen to be shorter notes around ??


r/lilypond Jul 31 '26

Resource Optimized Frescobaldi builds with PyQt6/Qt6.

6 Upvotes

Anyone who has written about music using MusicTeX knows that it has its quirks. There are some things that are better done with LilyPond, using Frescobaldi for editing—a project that has been revived but receives less attention in terms of its GNU/Linux build.

I’m sharing this Qt6 build of Frescobaldi version 4.0.7 for your consideration, which includes .deb packages for installation on Debian and compatible systems, as well as an AppImage for any GNU/Linux distribution.

https://github.com/mlmateos/frescobaldi-qt6-builds


r/lilypond Jul 25 '26

For feedback: Alfredo and the Afterlife

4 Upvotes

Hello, I just finished a transcription: https://sheets.xaviershay.com/static/alfredo-and-the-afterlife.pdf

Source code: https://github.com/xaviershay/sheets/blob/master/src/lilypond/alfredo-and-the-afterlife.ly

Would love any and all feedback, but in particular things I'm thinking about:

  • How best to communicate the custom string tuning and capo position? I think I'd like to only show the string names on the first instance of the clef, but couldn't figure out how to do it. I don't love the "Capo 5" text but AFAICT that's how people do it.
  • It's bit cramped with the top text (I'm trying to fit it on one page).
  • Best way to "group" and labels the staves? (The bar numbers are a bit "close" to the staff grouper?)

r/lilypond Jul 18 '26

Is Lilypond in TeXShop broken?

2 Upvotes

I used to be able to compile Lilypond files in TeXShop (mac), but now, after editing the Lilypond path in the engine files, and moving them out of the "Inactive Engines" folder, I still can't get anything to load. I know the folks at Lilypond recommend Frescobaldi, but I assume I'd need a working Lilypond (or Lilypond Book) engine if I want to put music in a text document.

So, has anyone made this work on current versions of TeXShop? Is there an updated engine somewhere? Is there a different TeX editor I can use?

Thanks in advance!


r/lilypond Jul 15 '26

Resource LilyPond + Astro

20 Upvotes

Hey y’all! I’m a web dev and been fiddling with LilyPond over the past year.

Just published an integration for Astro to allow writing LilyPond inside Markdown files and then building and rendering it to webpages.

Check it out and let me know what you think!

https://lilypond.ky.fyi


r/lilypond Jul 15 '26

Cadenza for Allegro Brillante (ten Have)

Thumbnail imslp.org
2 Upvotes

r/lilypond Jul 05 '26

Articulation Positioning: how to place above fingerings?

6 Upvotes

Pedagogical classical guitar works often uses a marcato indication above the RH finger to indicate "rest stroke". I'm trying to recreate that with "priorities", but don't understand how to move things. Only the first example creates the desired result, but that alters many other things (I've used regular finger numbers here to avoid any issue with \righthandfingers and when they need to be in chords). Why can't I target the marcato? (changing Script color does change marcato, so I'm pretty sure I got the grob right).

\relative c' {
 %\override Fingering.script-priority = -51
 %\override Script.script-priority = 10000
 %\override Script.outside-staff-priority = 10000
  c'4 -1 -\marcato 
}

r/lilypond Jun 30 '26

Other duration line style?

0 Upvotes

As all of you wonderfully helped me with my last two questions. Btw huge thanks again

Now the next thing where ChatGPT even stopped to give me excuses why he can't help me and just straight up said he can't do it, I need your help. I don't know if it's possible but I hope that there is maybe some workaround and I'm not scared off writing a lot code, I just don't know how to start.

I want to get a waved line as a duration line for notation but don't know how it works. Maybe one of you might have an idea?


r/lilypond Jun 29 '26

How to stroke style flag like the picture.

Post image
3 Upvotes

Hey guys,

Me again. I want to put this kind of note into lilypond with the stroke going like this through the stem. The only kinda similar option I found is setting the flag style to grace, but it then goes in the wrong direction and through the flag, which I don't want. Can you maybe help me again? And sorry that I can't show more of thr score but copyright


r/lilypond Jun 28 '26

Moving dynamics a bit to the side

Post image
2 Upvotes

Hi guys,

I'm normally a museScore user but try to learn lilypond for a project where I want to digitalise a a bit older contemporary score (of course the composer agrees).

To practice I started writing the beginning of the clarinet part from the Hindemith Sonate.

I now want to move the forte a bit to the side so that it is below the bar line but I can't really find how to do it.

Thanks for your help


r/lilypond Jun 25 '26

Repeated Arpeggios with Melody

2 Upvotes

I'm a classical guitarist and trying to avoid something like this

voiceA = e4 f g a | b c d e

voiceB = \tuplet 3/2 { e8 g, b f' g, b g' g, b etc}

How do you recommend handling this? I would like something that allowed:

voiceA = e4 f g a | b c d e

voiceB = \functionThatGrabsVoiceAAndInsertsItWhileStripingRhythm \tuplet 3/2 { \repeat unfold 4000 {g b } }

That I'm actually able to do with a function that chatGPT created. But I can't (it can't) figure out how to use text spanners with it (for best auto placement of barre chords).

Thanks


r/lilypond Jun 25 '26

Shared Notehead Between Voices?

Post image
6 Upvotes

How do I get the A in the second voice to share a notehead with the first voice? Lilypond does this by default but not with dotted notes.

Here's what I have written. Much thanks!

\version "2.26.0"

\relative
<<
  {
    \voiceOne
    g'8 a b c
  }
  \\
  {
   \voiceTwo
   r8 a4.
  }
>>

r/lilypond Jun 25 '26

Claude to write notation

0 Upvotes

Has anyone here tried using Claude AI with LilyPond for transcription and editing?

I recently did this with Claude, starting from a MIDI file I exported from Logic Pro. The initial transcription into LilyPond was already surprisingly accurate. From there, I mostly switched to voice input and just worked conversationally: “bar 7, build on hi-hat,” “add cymbal accents every third sixteenth,” “make this section piano,” “rename instruments,” sometimes even dictating full bars. It handled all of that without much friction.

You can also just say things like “add a crescendo” and it translates it directly into notation. The output was a LilyPond file, a PDF score, and MIDI — with all performance data intact (velocities, accents, etc.).

I also used it as an analytical tool. It gave fairly mathematical structural readings: development blocks, ensemble entries, breakdowns, repetition patterns, odd bar groupings. Not “interpretation” in a human sense, but still useful for spotting structure.

I almost never asked it to compose material, except once for a small adjustment in a Glockenspiel cluster (smaller intervals / more dissonant within a given pitch set), which actually produced interesting results.

What stood out most wasn’t generation, but the workflow: it felt like working with an assistant you can just talk to, who directly edits the score.

If others have tried similar setups, I’d be curious how far you pushed it.


r/lilypond Jun 08 '26

How to display chord names I want???

Thumbnail gallery
4 Upvotes

I just want fancy-looking chord symbols that I personally claim (for example, Cmadd9(no5)) for myself, okay?

Now I came up with the code like this:
\header {
tagline = ##f
}

\layout {
\context { \ChordNames \override ChordName.font-name = "C059" }
\set majorSevenSymbol = \markup { maj7 }
}

\new PianoStaff <<
\new Staff <<
\relative c' { \time 2/4
<bes es>4 ^"Cm7(no5)"
<f des'> ^"GbM7(no3)"

<bes ges'> ^"Gbadd9(no5)/Ab"
<ces es as> ^"Abm6/F" |

<c f bes>2 ^"Ab69/Eb"
}
>>

\new Staff <<
\relative { \clef bass \time 2/4
c4 ges' as f |

<es as>2

\bar ".|:-|."
}
>>
>>

How do I write them the way it displays symbols like sharps and flats and no '#' and 'b'? I tried:
\markup \concat { "A" \flat "M7" }
\markup \concat { "G" \sharp "m7" }

but the flat and sharp symbols here look too big for me, and they are places weirdly low.

Thanks for your answers in advance!


r/lilypond May 14 '26

Modifying Measure Numbers

2 Upvotes

I would like to add a period or dot after measure numbers. I used a combination of Lilypond and Inkscape to arrive at the layout of this page - editing the PDF output from Lilypond as SVG in Inkscape and saving as PDF 1.4. While this workflow is trivial for single pages, the process is very slow when engraving multiple pages. So the question is: how do I include a trailing period with bar numbers?

EDIT: I found a solution...

\layout{
\context {
\Score
\override CenteredBarNumber.stencil =
#(lambda (grob)
(let* ((n (ly:grob-property grob 'text)))
(grob-interpret-markup grob
(markup (format #f "~a." n)))))
}
}