[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Stems ] | [ Up : Editorial annotations ] | [ Note names > ] |
1.7.2 Outside the staff
This section discusses how to add emphasis to elements in the staff from outside of the staff.
Note names | ||
Balloon help | ||
Grid lines | ||
Analysis brackets |
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Outside the staff ] | [ Up : Outside the staff ] | [ Balloon help > ] |
Note names
Note names can be printed as text, by using the
NoteNames
context. When used simultaneously
with a regular staff, that makes it possible to
synchronize each note with its name, printed above
or below the Staff.
\language "italiano" melody = \relative do'' { fad2 si,8 dod re mi fad4. re8 fad2 } << \new NoteNames { \melody } \new Staff { \key si \minor \melody } \new NoteNames { \set printNotesLanguage = "deutsch" \set printAccidentalNames = ##f \melody } >>
By default, note names are printed in the same language
used for music entry; however, the printNotesLanguage
property allows to select any other language available (see
Note names in other languages). Whether accidentals
should be printed or not is determined through the
printAccidentalNames
property.
By setting both that property to a symbol and
printOctaveNames
to #t
, note names can be
obtained that closely resemble LilyPond entry syntax.
If a more generalistic result is desired, ‘scientific’
octave names may also be obtained.
melody = \relative c'' { fis2 b,8 cis d e fis4. d8 fis2 } << \new NoteNames { \set printOctaveNames = ##t \set printAccidentalNames = #'lily \melody } \new Staff { \key b \minor \melody } \new NoteNames { \set printOctaveNames = #'scientific \melody } >>
The noteNameSeparator
property defines how chords
will be printed. Other formatting functions may be defined
as noteNameFunction
; such a function must expect
a pitch
and a context
argument, even if
one of these can then be ignored.
somechords = \relative c' { <b d fis>2 <b cis e g> <b d fis> q } << \new NoteNames { \set noteNameSeparator = "+" \somechords } \new Staff { \key b \minor \somechords } \new NoteNames { \set noteNameFunction = #(lambda (pitch ctx) (alteration->text-accidental-markup (ly:pitch-alteration pitch))) \somechords } >>
See also
Notation Reference: Note names in other languages.
Internals Reference: NoteName, NoteNames, Note_name_engraver.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Note names ] | [ Up : Outside the staff ] | [ Grid lines > ] |
Balloon help
Elements of notation can be marked and named with the help of a square balloon. The primary purpose of this feature is to explain notation.
\new Voice \with { \consists Balloon_engraver } \relative c'' { \balloonGrobText #'Stem #'(3 . 4) \markup { "I'm a Stem" } a8 \balloonGrobText #'Rest #'(-4 . -4) \markup { "I'm a rest" } r <c, g'-\balloonText #'(-2 . -2) \markup { "I'm a note head" } c>2. }
There are two music functions, balloonGrobText
and
balloonText
; the former is used like
\once \override
to attach text to any grob, and the
latter is used like \tweak
, typically within chords, to
attach text to an individual note.
Balloon text does not influence note spacing, but this can be altered:
\new Voice \with { \consists Balloon_engraver } \relative c'' { \balloonGrobText #'Stem #'(3 . 4) \markup { "I'm a Stem" } a8 \balloonGrobText #'Rest #'(-4 . -4) \markup { "I'm a rest" } r \balloonLengthOn <c, g'-\balloonText #'(-2 . -2) \markup { "I'm a note head" } c>2. }
The default behavior for the attachment point of the line on the frame and the alignment of the balloon text is demonstrated below.
The default calculation of the attachment point can be overruled
using the X-attachment
and Y-attachment
properties,
which take values between -1 and 1, with the limits corresponding
to the left (resp. bottom) and right (resp. top) of the frame.
Alignment of the text is controlled by text-alignment-X
and
text-alignment-Y
, which have a similar form.
\new Voice \with { \consists Balloon_engraver } { \once \override BalloonText.Y-attachment = -0.5 \once \override BalloonText.text-alignment-X = 0.0 \balloonGrobText Rest #'(1 . 3.5) "rest" r4 }
Predefined commands
\balloonLengthOn
,
\balloonLengthOff
.
See also
Snippets: Editorial annotations.
Internals Reference: AnnotateOutputEvent, Balloon_engraver, BalloonText, balloon-interface.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Balloon help ] | [ Up : Outside the staff ] | [ Analysis brackets > ] |
Grid lines
Vertical lines can be drawn between staves synchronized with the notes.
The Grid_point_engraver
must be used to create the end
points of the lines, while the Grid_line_span_engraver
must
be used to actually draw the lines. By default this centers grid
lines horizontally below and to the left side of each note head.
Grid lines extend from the middle lines of each staff. The
gridInterval
must specify the duration between the grid
lines.
\layout { \context { \Staff \consists Grid_point_engraver gridInterval = #(ly:make-moment 1/4) } \context { \Score \consists Grid_line_span_engraver } } \score { \new ChoirStaff << \new Staff \relative { \stemUp c''4. d8 e8 f g4 } \new Staff \relative { \clef bass \stemDown c4 g' f e } >> }
Selected Snippets
Grid lines: changing their appearance
The appearance of grid lines can be changed by overriding some of their properties.
\score { \new ChoirStaff << \new Staff { \relative c'' { \stemUp c'4. d8 e8 f g4 } } \new Staff { \relative c { % this moves them up one staff space from the default position \override Score.GridLine.extra-offset = #'(0.0 . 1.0) \stemDown \clef bass \once \override Score.GridLine.thickness = #5.0 c4 \once \override Score.GridLine.thickness = #1.0 g'4 \once \override Score.GridLine.thickness = #3.0 f4 \once \override Score.GridLine.thickness = #5.0 e4 } } >> \layout { \context { \Staff % set up grids \consists "Grid_point_engraver" % set the grid interval to one quarter note gridInterval = #(ly:make-moment 1/4) } \context { \Score \consists "Grid_line_span_engraver" % this moves them to the right half a staff space \override NoteColumn.X-offset = #-0.5 } } }
See also
Snippets: Editorial annotations.
Internals Reference: Grid_line_span_engraver, Grid_point_engraver, GridLine, GridPoint, grid-line-interface, grid-point-interface.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Grid lines ] | [ Up : Outside the staff ] | [ Text > ] |
Analysis brackets
Brackets are used in musical analysis to indicate structure in musical pieces. Simple horizontal brackets are supported.
\layout { \context { \Voice \consists Horizontal_bracket_engraver } } \relative { c''2\startGroup d\stopGroup }
Analysis brackets may be nested.
\layout { \context { \Voice \consists Horizontal_bracket_engraver } } \relative { c''4\startGroup\startGroup d4\stopGroup e4\startGroup d4\stopGroup\stopGroup }
Selected Snippets
Analysis brackets above the staff
Simple horizontal analysis brackets are added below the staff by default. The following example shows a way to place them above the staff instead.
\layout { \context { \Voice \consists "Horizontal_bracket_engraver" } } \relative c'' { \once \override HorizontalBracket.direction = #UP c2\startGroup d2\stopGroup }
Analysis brackets with labels
Text markup may be added to analysis brackets through the text
property of the HorizontalBracketText
grob. Adding different
texts to brackets beginning at the same time requires the
\tweak
command.
Bracket text will be parenthesized after a line break.
\paper { tagline = ##f } \layout { \context { \Voice \consists "Horizontal_bracket_engraver" \override HorizontalBracket.direction = #UP } } { \once\override HorizontalBracketText.text = "a" c''\startGroup d''\stopGroup \once\override HorizontalBracketText.text = "a'" e''\startGroup d''\stopGroup | c''-\tweak HorizontalBracketText.text \markup \bold \huge "b" \startGroup -\tweak HorizontalBracketText.text "a" \startGroup d''\stopGroup e''-\tweak HorizontalBracketText.text "a'" \startGroup d''\stopGroup\stopGroup | c''-\tweak HorizontalBracketText.text foo \startGroup d'' e'' f'' | \break g'' a'' b'' c'''\stopGroup }
Measure spanner
Measure spanners are an alternate way to print annotated brackets. As opposed to horizontal brackets, they extend between two bar lines rather than two notes. The text is displayed in the center of the bracket.
\paper { tagline = ##f } \layout { \context { \Staff \consists Measure_spanner_engraver } } << \new Staff \relative c'' { \key d \minor R1*2 \tweak text "Answer" \startMeasureSpanner \tuplet 3/2 8 { a16[ b c] d[ c b] c[ d e] f[ e d] } e8 a gis g fis f e d~ d c b e \stopMeasureSpanner } \new Staff \relative c' { \key d \minor \tweak text "Subject" \tweak direction #DOWN \startMeasureSpanner \tuplet 3/2 8 { d16[ e f] g[ f e] f[ g a] bes[ a g] } a8 d cis c b bes a g~ g f e a \stopMeasureSpanner \tweak text "Counter-subject" \tweak direction #DOWN \startMeasureSpanner f8 e a r r16 b, c d e fis g e a gis a b c fis, b a gis e a4 g8 \stopMeasureSpanner } >>
See also
Internals Reference: Horizontal_bracket_engraver, HorizontalBracket, horizontal-bracket-interface, HorizontalBracketText, horizontal-bracket-text-interface, Measure_spanner_engraver, MeasureSpanner, measure-spanner-interface, Staff.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Grid lines ] | [ Up : Outside the staff ] | [ Text > ] |