[ << Editorial annotations ] | [Part superior][Continguts] | [ Vocal music >> ] |
[ < ] | [ Amunt : Top ] | [ > ] |
Text
[ << Text ] | [Part superior][Continguts] | [ Vocal music >> ] |
[ < Text ] | [ Amunt : Text ] | [ > ] |
Adding a QR code
This snippet lets you draw a QR-code, for example to provide a link to the composer’s, or the music editor’s website. Actually encoding the URL into a QR-code is not done here (this just draws the QR-code from a grid of "black" or "white" values), but see the code for a short Python snippet you can use to avoid having to fill for each small square if it’s black or white.
%% Original thread: https://lists.gnu.org/archive/html/lilypond-user-fr/2022-07/msg00005.html %% (snippet author: Jean Abou Samra <jean@abou-samra.fr>) \paper { tagline = ##f } #(define (index-map f . lsts) "Applies @code{f} to corresponding elements of @code{lists}, just as @code{map}, providing an additional counter starting at zero. @code{f} needs to have the counter in its arguments like @code{(index-map (lambda (i arg) <body>) lists)}" (let loop ((lsts lsts) (acc '()) (i 0)) (if (any null? lsts) (reverse! acc) (loop (map cdr lsts) (cons (apply f i (map car lsts)) acc) (1+ i))))) #(define-markup-command (qr-code layout props data) (string?) #:properties ((width 10)) (let* (;; Return lines in reversed order, since translating in Y-axis ;; uses increasing values. Meaning lines will be stacked upwards. (lines (reverse (remove string-null? (map string-trim-both (string-split data #\newline))))) (n (length lines)) (square-width (/ width n)) (box (make-filled-box-stencil `(0 . ,square-width) `(0 . ,square-width)))) ;; Build the final qr-code-stencil from line-stencils list (apply ly:stencil-add ;; Get a list of line-stencils (index-map (lambda (i line) ;; Build a line-stencil from square-stencils list (apply ly:stencil-add ;; Get a list of (already translated) square-stencils ;; per line (index-map (lambda (j char) (ly:stencil-translate (stencil-with-color box (case char ((#\0) white) ((#\1) black) (else (ly:warning "unrecognized character ~a, should be 0 or 1" char) red))) (cons (* j square-width) (* i square-width)))) (string->list line)))) lines)))) %{ A string representation of the QR code. 0 means white, 1 means black. You can generate this automatically using Python and the pyqrcode module ("pip install pyqrcode"). Use this line of code in a Python prompt: >>> import pyqrcode; print(pyqrcode.create("https://lilypond.org").text(quiet_zone=0)) %} lilypondDotOrg = "11111110011100011110101111111 10000010010000010111101000001 10111010010110001000101011101 10111010001010111101001011101 10111010110100000111001011101 10000010011100011001101000001 11111110101010101010101111111 00000000111000111110100000000 00110011101100001000111010000 10101001111000001000001111101 00110111010100000110001011010 01010001100110010111000110001 01111011110010011110010100111 01111101001101010001001101101 01111011000001000011001111011 11001001001011001000111011010 11100110111011011001110111000 00001100010001001011100100100 10111111011001010011001000100 00001100001000101011011011100 01010010000011000000111111111 00000000110011100010100011001 11111110101001101011101010110 10000010000110111110100010011 10111010011010111100111111111 10111010110001101111000011110 10111010100101101010100101001 10000010001001000100000010010 11111110010100110010111100010" \markup \qr-code \lilypondDotOrg \markup \vspace #5 \markup \override #'(width . 15) \qr-code \lilypondDotOrg
[ << Text ] | [Part superior][Continguts] | [ Vocal music >> ] |
[ < ] | [ Amunt : Text ] | [ > ] |
Adding markups in a tablature
By default markups does not show in a tablature.
To make them appear, simply use the command
\revert TabStaff.TextScript.stencil
%% http://lsr.di.unimi.it/LSR/Item?id=919 % by P.P.Schneider on June 2014 high = { r4 r8 <g c'> q r8 r4 } low = { c4 r4 c8 r8 g,8 b, } pulse = { s8^"1" s^"&" s^"2" s^"&" s^"3" s^"&" s^"4" s^"&" } \score { \new TabStaff { \repeat unfold 2 << \high \\ \low \\ \pulse >> } \layout { \context { \TabStaff \clef moderntab \revert TextScript.stencil \override TextScript.font-series = #'bold \override TextScript.font-size = #-2 \override TextScript.color = #red } \context { \Score proportionalNotationDuration = #(ly:make-moment 1/8) } } }
[ << Text ] | [Part superior][Continguts] | [ Vocal music >> ] |
[ < ] | [ Amunt : Text ] | [ > ] |
Afegir la data actual a una partitura
Amb quelcom de codi de l’Scheme, es pot afegir fàcilment la data actual a una partitura.
% first, define a variable to hold the formatted date: date = #(strftime "%d-%m-%Y" (localtime (current-time))) % use it in the title block: \header { title = "Including the date!" subtitle = \date } \score { \relative c'' { c4 c c c } } % and use it in a \markup block: \markup { \date }
[ << Text ] | [Part superior][Continguts] | [ Vocal music >> ] |
[ < ] | [ Amunt : Text ] | [ > ] |
Ajustament de l’espaiat vertical de la lletra
Aquest fragment de codi mostra com situar la línia de base de la lletra més a prop del pentagrama.
% Default layout: << \new Staff \new Voice = melody \relative c' { c4 d e f g4 f e d c1 } \new Lyrics \lyricsto melody { aa aa aa aa aa aa aa aa aa } \new Staff { \new Voice = melody \relative c' { c4 d e f g4 f e d c1 } } % Reducing the minimum space below the staff and above the lyrics: \new Lyrics \with { \override VerticalAxisGroup.nonstaff-relatedstaff-spacing = #'((basic-distance . 1)) } \lyricsto melody { aa aa aa aa aa aa aa aa aa } >>
[ << Text ] | [Part superior][Continguts] | [ Vocal music >> ] |
[ < ] | [ Amunt : Text ] | [ > ] |
Alinear i centrar els noms dels instruments
L’alineació horitzontal dels noms d’instruments es pot ajustar
modificant la propietat Staff.InstrumentName #'self-alignment-X
.
Les variables de \layout
, indent
i short-indent
defineixen l’espai en el qual s’alineen els noms d’instrument abans
del primer sistema i dels següents, respectivament.
\paper { left-margin = 3\cm } \score { \new StaffGroup << \new Staff \with { \override InstrumentName.self-alignment-X = #LEFT instrumentName = \markup \left-column { "Left aligned" "instrument name" } shortInstrumentName = "Left" } { c''1 \break c''1 } \new Staff \with { \override InstrumentName.self-alignment-X = #CENTER instrumentName = \markup \center-column { Centered "instrument name" } shortInstrumentName = "Centered" } { g'1 g'1} \new Staff \with { \override InstrumentName.self-alignment-X = #RIGHT instrumentName = \markup \right-column { "Right aligned" "instrument name" } shortInstrumentName = "Right" } { e'1 e'1 } >> \layout { ragged-right = ##t indent = 4\cm short-indent = 2\cm } }
[ << Text ] | [Part superior][Continguts] | [ Vocal music >> ] |
[ < ] | [ Amunt : Text ] | [ > ] |
Alineació de síl·labes amb melisma
De forma predeterminada, les síl·labes de la lletra que comencen
un melisma s’alineen a l’esquerra sobre la seva nota corresponent.
Es pot alterar l’alineació usant la propietat
lyricMelismaAlignment
.
\score { << \new Staff { \relative c'' \new Voice = "vocal" { c d~^\markup default d e c d~^\markup "right aligned" d e c d~^\markup "center aligned" d e c d~^\markup "reset to default" d e } } \new Lyrics \lyricsto "vocal" { word word word \set lyricMelismaAlignment = #RIGHT word word word \set lyricMelismaAlignment = #CENTER word word word \unset lyricMelismaAlignment word word word } >> }
[ << Text ] | [Part superior][Continguts] | [ Vocal music >> ] |
[ < ] | [ Amunt : Text ] | [ > ] |
Posar en blanc les línies del utilitzant l’ordre \whiteout
L’ordre \whiteout
intercala un rectangle blanc a sota
d’un element de marcatge. Aquest rectangle blanc no tapa a cap
altre objecte gràfic, atès que les línies del pentagrama
estan en una capa inferior a la de la major part dels altres
objectes.
\layout { ragged-right = ##f } \relative c' { \override TextScript.extra-offset = #'(2 . 4) c2-\markup { \whiteout \pad-markup #0.5 "middle C" } c }
[ << Text ] | [Part superior][Continguts] | [ Vocal music >> ] |
[ < ] | [ Amunt : Text ] | [ > ] |
Centrar text a sota d’un regulador
Aquest exemple proporciona una funció per escriure un regulador amb text a sota, com “molto” o “poco”. El text afegit canvia la direcció d’acord amb la del regulador. L’objecte hairpin està alineat amb DynamicText.
L’exemple il·lustra també com modificar la manera en la qual s’imprimeix normalment un object, utilitzat codi de l’Scheme.
\paper { tagline = ##f } hairpinWithCenteredText = #(define-music-function (text) (markup?) #{ \once \override Voice.Hairpin.after-line-breaking = #(lambda (grob) (let* ((stencil (ly:hairpin::print grob)) (par-y (ly:grob-parent grob Y)) (dir (ly:grob-property par-y 'direction)) (staff-line-thickness (ly:output-def-lookup (ly:grob-layout grob) 'line-thickness)) (new-stencil (ly:stencil-aligned-to (ly:stencil-combine-at-edge (ly:stencil-aligned-to stencil X CENTER) Y dir (ly:stencil-aligned-to (grob-interpret-markup grob (make-fontsize-markup (magnification->font-size (+ (ly:staff-symbol-staff-space grob) (/ staff-line-thickness 2))) text)) X CENTER)) X LEFT)) (staff-space (ly:output-def-lookup (ly:grob-layout grob) 'staff-space)) (par-x (ly:grob-parent grob X)) (dyn-text (grob::has-interface par-x 'dynamic-text-interface)) (dyn-text-stencil-x-length (if dyn-text (interval-length (ly:stencil-extent (ly:grob-property par-x 'stencil) X)) 0)) (x-shift (if dyn-text (- (+ staff-space dyn-text-stencil-x-length) (* 0.5 staff-line-thickness)) 0))) (ly:grob-set-property! grob 'Y-offset 0) (ly:grob-set-property! grob 'stencil (ly:stencil-translate-axis new-stencil x-shift X)))) #}) hairpinMolto = \hairpinWithCenteredText \markup { \italic molto } hairpinMore = \hairpinWithCenteredText \markup { \larger moltissimo } \layout { ragged-right = ##f } \relative c' { \hairpinMolto c2\< c\f \hairpinMore c2\ppppp\< c\f \break \hairpinMolto c2^\< c\f \hairpinMore c2\ppppp\< c\f }
[ << Text ] | [Part superior][Continguts] | [ Vocal music >> ] |
[ < ] | [ Amunt : Text ] | [ > ] |
Changing ottava text
Internally, \ottava
sets the properties ottavation
(for
example, to 8va
or 8vb
) and middleCPosition
. To
override the text of the bracket, set ottavation
after invoking
\ottava
.
Short text is especially useful when a brief ottava is used.
{ c'2 \ottava #1 \set Staff.ottavation = #"8" c''2 \ottava #0 c'1 \ottava #1 \set Staff.ottavation = #"Text" c''1 }
[ << Text ] | [Part superior][Continguts] | [ Vocal music >> ] |
[ < ] | [ Amunt : Text ] | [ > ] |
Canviar la família de tipus de lletra predeterminada per al text
Les famílies de tipus de lletra per al text es poden sobreescriure amb
make-pango-font-tree
.
%{ You may have to install additional fonts. Red Hat Fedora dejavu-fonts-all Debian GNU/Linux, Ubuntu fonts-dejavu-core fonts-dejavu-extra %} \paper { % change for other default global staff size. myStaffSize = #20 %{ run lilypond -dshow-available-fonts to show all fonts available in the process log. %} #(define fonts (make-pango-font-tree "DejaVu Serif" "DejaVu Sans" "DejaVu Sans Mono" (/ myStaffSize 20))) } { g'''4^\markup { DejaVu Serif: \bold bold \italic italic \italic \bold { bold italic } } g4_\markup { \override #'(font-family . sans) { DejaVu Sans: \bold bold \italic italic \italic \bold { bold italic } } } g''2^\markup { \override #'(font-family . typewriter) { DejaVu Sans Mono: \bold bold \italic italic \italic \bold { bold italic } } } }
[ << Text ] | [Part superior][Continguts] | [ Vocal music >> ] |
[ < ] | [ Amunt : Text ] | [ > ] |
Combinar indicacions dinàmiques amb marcatges textuals
Certes indicacions dinàmiques poden portar textos (com “più
forte” o “piano subito”). Es poden produir usant un bloc
\markup
.
piuF = \markup { \italic più \dynamic f } \layout { ragged-right = ##f } \relative c'' { c2\f c-\piuF }
[ << Text ] | [Part superior][Continguts] | [ Vocal music >> ] |
[ < ] | [ Amunt : Text ] | [ > ] |
Combinar dues parts sobre el mateix pentagrama
L’eina de combinació de parts (ordre \partcombine
) permet la
combinació de diverses parts diferents sobre el mateix pentagrama.
Les indicacions textuals com ara “solo” o “a2” s’afegeixen de
forma predeterminada; per treure-les, senzillament heu d’establir la
propietat printPartCombineTexts
al valor “fals”. Per a
partitures vocals (com himnes), no cal afegir els textos “solo”
o “a2”, per la qual cosa s’han de deshabilitar. No obstant, podria
ser millor no usar-lo si hi ha solos, perquè no s’indicaran. En
aquests casos podria ser preferible la notació polifònica estàndard.
Aquest fragment de codi presenta les tres formes en las quals es poden
imprimir dues parts sobre un sol pentagrama: polifonia estàndard,
\partcombine
sense textos, i \partcombine
amb
texts.
%% Combining pedal notes with clef changes musicUp = \relative c'' { \time 4/4 a4 c4.( g8) a4 | g4 e' g,( a8 b) | c b a2. } musicDown = \relative c'' { g4 e4.( d8) c4 | r2 g'4( f8 e) | d2 \stemDown a } \score { << \new Staff \with { instrumentName = "Standard polyphony" } << \musicUp \\ \musicDown >> \new Staff \with { instrumentName = "PartCombine without text" printPartCombineTexts = ##f } \partCombine \musicUp \musicDown \new Staff \with { instrumentName = "PartCombine with text" } \partCombine \musicUp \musicDown >> \layout { indent = 6.0\cm \context { \Score \override SystemStartBar.collapse-height = #30 } } }
[ << Text ] | [Part superior][Continguts] | [ Vocal music >> ] |
[ < ] | [ Amunt : Text ] | [ > ] |
Crear indicacions dinàmiques "vertaderes" entre parèntesis
Tot i que la manera més fàcil d’afegir parèntesis a una indicació
de dinàmica és utilitzar un bloc \markup
, aquest mètode té
un inconvenient: els objectes que es creen es comportaran com
elements de marcatge de text i no com indicacions dinàmiques.
No obstant, és possible crear un objecte utilitzant el codi de
l’Scheme equivalent (com s’explica a la Referència de la notació),
en combinació amb la funció make-dynamic-script
. D’aquesta
forma l’element de marcatge es tractarà com una indicació
dinàmica, i per tant seguirà sent compatible amb ordre com ara
\dynamicUp
o \dynamicDown
.
paren = #(define-event-function (dyn) (ly:event?) (make-dynamic-script #{ \markup \concat { \normal-text \italic \fontsize #2 ( \pad-x #0.2 #(ly:music-property dyn 'text) \normal-text \italic \fontsize #2 ) } #})) \relative c'' { c4\paren\f c c \dynamicUp c\paren\p }
[ << Text ] | [Part superior][Continguts] | [ Vocal music >> ] |
[ < ] | [ Amunt : Text ] | [ > ] |
Crear elements de extensió textuals
Les ordres \startTextSpan
i \stopTextSpan
permeten la creació d’elements d’extensió textuals tan
fàcilment com indicacions de pedal o octavacions. Sobreescrivim
certes propietats de l’object TextSpanner
per modificar
la seva sortida.
\paper { ragged-right = ##f } \relative c'' { \override TextSpanner.bound-details.left.text = #"bla" \override TextSpanner.bound-details.right.text = #"blu" a4 \startTextSpan b4 c a4 \stopTextSpan \override TextSpanner.style = #'line \once \override TextSpanner.bound-details.left.stencil-align-dir-y = #CENTER a4 \startTextSpan b4 c a4 \stopTextSpan \override TextSpanner.style = #'dashed-line \override TextSpanner.bound-details.left.text = \markup { \draw-line #'(0 . 1) } \override TextSpanner.bound-details.right.text = \markup { \draw-line #'(0 . -2) } \once \override TextSpanner.bound-details.right.padding = #-2 a4 \startTextSpan b4 c a4 \stopTextSpan \set Staff.middleCPosition = #-13 \override TextSpanner.dash-period = #10 \override TextSpanner.dash-fraction = #0.5 \override TextSpanner.thickness = #10 a4 \startTextSpan b4 c a4 \stopTextSpan }
[ << Text ] | [Part superior][Continguts] | [ Vocal music >> ] |
[ < ] | [ Amunt : Text ] | [ > ] |
Mostra de cadascú dels encapçalaments possibles
Mostra de tots els tipus d’encapçalament.
\header { copyright = "copyright" title = "title" subtitle = "subtitle" composer = "composer" arranger = "arranger" instrument = "instrument" meter = "meter" opus = "opus" piece = "piece" poet = "poet" texidoc = "All header fields with special meanings." copyright = "public domain" enteredby = "jcn" source = "urtext" } \layout { ragged-right = ##f } \score { \relative c'' { c1 | c | c | c } } \score { \relative c'' { c1 | c | c | c } \header { title = "localtitle" subtitle = "localsubtitle" composer = "localcomposer" arranger = "localarranger" instrument = "localinstrument" metre = "localmetre" opus = "localopus" piece = "localpiece" poet = "localpoet" copyright = "localcopyright" } }
[ << Text ] | [Part superior][Continguts] | [ Vocal music >> ] |
[ < ] | [ Amunt : Text ] | [ > ] |
Inserir PostScript nadiu dins d’un bloc \markup
Es pot inserir codi PostScript directament dins d’un bloc
\markup
.
% PostScript is a registered trademark of Adobe Systems Inc. \relative c'' { a4-\markup { \postscript "3 4 moveto 5 3 rlineto stroke" } -\markup { \postscript "[ 0 1 ] 0 setdash 3 5 moveto 5 -3 rlineto stroke " } b4-\markup { \postscript "3 4 moveto 0 0 1 2 8 4 20 3.5 rcurveto stroke" } s2 a'1 }
[ << Text ] | [Part superior][Continguts] | [ Vocal music >> ] |
[ < ] | [ Amunt : Text ] | [ > ] |
Donar format a síl·labes de la lletra
És possible usar el mode de marcatge per donar format a síl·labes individualment dins de la lletra.
mel = \relative c'' { c4 c c c } lyr = \lyricmode { Lyrics \markup { \italic can } \markup { \with-color #red contain } \markup { \fontsize #8 \bold Markup! } } << \new Voice = melody \mel \new Lyrics \lyricsto melody \lyr >>
[ << Text ] | [Part superior][Continguts] | [ Vocal music >> ] |
[ < ] | [ Amunt : Text ] | [ > ] |
Com posar lligadures entre síl·labes de la lletra
Es pot fer separant les síl·labes mitjançant símbols de titlle corb.
\lyrics { wa~o~a }
[ << Text ] | [Part superior][Continguts] | [ Vocal music >> ] |
[ < ] | [ Amunt : Text ] | [ > ] |
Alineació de la lletra
L’alineació horitzontal de la lletra es pot ajustar sobreescrivint
la propietat self-alignment-X
de l’objecte LyricText
.
#-1
és esquerra, #0
és centrat #1
es dreta;
tanmateix, podem usar també #LEFT
, #CENTER
i
#RIGHT
.
\layout { ragged-right = ##f } \relative c'' { c1 c1 c1 } \addlyrics { \once \override LyricText.self-alignment-X = #LEFT "This is left-aligned" \once \override LyricText.self-alignment-X = #CENTER "This is centered" \once \override LyricText.self-alignment-X = #1 "This is right-aligned" }
[ << Text ] | [Part superior][Continguts] | [ Vocal music >> ] |
[ < ] | [ Amunt : Text ] | [ > ] |
Markup list
Text that can spread over pages is entered with the \markuplist
command.
%% updated/modified by P.P.Schneider on Feb. 2014 #(set-default-paper-size "a6") #(define-markup-list-command (paragraph layout props args) (markup-list?) (interpret-markup-list layout props (make-justified-lines-markup-list (cons (make-hspace-markup 2) args)))) % Candide, Voltaire \markuplist { \override-lines #'(baseline-skip . 2.5) { \paragraph { Il y avait en Westphalie, dans le château de M. le baron de Thunder-ten-tronckh, un jeune garçon à qui la nature avait donné les mœurs les plus douces. Sa physionomie annonçait son âme. Il avait le jugement assez droit, avec l'esprit le plus \concat { simple \hspace #.3 ; } c'est, je crois, pour cette raison qu'on le nommait Candide. Les anciens domestiques de la maison soupçonnaient qu'il était fils de la sœur de monsieur le baron et d'un bon et honnête gentilhomme du voisinage, que cette demoiselle ne voulut jamais épouser parce qu'il n'avait pu prouver que soixante et onze quartiers, et que le reste de son arbre généalogique avait été perdu par l'injure du temps. } \vspace #.3 \paragraph { Monsieur le baron était un des plus puissants seigneurs de la Westphalie, car son château avait une porte et des fenêtres. Sa grande salle même était ornée d'une tapisserie. Tous les chiens de ses basses-cours composaient une meute dans le \concat { besoin \hspace #.3 ; } ses palefreniers étaient ses \concat { piqueurs \hspace #.3 ; } le vicaire du village était son grand-aumônier. Ils l'appelaient tous monseigneur, et ils riaient quand il faisait des contes. } } }
[ << Text ] | [Part superior][Continguts] | [ Vocal music >> ] |
[ < ] | [ Amunt : Text ] | [ > ] |
Marcatge de silencis multicompàs
Els elements de marcatge aplicats a un silenci multicompàs se centren a sobre o a sota del silenci. Els elements de marcatge extensos que s’adjunten a silencis multicompàs no produeixen l’expansió del comàs. Per expandir un silenci multicompàs de forma que càpiga tot el marcatge, utilitzeu un acord buit amb un marcatge aplicat abans del silenci multicompàs.
El text aplicat a un silenci separador d’aquesta forma s’alinea per l’esquerra a la posició en la qual la nota estaria situada dins del compàs, però si la longitud del compàs està determinada per la longitud del text, el text apareixerà centrat.
\relative c' { \compressMMRests { \textLengthOn <>^\markup { [MAJOR GENERAL] } R1*19 <>_\markup { \italic { Cue: ... it is yours } } <>^\markup { A } R1*30^\markup { [MABEL] } \textLengthOff c4^\markup { CHORUS } d f c } }
[ << Text ] | [Part superior][Continguts] | [ Vocal music >> ] |
[ < ] | [ Amunt : Text ] | [ > ] |
Of the ubiquity of markup objects
Text objects are entered either as simple strings between double quotes
or as \markup
blocks that can accept a variety of advanced text
formatting and graphical enhancements.
As such, markup blocks may be used:
-
in any TextScript object (attached to notes with
-
,^
or_
), -
any
TextMark
introduced with the\textMark
or\textEndMark
command, or other similar objects such as MetronomeMark introduced with\tempo
, -
as standalone markup blocks, entered at the top level outside of any
\score
block, -
in any definition inside the
\header
block (e.g. title, subtitle, composer) or in some variables defined inside the\paper
block such asevenHeaderMarkup
for page numbers.
\markup
may additionally be used for lyrics, in chord names,
and as dynamics. In fact, it is possible to use \markup
to
customize the appearance of virtually any object, as demonstrated in
this example using various methods.
%% Thanks to Aaron Hill https://lists.gnu.org/archive/html/lilypond-user/2019-01/msg00437.html \paper { paper-width = 8\cm paper-height = 8\cm } \header { title = \markup "Header" tagline = \markup "(tagline)" } \markup "Top-level markup" dyn = #(make-dynamic-script #{ \markup \text "DynamicText" #}) \score { << \new ChordNames \with { majorSevenSymbol = \markup "majorSevenSymbol" } \chordmode { c1:maj7 } \new Staff { \tempo \markup "MetronomeMark" \textMark "TextMark" \once \override TupletNumber.text = \markup "TupletNumber" \tuplet 3/2 { \once \override NoteHead.stencil = #ly:text-interface::print \once \override NoteHead.text = \markup \lower #0.5 "NoteHead" c''8^\markup "TextScript" \once \override Rest.stencil = #(lambda (grob) (grob-interpret-markup grob #{ \markup "Rest" #})) r4 } } \new Lyrics \lyricmode { \markup "LyricText" 1 } \new Dynamics { s1\dyn } >> }
[ << Text ] | [Part superior][Continguts] | [ Vocal music >> ] |
[ < ] | [ Amunt : Text ] | [ > ] |
Imprimir el número de versió
Introduint la sortida de lilypond-version
en la lletra d’una
cançó, és possible imprimir el número de versió del LilyPond dins
d’una partitura, o en un document generat amb lilypond-book
.
Una altra possibilitat és afegir el número de versió al final de la
doc-string, d’aquesta forma:
\markup { Processed with LilyPond version #(lilypond-version) }
[ << Text ] | [Part superior][Continguts] | [ Vocal music >> ] |
[ < ] | [ Amunt : Text ] | [ > ] |
Plantilla de piano amb lletra centrada
En comptes de tenir un pentagrama dedicat a la melodia i la lletra, la lletra es pot centrar entre els pentagrames d’un sistema de piano.
upper = \relative c'' { \clef treble \key c \major \time 4/4 a4 b c d } lower = \relative c { \clef bass \key c \major \time 4/4 a2 c } text = \lyricmode { Aaa Bee Cee Dee } \score { \new PianoStaff << \new Staff = upper { \new Voice = "singer" \upper } \new Lyrics \lyricsto "singer" \text \new Staff = lower { \lower } >> \layout { } \midi { } }
[ << Text ] | [Part superior][Continguts] | [ Vocal music >> ] |
[ < ] | [ Amunt : Text ] | [ > ] |
Printing bar numbers with changing regular intervals
Using the set-bar-number-visibility
context function, bar number
intervals can be changed.
\relative c' { \override Score.BarNumber.break-visibility = #end-of-line-invisible \context Score \applyContext #(set-bar-number-visibility 4) \repeat unfold 10 c'1 \context Score \applyContext #(set-bar-number-visibility 2) \repeat unfold 10 c }
[ << Text ] | [Part superior][Continguts] | [ Vocal music >> ] |
[ < ] | [ Amunt : Text ] | [ > ] |
Impressió de marques d’assaig en qualsevol pentagrama
Tot i que normalment les marques d’assaig textuals sols s’imprimeixen sobre el pentagrama superior, també es poden imprimir en un altra pentagrama qualsevol.
\score { << \new Staff { \mark \default c''1 \textMark "molto" c'' } \new Staff { \mark \default c'1 \textMark "molto" c' } >> \layout { \context { \Score \remove Mark_engraver \remove Text_mark_engraver \remove Staff_collecting_engraver } \context { \Staff \consists Mark_engraver \consists Text_mark_engraver \consists Staff_collecting_engraver } } }
[ << Text ] | [Part superior][Continguts] | [ Vocal music >> ] |
[ < ] | [ Amunt : Text ] | [ > ] |
Impressió de text de dreta a esquerra
És possible imprimir text de dreta a esquerra en un element de marcatge, com es mostra aquí.
{ b1^\markup { \line { i n g i r u m i m u s n o c t e } } f'_\markup { \override #'(text-direction . -1) \line { i n g i r u m i m u s n o c t e } } }
[ << Text ] | [Part superior][Continguts] | [ Vocal music >> ] |
[ < ] | [ Amunt : Text ] | [ > ] |
Posar lletra dins del pentagrama
Es poden moure les línies de lletra verticalment per imprimir-les dins
del pentagrama. Les lletres es mouen amb \override
LyricText.extra-offset = #'(0 . dy)
i hi ha instruccions per
moure les línies d’extensió i els guions. El desplaçament necessari
s’estableix mitjançant un procés d’assaig i error.
<< \new Staff << \new Voice = "voc" \relative c' { \stemDown a bes c8 b c4 } >> \new Lyrics \with { \override LyricText.extra-offset = #'(0 . 8.6) \override LyricExtender.extra-offset = #'(0 . 8.6) \override LyricHyphen.extra-offset = #'(0 . 8.6) } \lyricsto "voc" { La la -- la __ _ la } >>
[ << Text ] | [Part superior][Continguts] | [ Vocal music >> ] |
[ < ] | [ Amunt : Text ] | [ > ] |
Element de marcatge de text independent en dues columnes
Els textos independents es poden disposar en diverses columnes
utilitzant ordres \markup
:
\markup { \fill-line { \hspace #1 \column { \line { O sacrum convivium } \line { in quo Christus sumitur, } \line { recolitur memoria passionis ejus, } \line { mens impletur gratia, } \line { futurae gloriae nobis pignus datur. } \line { Amen. } } \hspace #2 \column \italic { \line { O sacred feast } \line { in which Christ is received, } \line { the memory of His Passion is renewed, } \line { the mind is filled with grace, } \line { and a pledge of future glory is given to us. } \line { Amen. } } \hspace #1 } }
[ << Text ] | [Part superior][Continguts] | [ Vocal music >> ] |
[ < ] | [ Amunt : Text ] | [ > ] |
Línies d’extensió per a nombre de corda
Fem una línia extensora per a les indicacions de nombre de corda, mostrant que una sèrie de notes s’han de tocar sobre la mateixa corda.
stringNumberSpanner = #(define-music-function (StringNumber) (string?) #{ \override TextSpanner.style = #'solid \override TextSpanner.font-size = #-5 \override TextSpanner.bound-details.left.stencil-align-dir-y = #CENTER \override TextSpanner.bound-details.left.text = \markup { \circle \number $StringNumber } #}) \relative c { \clef "treble_8" \stringNumberSpanner "5" \textSpannerDown a8\startTextSpan b c d e f\stopTextSpan \stringNumberSpanner "4" g\startTextSpan a bes4 a g2\stopTextSpan }
[ << Text ] | [Part superior][Continguts] | [ Vocal music >> ] |
[ < ] | [ Amunt : Text ] | [ > ] |
Rectangle de tres segments visibles
Aquest exemple mostra com afegir una ordre de marcatge per obtenir un rectangle de tres segments visibles rodejant un element de text (o un altre element de marcatge).
% New command to add a three sided box, with sides north, west and south % Based on the box-stencil command defined in scm/stencil.scm % Note that ";;" is used to comment a line in Scheme #(define-public (NWS-box-stencil stencil thickness padding) "Add a box around STENCIL, producing a new stencil." (let* ((x-ext (interval-widen (ly:stencil-extent stencil X) padding)) (y-ext (interval-widen (ly:stencil-extent stencil Y) padding)) (y-rule (make-filled-box-stencil (cons 0 thickness) y-ext)) (x-rule (make-filled-box-stencil (interval-widen x-ext thickness) (cons 0 thickness)))) ;; (set! stencil (ly:stencil-combine-at-edge stencil X 1 y-rule padding)) (set! stencil (ly:stencil-combine-at-edge stencil X LEFT y-rule padding)) (set! stencil (ly:stencil-combine-at-edge stencil Y UP x-rule 0.0)) (set! stencil (ly:stencil-combine-at-edge stencil Y DOWN x-rule 0.0)) stencil)) % The corresponding markup command, based on the \box command defined % in scm/define-markup-commands.scm #(define-markup-command (NWS-box layout props arg) (markup?) #:properties ((thickness 0.1) (font-size 0) (box-padding 0.2)) "Draw a box round @var{arg}. Looks at @code{thickness}, @code{box-padding} and @code{font-size} properties to determine line thickness and padding around the markup." (let ((pad (* (magstep font-size) box-padding)) (m (interpret-markup layout props arg))) (NWS-box-stencil m thickness pad))) % Test it: \relative c' { c1^\markup { \NWS-box ABCD } c1^\markup { \NWS-box \note {4} #1.0 } }
[ << Text ] | [Part superior][Continguts] | [ Vocal music >> ] |
[ < ] | [ Amunt : Text ] | [ > ] |
UTF-8
Es poden usar diversos sistemes d’escriptura per a textos (com ara títols o la lletra de les cançons) si s’introdueixen amb la codificació UTF-8, i utilitzant un motor basat en el Pango. Depenent dels tipus de lletra instal·lats, aquest fragment compon textos en búlgar (ciríl·lic), hebreu, japonès i portuguès.
%{ You may have to install additional fonts. Red Hat Fedora linux-libertine-fonts (Latin, Cyrillic, Hebrew) google-noto-serif-jp-fonts (Japanese) Debian GNU/Linux, Ubuntu fonts-linuxlibertine (Latin, Cyrillic, Hebrew) fonts-noto-cjk (Japanese) %} % 'Linux Libertine' fonts also contain Cyrillic and Hebrew glyphs. \paper { #(define fonts (set-global-fonts #:roman "Linux Libertine O, Noto Serif CJK JP, Noto Serif JP" )) } bulgarian = \lyricmode { Жълтата дюля беше щастлива, че пухът, който цъфна, замръзна като гьон. } hebrew = \lyricmode { זה כיף סתם לשמוע איך תנצח קרפד עץ טוב בגן. } japanese = \lyricmode { いろはにほへど ちりぬるを わがよたれぞ つねならむ うゐのおくや まけふこえて あさきゆめみじ ゑひもせず } % "a nice song for you" portuguese = \lyricmode { à vo -- cê uma can -- ção le -- gal } \relative c' { c2 d e2 f g2 f e2 d } \addlyrics { \bulgarian } \addlyrics { \hebrew } \addlyrics { \japanese } \addlyrics { \portuguese }
[ << Text ] | [Part superior][Continguts] | [ Vocal music >> ] |
[ < ] | [ Amunt : Text ] | [ > ] |
Plantilla per a conjunt amb lletres alineades a sobre i a sota dels pentagrames
Aquesta plantilla és, bàsicament, la mateixa que la senzilla plantilla
“Conjunt vocal”, excepte que aquí totes les línies de lletra es
col·loquen utilitzant alignAboveContext
i alignBelowContext
.
global = { \key c \major \time 4/4 } sopMusic = \relative c'' { c4 c c8[( b)] c4 } sopWords = \lyricmode { hi hi hi hi } altoMusic = \relative c' { e4 f d e } altoWords = \lyricmode { ha ha ha ha } tenorMusic = \relative c' { g4 a f g } tenorWords = \lyricmode { hu hu hu hu } bassMusic = \relative c { c4 c g c } bassWords = \lyricmode { ho ho ho ho } \score { \new ChoirStaff << \new Staff = "women" << \new Voice = "sopranos" { \voiceOne << \global \sopMusic >> } \new Voice = "altos" { \voiceTwo << \global \altoMusic >> } >> \new Lyrics \with { alignAboveContext = #"women" } \lyricsto "sopranos" \sopWords \new Lyrics \with { alignBelowContext = #"women" } \lyricsto "altos" \altoWords % we could remove the line about this with the line below, since % we want the alto lyrics to be below the alto Voice anyway. % \new Lyrics \lyricsto "altos" \altoWords \new Staff = "men" << \clef bass \new Voice = "tenors" { \voiceOne << \global \tenorMusic >> } \new Voice = "basses" { \voiceTwo << \global \bassMusic >> } >> \new Lyrics \with { alignAboveContext = #"men" } \lyricsto "tenors" \tenorWords \new Lyrics \with { alignBelowContext = #"men" } \lyricsto "basses" \bassWords % again, we could replace the line above this with the line below. % \new Lyrics \lyricsto "basses" \bassWords >> }
[ << Text ] | [Part superior][Continguts] | [ Vocal music >> ] |
[ < ] | [ Amunt : Text ] | [ Vocal music > ] |
Elements de marcatge per al text de les caselles de repetició usant repeatCommands
Tot i que les caselles de repetició s’especifiquen de forma òptima
usant \repeat volta
, s’ha d’usar la propietat de context
repeatCommands
en cas que el text de la casella requereixi
un format més avançat amb \markup
.
Atès que repeatCommands
admet una llista, el mètode més senzill
d’incloure elements de marcatge és usar un identificador per al
text i inserir-lo a la llista d’ordres usant la sintaxi de l’Scheme
#(list (list 'volta textIdentifier))
. Les ordres de principi
i fi de repetició es poden afegir com elements de llista independents:
voltaAdLib = \markup { 1. 2. 3... \text \italic { ad lib. } } \relative c'' { c1 \set Score.repeatCommands = #(list (list 'volta voltaAdLib) 'start-repeat) c4 b d e \set Score.repeatCommands = #'((volta #f) (volta "4.") end-repeat) f1 \set Score.repeatCommands = #'((volta #f)) }
[ << Text ] | [Part superior][Continguts] | [ Vocal music >> ] |
[ < ] | [ Amunt : Text ] | [ Vocal music > ] |