Towards Freedom


Information, Inspiration, Imagination
truly a site for soaring Is

Lilypond

Music notation engraver.

WHERNTO: techniq  operate 

image of Lilypond

LilyPond is a free program that lets you create beautiful sheet music for all kinds of music, from classical to modern, just like for piano or guitar.

The coding commands will have emacs shortcuts attached to them as these are produced.

fundamental concepts

file structure

\version 2.22.1

\header { }

\score { % all the music goes here! ≠w Staff { % StaffGroup | PianoStaff … ≠w Voice {

} } \layout { } \midi { } }

for instance,

\score{ << ≠w Staff = "singer" << ≠w Voice = "vocal" { c'1 } \addlyrics { And } >> ≠w PianoStaff = "piano" << ≠w Staff = "upper" { c'1 } ≠w Staff = "lower" { c'1 } >> >> \layout { } }

Every \score block is a separate chunk of music within a \book block. multiple scores -> still one output file

Every \layout block affects the \score or \book block in which it appears multiple books -> separate output file

note structure

pitch duration post-event(s)

brackets and ties

{ … } Encloses a sequential segment of music < … > Encloses the notes of a chord << … >> Encloses simultaneous music expressions eg voices ( … ) Marks the start and end of a slur \( … \) Marks the start and end of a phrasing slur [ … ] Marks the start and end of a manual beam

\tuplet x/y { … }

voices

\relative { \key g \major % Voice = "1" Voice = "2" << { g'4 fs8( g) a4 g } \\ { d4 d d d } >> }

or

<< \key d minor \relative { % Voice = "1" r4 g' g4. a8 | bf4 bf c bf | a2. r4 | }
\relative { % Voice = "2" d'2 d4 g | g4 g g8( a) g4 | fs2. s4 | } >>

or

≠w Staff << ≠w Voice = "1" { \voiceOne \relative { e'4 f g a } } ≠w Voice = "2" { \voiceTwo \relative { c'4 d e f } } >>

musescore transfer

musescore -> xml musescore $f -o ${f%.*}.musicxml

xml -> ly musicxml2ly –nrp –npb –npm –npl –nsd –nb -m -r -l english $f

automatic scaling to paper size

#(set-default-paper-size "letter") at top level will automatically scale and it is not necessary to do it with \paper { #(set-paper-size "tabloid") } then diddle in here (as originally done): ≠wSpacingSection \override Score.NonMusicalPaperColumn.padding = #1.3

emacs

textedit

follow instructions for gnome3 in 4.1.1 Configuring the system

lilypond-invoke-editor.desktop already in /usr/share/applications [Desktop Entry] Version=1.0 Name=lilypond-invoke-editor GenericName=Textedit URI handler Comment=URI handler for textedit: Exec=lilypond-invoke-editor %u Terminal=false Type=Application MimeType=x-scheme-handler/textedit; Categories=Editor NoDisplay=true

then execute: xdg-desktop-menu install /usr/share/applications/lilypond-invoke-editor.desktop xdg-mime default lilypond-invoke-editor.desktop x-scheme-handler/textedit

put in .zshenv: export LYEDITOR=emacsclient the scm/editor.scm already has emacsclient in it so no special config necessary

scheme

  1. Scheme tutorial
    1.1 Introduction to Scheme
    1.1.1 Scheme sandbox
    1.1.2 Scheme variables
    1.1.3 Scheme simple data types
    1.1.4 Scheme compound data types
    1.1.5 Calculations in Scheme
    1.1.6 Scheme procedures
    1.1.7 Scheme conditionals
    1.2 Scheme in LilyPond
    1.2.1 LilyPond Scheme syntax
    1.2.2 LilyPond variables
    1.2.3 Debugging Scheme code
    1.2.4 Input variables and Scheme
    1.2.5 Importing Scheme in LilyPond
    1.2.6 Object properties
    1.2.7 LilyPond compound variables
    1.2.8 Internal music representation
    1.3 Building complicated functions
    1.3.1 Displaying music expressions
    1.3.2 Music properties
    1.3.3 Doubling a note with slurs (example)
    1.3.4 Adding articulation to notes (example)\\
  2. Interfaces for programmers
    2.1 LilyPond code blocks
    2.2 Scheme functions
    2.2.1 Scheme function definitions
    2.2.2 Scheme function usage
    2.2.3 Void scheme functions
    2.3 Music functions
    2.3.1 Music function definitions
    2.3.2 Music function usage
    2.3.3 Simple substitution functions
    2.3.4 Intermediate substitution functions
    2.3.5 Mathematics in functions
    2.3.6 Functions without arguments
    2.3.7 Void music functions
    2.4 Event functions
    2.5 Markup functions
    2.5.1 Markup construction in Scheme
    2.5.2 How markups work internally
    2.5.3 New markup command definition
    2.5.4 New markup list command definition
    2.6 Contexts for programmers
    2.6.1 Context evaluation
    2.6.2 Running a function on all layout objects
    2.7 Callback functions
    2.8 Unpure-pure containers
    2.9 Difficult tweaks\\