LilyPond è un compositore tipografico di musica.
La musica si scrive non trascinando le note da una barra degli strumenti e mettendole su un pentagramma,
ma si scrivono come testo le note ed altri comandi, che vengono memorizzate in un file .ly
Lilypond legge il file di input, lo interpreta, genera il disegno dello spartito e lo scrive in un file PDF di output (che potrà essere visualizzato sullo schermo o stampato).
Questi i comandi, da dare a terminale, che attivano l'esecuzione di Lilypond:
cd sito.cantoeprego/canto/ly -Normalmente Lilypond viene usato tramite l'interfaccia Frescobaldiposiziona nella cartella lilypond nome-del-file-punto.ly -dice a Lilypond di processare il file
Uno spartito musicale può presentare (ad esempio):
• un solo pentagramma con la melodia di una canzone
• un pentagramma doppio per l'esecuzione al pianoforte
• quattro pentagrammi con le voci di un coro
• l'unione dei due precedenti
• una intera partitura
e quindi anche le indicazioni musicali sono moltissime.
Pertanto in Lilypond dobbiamo considerare:
• le note: nome, altezza, durata, elementi che le disegnano: testa, gambo, coda
• il testo che spesso segue le note
• il rigo musicale, il tempo, le chiavi, le battute
• le linee melodiche sul rigo
• raggruppamento di righi
• testo sopra al rigo, accordi, abbellimenti,...
Il nome delle note è quello anglosassone (con alcune variazioni: gli autori sono olandesi): a, b, c, d
Per usare i nomi in italiano (do, re, mib, fad ...), dare il comando:\language "italiano"oppure
\include "italiano.ly"
\score {Anche una espressione musicale elementare: { c'4 d' e'2 } viene riportata a questo formato completo.è il comando che descrive la musica \new Staff {crea un rigo di musica (il pentagramma) \new Voice {crea una voce all'interno di un rigo { c'4 d' e'2 }queste sono le note } } } \layout { }dice che deve essere creato l'output e come deve essere fatto
{ c'4 d' e'2 }viene trattata come:
\book { \score { \new Staff { \new Voice { { c'4 d' e'2 } } } \layout { } } }
{ c4 d e }ha lo stesso significato di
{ c4 d e }e:
{ c4 d e }
{ c4 d e }
a4 a a a % questo commento si riferisce ai Si b2 b % anche questa parte è commento
% ecco le note di "Ah! Vous dirai-je, Maman" c4 c g' g a a g2 %{ Questa linea e le note sotto vengono ignorate, perché si trovano in un commento di blocco. f4 f e e d d c2 %}
violino = \new Staff { % viene creata la variabile: violino \relative c'' { a4 b c b } } cello = \new Staff { % viene creata la variabile: cello \relative c { \clef "bass" e2 d } } { << \violino % richiama la variabile cioè: qui viene inserita la sua espressione \cello % richiama la variabile cioè: qui viene inserita la sua espressione >> }
\language "italiano" oppure \include "italiano.ly"
\language "italiano" { la'4 sol' \grace { fa'16 mi'16 } re'4 do'4\staccato do'\mordent si'2\turn do'1\fermata }
\layout { \context { \Voice \consists "Ambitus_engraver" } } \relative c'' { aes c e2 cis,1 }
\new Staff << \new Voice \with { \consists "Ambitus_engraver" } \relative c'' { \override Ambitus.X-offset = #2.0 \voiceOne c4 a d e f1 } \new Voice \with { \consists "Ambitus_engraver" } \relative c' { \voiceTwo es4 f g as b1 } >>
\new Staff \with { \consists "Ambitus_engraver" } << \new Voice \relative c'' { \voiceOne c4 a d e f1 } \new Voice \relative c' { \voiceTwo es4 f g as b1 } >>
\layout { \context { \Voice \consists "Ambitus_engraver" } } \new Staff { \time 2/4 % Default setting c'4 g'' } \new Staff { \time 2/4 \override AmbitusLine.gap = #0 c'4 g'' } \new Staff { \time 2/4 \override AmbitusLine.gap = #1 c'4 g'' } \new Staff { \time 2/4 \override AmbitusLine.gap = #1.5 c'4 g'' }
\relative { f'1 \bar "|" f1 \bar "." g1 \bar "||" a1 \bar ".|" b1 \bar ".." c1 \bar "|.|" d1 \bar "|." e1 f,1 \bar ";" g1 \bar "!" a1 f1 \bar ".|:" g1 \bar ":..:" a1 \bar ":|.|:" b1 \bar ":|.:" c1 \bar ":.|.:" d1 \bar "[|:" e1 \bar ":|][|:" f1 \bar ":|]" g1 \bar ":|." a1
\override Score.BarNumber.break-visibility = ##(#f #t #t)
\set Score.currentBarNumber = #51
{ \relative c'' { \repeat unfold 3 { c4 c c c } } }
{ \time 2/4 { \relative c'' { c4 c8 c16 c32 c64 c128 c128 | \autoBeamOff c4 c8 c16 c32 c64 c128 c128 | \autoBeamOn c4 c8 c16 c32 c64 c128 c128 } } }
\include "predefined-guitar-fretboards.ly" \new FretBoards { \accordi }
\fermatadopo la nota
nome del tipo di carattere | altezza del rigo (pt) | altezza del rigo (mm) | uso |
---|---|---|---|
feta11 | 11.22 | 3.9 | partiture tascabili |
feta13 | 12.60 | 4.4 | |
feta14 | 14.14 | 5.0 | |
feta16 | 15.87 | 5.6 | |
feta18 | 17.82 | 6.3 | canzonieri |
feta20 | 20 | 7.0 | parti standard |
feta23 | 22.45 | 7.9 | |
feta26 | 25.2 | 8.9 |
\header { title = "Nannì" subtitle = "'Na gita a li Castelli" subsubtitle = "1928" poet = "parole: F. Silvestri" composer = "musica: F. Silvestri" tagline = "Lilypond vers 2.18.2" copyright = "www.cantoeprego.it -> impariamo -> canzoni" }
% 1. definire una variable per stabilire il formato della data date = #(strftime "%d-%m-%Y" (localtime (current-time))) % 2. usarla nel blocco titolo \header { title = "Inserire la data!" subtitle = \date }
{ c''2~ c''4 }
{ \relative c' { d4( c16) cis( d e c cis d) e( d4) } }
{ \relative c' { a8(\( ais b c) cis2 b'2 a4 cis,\) } }
\override Score.MetronomeMark #'padding = #3
\paper { print-page-number = ##f top-margin = 2\cm bottom-margin = 1\cm ragged-bottom = ##t ragged-last-bottom = ##t left-margin = 2\cm line-width = 17\cm interscoreline = 4\cm }
\paper { %paper-width = 2\cm %paper-height = 2\cm top-margin = 2\cm bottom-margin = 1\cm %heap-separation = 7\cm %foot-separation = 7\cm ragged-bottom = ##t ragged-last-bottom = ##t left-margin = 3\cm line-width = 15\cm %rigthmargin = 3\cm interscoreline = 4\cm %between-system-padding = #1 }
\new Voice { % voce singola esplicita << { a4 b g2 } { d4 g c,2 } >> }
\layout { indent = #0 line-width = #150 ragged-last = ##t }
\include "italiano.ly" #(set-global-staff-size 17.82 ) { \relative do' { \repeat volta 2 { sol'4 sol8 fa sol4 la } \alternative { { re4 re do la | re2 re2 } { re4 re do si | do2 do2 } } \bar"|." } }
^\markup { \override #'(thickness . 2) { \circle "S" } }
\markup { \italic \fontsize #-3 #(strftime "%d.%m.%Y" (localtime (current-time))) }
{ \relative c'' { c \segno b a g } }
melody = \relative c' { e d c d | e e e e | d d e d | c1 | } text = \lyricmode { \set stanza = #"1." Ma- ry had a lit- tle lamb, its fleece was white as snow. } \score{ << \new Voice = "one" { \melody } \new Lyrics \lyricsto "one" \text >> \layout { } } \markup { \column{ \line{ Verse 2. } \line{ All the children laughed and played } \line{ To see a lamb at school. } } } \markup{ \wordwrap-string #" Verse 3. Mary took it home again, It was against the rule." }
#(set-global-staff-size 20) \score { { \repeat unfold 12 { s1 \break } } \layout { indent = 0\in \context { \Staff \remove "Time_signature_engraver" \remove "Clef_engraver" \remove "Bar_engraver" } \context { \Score \remove "Bar_number_engraver" } } } \paper { #(set-paper-size "letter") ragged-last-bottom = ##f line-width = 7.5\in left-margin = 0.5\in bottom-margin = 0.25\in top-margin = 0.25\in }
\layout { \context { \Voice \consists "Melody_engraver" \override Stem.neutral-direction = #'() } }
\time 2/4
\tempo "Allegro" 4 = 160
{ c'1 \numericTimeSignature \time 4/4 c' \defaultTimeSignature \time 4/4 c' }
\language "italiano" \times 2/3 { r8 sol'8 sol'8 }
\language "italiano" \tuplet 3/2 { r8 sol'8 sol'8 }lilypond>
{ g'2 (g'4.) r8 }
\include "gregorian.ly" #(set-global-staff-size 40) music = { \repeat unfold 20 a % \augmentum b \repeat unfold 20 a } \new VaticanaStaff \music \new Staff \music
\include "gregorian.ly"puoi usare:
\divisioMinima \divisioMaior \divisioMaxima \finalis \virgula \caesura
\clef "vaticana-do1" \clef "vaticana-do2" \clef "vaticana-do3" \clef "vaticana-fa1" \clef "vaticana-fa2"
\[ sol \flexa fa \]
\score { << \new VaticanaVoice = "cantus" { \set Staff.midiInstrument = "church organ" \melodia }
\include "gregorian.ly" #(set-global-staff-size 40) \score { \new VaticanaVoice { \override TextScript.font-family = #'typewriter \override TextScript.font-shape = #'upright \override Script.padding = #-0.1 a\ictus_"ictus " \bar "" \break a\circulus_"circulus " \bar "" \break a\semicirculus_"semicirculus " \bar "" \break a\accentus_"accentus " \bar "" \break \[ a_"episema" \episemInitium \pes b \flexa a b \episemFinis \flexa a \] } }
cd ../../ cd usr/share/lilypond/2.18.2 sudo chmod 777 ly
%%%%% Defs to be saved as "modernGregorian.ily" %%%%%%%%% %%%% Defining new stem/ligatures: % long stem lst = #(define-music-function (parser location mus) (ly:music?) #{ \stemDown \undo\omit Stem \once\override Stem.length = #7 \once\override Stem.X-extent = #'(.1 . 0) \once\override NoteHead.stem-attachment = #'(1.5 . .1) $mus \omit Stem #}) %long curved ligature #(define (long-curved-ligature grob) (if (ly:stencil? (ly:stem::print grob)) (let* ((stencil (ly:stem::print grob)) (X-ext (ly:stencil-extent stencil X)) (Y-ext (ly:stencil-extent stencil Y)) (width (interval-length X-ext)) (len (interval-length Y-ext))) (ly:stencil-translate (grob-interpret-markup grob (markup (#:path width (list (list (quote moveto) -0.7 -0.65) (list (quote curveto) -1.2 -0.4 -1.1 -0.2 -0.9 0.5) (list (quote curveto) -0.9 0.5 -0.4 2 -0.8 2.2))))) (cons 0 (interval-start Y-ext)))) #f)) lli = #(define-music-function (parser location mus) (ly:music?) #{ \stemUp \undo\omit Stem \override Stem.stencil = #long-curved-ligature $mus \omit Stem #}) %medium curved ligature #(define (medium-curved-ligature grob) (if (ly:stencil? (ly:stem::print grob)) (let* ((stencil (ly:stem::print grob)) (X-ext (ly:stencil-extent stencil X)) (Y-ext (ly:stencil-extent stencil Y)) (width (interval-length X-ext)) (len (interval-length Y-ext))) (ly:stencil-translate (grob-interpret-markup grob (markup (#:path width (list (list (quote moveto) -0.7 -0.65) (list (quote curveto) -1.2 -0.4 -1.1 -0.2 -0.9 0.5) (list (quote curveto) -0.9 0.5 -0.4 1.9 -1.4 1.8))))) (cons 0 (interval-start Y-ext)))) #f)) mli = #(define-music-function (parser location mus) (ly:music?) #{ \stemUp \undo\omit Stem \override Stem.stencil = #medium-curved-ligature $mus \omit Stem #}) %short curved ligature #(define (short-curved-ligature grob) (if (ly:stencil? (ly:stem::print grob)) (let* ((stencil (ly:stem::print grob)) (X-ext (ly:stencil-extent stencil X)) (Y-ext (ly:stencil-extent stencil Y)) (width (interval-length X-ext)) (len (interval-length Y-ext))) (ly:stencil-translate (grob-interpret-markup grob (markup (#:path width (list (list (quote moveto) -0.7 -0.65) (list (quote curveto) -1.2 -0.4 -1.1 -0.2 -1 0.4) (list (quote curveto) -1 0.4 -0.8 1.5 -1.4 1.3))))) (cons 0 (interval-start Y-ext)))) #f)) sli = #(define-music-function (parser location mus) (ly:music?) #{ \stemUp \undo\omit Stem \override Stem.stencil = #short-curved-ligature $mus \omit Stem #}) %tiny curved ligature #(define (tiny-curved-ligature grob) (if (ly:stencil? (ly:stem::print grob)) (let* ((stencil (ly:stem::print grob)) (X-ext (ly:stencil-extent stencil X)) (Y-ext (ly:stencil-extent stencil Y)) (width (interval-length X-ext)) (len (interval-length Y-ext))) (ly:stencil-translate (grob-interpret-markup grob (markup (#:path width (list (list (quote moveto) -0.7 -0.65) (list (quote curveto) -1.2 -0.4 -1.1 -0.1 -1 0.2) (list (quote curveto) -1 0.2 -0.8 0.7 -1.4 0.6))))) (cons 0 (interval-start Y-ext)))) #f)) tli = #(define-music-function (parser location mus) (ly:music?) #{ \stemUp \undo\omit Stem \override Stem.stencil = #tiny-curved-ligature $mus \omit Stem #}) %% Ornament function orn = -\tweak self-alignment-X #LEFT -\tweak Y-offset #0.5 -\tweak X-offset #1 -\tweak outside-staff-priority ##f -\markup \raise #-.3 \scale #'(1 . .85) \rotate #90 \musicglyph #"ties.lyric.short" %% Left aligning lyric : lal = \once\override LyricText.self-alignment-X = #LEFT %% horizontal inside staff spacer space = #(define-music-function (parser location anzahl) (number?) #{ \grace { \repeat unfold #anzahl s } #}) % Given some music that represents lyrics, add a prefix to the first % lyric event. % syntax is \versus { some lyrics } % resp. \responsum { some lyrics } #(define (add-prefix-to-lyrics prefix music) (let ((found? #f)) (map-some-music (lambda (m) (if found? m (and (music-is-of-type? m 'lyric-event) (begin (set! (ly:music-property m 'text) (string-append prefix (ly:music-property m 'text))) (set! found? #t) m)))) music))) % Add unicode 2123 (versicle) as prefix to lyrics. versus = #(define-music-function (parser location music) (ly:music?) (add-prefix-to-lyrics "℣. " music)) % Add unicode 211F (response) as prefix to lyrics. responsum = #(define-music-function (parser location music) (ly:music?) (add-prefix-to-lyrics "℟. " music)) %% Defining notelaces (neume, melisma) and dedicated context: gregorianContext = { \cadenzaOn \omit Clef \omit TimeSignature \omit StaffSymbol \omit Rest \omit Flag \omit Beam \override SpacingSpanner.packed-spacing = ##t \override NoteHead.stencil = #(lambda (grob) (let ((pos (ly:grob-property grob 'staff-position))) (cond ((= pos -6) (grob-interpret-markup grob #{ \markup \concat { \with-dimensions #'(0 . 0) #'(0 . 0) \translate-scaled #'(-.45 . 0) \override #'(thickness . 2) \draw-line #'(1.78 . 0) \hspace #-.21 \musicglyph #"noteheads.s2" \hspace #-.25 } #})) ((= pos -7) (grob-interpret-markup grob #{ \markup \concat { \with-dimensions #'(0 . 0) #'(0 . 0) \override #'(thickness . 2) \translate-scaled #'(-.45 . .5) \draw-line #'(1.78 . 0) \hspace #-.21 \musicglyph #"noteheads.s2" \hspace #-.25 } #})) ((= pos -8) (grob-interpret-markup grob #{ \markup \concat { \with-dimensions #'(0 . 0) #'(0 . 0) \override #'(thickness . 2) \translate-scaled #'(-.45 . 1) \draw-line #'(1.78 . 0) \with-dimensions #'(0 . 0) #'(0 . 0) \override #'(thickness . 2) \translate-scaled #'(-.45 . 0) \draw-line #'(1.78 . 0) \hspace #-.21 \musicglyph #"noteheads.s2" \hspace #-.25 } #})) (else (grob-interpret-markup grob #{ \markup \concat { \hspace #-.21 \musicglyph #"noteheads.s2" \hspace #-.25 } #}))))) \override Accidental.extra-offset = #'(-.2 . 0) %%% TODO: find a fixed ledger line with no dimension %% see: http://lilypond.1069038.n5.nabble.com/Fixed-ledger-line-width-with-no-dimension-tc172180.html %\override LedgerLineSpanner.length-fraction = #'() %%% ??? %\override LedgerLineSpanner.minimum-length-fraction = #'() %%% ??? } neume = #(define-music-function (parser location mus) (ly:music?) #{ \once\override NoteHead.stencil = #(lambda (grob) (grob-interpret-markup grob #{ \markup\concat { \hspace #-2 \score { \transpose c c' { \omit Stem $mus } \layout { indent = 0 ragged-right = ##t \context { \Score \gregorianContext } } } } #})) #}) melisma = #(define-music-function (parser location mus) (ly:music?) #{ { \once\override Lyrics.LyricText.self-alignment-X = #LEFT \neume { $mus } \omit Accidental \omit Dots #(make-music 'NoteEvent 'pitch (ly:make-pitch -1 6 0) 'duration (ly:make-duration 2 0 1)) } #}) % Declare default layout \layout { \context { \Score \omit TimeSignature } } %%%%%%%%%%%% end of "modernGregorian.ily" %%%%%%%%%
\score { << \new Voice { \stopStaff c'1 } >> }
\layout { \context { \Staff \RemoveEmptyStaves \override VerticalAxisGroup.remove-first = ##t } } }
\score { << \new Voice { c'1 c'2 c'4 } >> } \layout { \context { \Staff \remove "Time_signature_engraver" } }
\score { << \new Voice { c'1 c'2 c'4 } >> } \layout { \context { \Staff \remove "Clef_engraver" } }
\score { << \new Voice { c'1 c'2 c'4 } >> } \layout { \context { \Staff \remove "Bar_engraver" } }
do4 re \hide Staff.Stem mi fa \undo \stemOff sol la