LY(1)
πΈ NAME πΈ
okay so bestie, meet LY(1) from python-ly β the manual page for ly, a tool for manipulating LilyPond source files. The manual name is LY(1), and the source is python-ly. Iconic. π
Usage:
ly [options] commands file, ...
β¨ OPTIONS β¨
-v,--versionβ show the version number and exit.-h,--helpβ show this help text and exit.-i,--in-placeβ overwrite input files. yes, literally overwrite them, bestie.-o,--output NAMEβ output file name.-e,--encoding ENCβ (input) encoding, defaultUTF-8.--output-encoding ENCβ output encoding, defaulting to the input encoding.-l,--language NAMEβ default pitch name language, defaulting tonederlands.-d <variable=value>β set a variable.
the special option -- considers the remaining arguments to be file names. periodt.
π¦ ARGUMENTS π¦
the command is one argument with semicolon-separated commands. in most cases youβll quote the command so that itβs seen as one argument. quote it, bestie, let it be one argument. π«Ά
you can specify more than one LilyPond file. if you want to process many files and write the results of the operations on each file to a separate output file, you can use two special characters in the output filename:
- a
*gets replaced with the full path name of the current input file, without extension. - a
?gets replaced with the input filename, without path and extension.
if you donβt want * or ? replaced in the output filename, you can set -d replace-pattern=false. no cap.
if you donβt specify input or output filenames, standard input is read and standard output is written to. very demure, very stream-friendly. β¨
π COMMANDS π
informative commands that write information to standard output and do not change the file
modeβ print the mode of the document, guessing if not given.versionβ print the LilyPond version, if itβs set in the document.languageβ print the pitch name language, if itβs set in the document.
commands that change the file
indentβ re-indent the file.reformatβ reformat the file.translate <language>β translate the pitch names to the language.transpose <from> <to>β transpose the file like LilyPond would do; pitches are given in thenederlandslanguage.abs2relβ convert absolute music to relative.rel2absβ convert relative music to absolute.simplify-accidentalsβ replace notes with accidentals as much as possible with their natural neighbors.write [filename]β write the file to the given filename or the output variable. if the last command was an editing command,writeis automatically called.
commands that export the file to another format
musicxml [filename]β export to MusicXML. itβs in development and far from complete, bestie, so manage expectations.highlight [filename]β export the document as syntax colored HTML.hl [filename]β alias forhighlight.
between commands, you can set or unset a variable using
variable=valueβ set a variable to value. special values aretrueandfalse, which are interpreted as boolean values, or digits, which will be interpreted as integer values.variable=β unset a variable.
π VARIABLES π
the following variables can be set to influence the behaviour of commands. if thereβs a default value, itβs written between brackets. slay. π
modeβ mode of the file to read, default automatic. can be one of:lilypond,scheme,latex,html,docbook,texinfo.output [-]β the output filename, also set by-oargument.encoding [UTF-8]β encoding to read, also set by-eargument.default-language [nederlands]β the pitch names language to use by default, when not specified otherwise in the document.output-encodingβ encoding to write; defaults toencoding, also set by the--output-encodingargument.in-place [false]β whether to overwrite input files; same as-i.backup-suffix [~]β suffix to use when editing files in-place. if set, backs up the original file before overwriting it.replace-pattern [true]β whether to replace*and?in the output filename.rel-startpitch [true]β whether to write relative music with a startpitch.rel-absoluteβ whether to assume that the first pitch in a relative expression without specified startpitch is absolute. if false, it is assumed to be relative toc'. if true, it is assumed to be absolute, in fact relative tof.if not set, this variable defaults to true only when the LilyPond version in the document>= 2.18.indent-tabs [false]β whether to use tabs for indent.indent-width [2]β how many spaces for each indent level, if not using tabs.full-html [True]β if set toTrue, a full document with syntax-highlighted HTML will be exported; otherwise only the bare content wrapped in an element configured by thewrapper-variables.stylesheetβ filename to reference as an external stylesheet for syntax-highlighted HTML. this filename is literally used in the<link rel="stylesheet">tag.inline-style [false]β whether to use inline style attributes for syntax-highlighted HTML. by default a css stylesheet is embedded.number-lines [false]β whether to add line numbers when creating syntax-highlighted HTML.wrapper-tag [pre]β which tag syntax highlighted HTML will be wrapped in. possible values:div,pre,idandcode.wrapper-attribute [class]β attribute used for the wrapper tag. possible values:idandclass.document-id [lilypond]β name applied to thewrapper-attribute. if the three last options use their default settings, the highlighted HTML elements are wrapped in an element<pre class="lilypond"></pre>.linenumbers-id [linenumbers]β if linenumbers are exported, this is the name used for the<td>elements.
these variables influence the output of information commands:
with-filenameβ prints the filename next to information like version, etc. this is true by default if there is more than one file specified.
π EXAMPLES π
hereβs an example to re-indent and transpose a LilyPond file:
ly "indent; transpose c d" -o output.ly file.ly
examples using the * in the output file name:
ly "transpose c d" *.ly -o '*-transposed.ly'
ly highlight *.ly -o 'html/?.html'
π AUTHOR π
Wilbert Berendsen. iconic author energy. π«Ά
π COPYRIGHT π
2025, Wilbert Berendsen.
so yeah, thatβs LY(1) from python-ly β version 0.9.9, dated Feb 08, 2025. go manipulate some LilyPond, bestie, youβve got this ππβ¨
π¦ where this page comes from
- debian trixie: python3-ly 0.9.9-3 Β· GPL-2.0-or-later
- ubuntu resolute: python3-ly 0.9.9-3 Β· GPL-2.0-or-later
- ubuntu stonking: python3-ly 0.9.9-3 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms