Showing posts with label music notation. Show all posts
Showing posts with label music notation. Show all posts

Monday, May 12, 2008

Printing LilyPond PaperColumn and NonMusicalPaperColumn

Both PaperColumn and NonMusicalPaperColumn can take a stencil.




\paper { ragged-right = ##t }
\layout { \context { \Score
proportionalNotationDuration = #(ly:make-moment 1 64) } }

\new Staff {
\override Score.NonMusicalPaperColumn #'stencil = #ly:paper-column::print
\override Beam #'positions = #'(-4 . -4)
c''8 [ e''8 g''8 b''8 ]
}

\new Staff {
\override Score.PaperColumn #'stencil = #ly:paper-column::print
\override Beam #'positions = #'(-4 . -4)
c''8 [ e''8 g''8 b''8 ]
}

The key here is that both PaperColum and NonMusicalPaperColumn subscribe to the paper-column interface.

LilyPond double stems across staves

LilyPond double stems work fine across staves.



\new PianoStaff <<
\new Staff = RH {
\time 4/8
c''8 [ c''8
\change Staff = LH
<<
{ e'8 }
\new Voice { \once \override Stem #'direction = #down e'8 }
>>
\change Staff = RH
c''8 ]
}
\new Staff = LH { s2 }
>>

The trick is in instantiating the parallel music << >> construct with no \\ separator between the first expression { e'8 } and the second { \once \override Stem #'direction = #down e'8 }.

LilyPond stem direction

LilyPond Stem #'direction takes #up, #down or a procedure.



\new Staff {
c'4
\once \override Stem #'direction = #ly:stem::calc-direction
c'4
c'4
c'4
}

\layout {
\context { \Staff
\override Stem #'direction = #down } }

Here Stem #'default-direction is #down and so the procedure #ly:stem::calc-direction is helpful.

LilyPond uniform-stretching

uniform-stretching and strict-note-spacing usually set to ##t together; setting uniform-stretching = ##t in isolation can cause problems. Here's an example with proportionalNotationDuration but without uniform-stretching.



And here's the same example with uniform-stretching turned on.



The effect shows up only before line breaks and is similar to that described here about strict-note-spacing set to ##t in isolation.

Custom LilyPond spanners

Custom spanners to segment material in sketches.



\new Staff {

\override TextSpanner #'dash-fraction = ##f
\override TextSpanner #'bound-details #'left
#'stencil-align-dir-y = #center
\override TextSpanner #'bound-details #'left
#'padding = #0.75
\override TextSpanner #'bound-details #'right
#'attach-dir = #right

\override TextSpanner #'bound-details #'left
#'text = \markup { \bold 7 }
\override TextSpanner #'bound-details #'right
#'text = \markup { \draw-line #'(0 . -1) }
c'4 \startTextSpan
c'4 \stopTextSpan

\override TextSpanner #'bound-details #'left
#'text = \markup { \bold 8 }
c'4 \startTextSpan
c'4 \stopTextSpan

}

The settings to stencil-align-dir-y and attach-dir are tricky.

Making LilyPond GrandStaff accept RhythmicStaff

GrandStaff does not by default accept RhythmicStaves. Context modification fixes this.



\new GrandStaff <<
\new RhythmicStaff { c'4 }
\new RhythmicStaff { c'4 }
\new RhythmicStaff { c'4 }
\new RhythmicStaff { c'4 }
>>

\layout { \context { \GrandStaff \accepts RhythmicStaff } }

Thanks to Rune.

LilyPond bar numbers every measure


\new Staff {
\override Score.BarNumber #'break-visibility = ##(#t #t #t)
c'1 c'1 c'1
\break
c'1 c'1 c'1
}

LilyPond outer tuplet bracket alignment

The inner triplet bracket in the first measure here aligns vertically with the lone quintuplet bracket in the second measure.



\new RhythmicStaff {
\override Staff.TupletBracket #'staff-padding = #5
\override Staff.TupletBracket #'padding = #2.25
\times 4/5 {
c'2.
\times 2/3 {
c'2
c'4
}
}
\times 4/5 {
c'2.
c'2
}
}

Is there a way to align both quintuplet brackets vertically?

LilyPond shifted first note



\new Score \with {
\override Clef #'space-alist = #'(
(ambitus extra-space . 2.0)
(staff-bar extra-space . 0.7)
(key-cancellation minimum-space . 3.5)
(key-signature minimum-space . 3.5)
(time-signature minimum-space . 4.2)
(first-note minimum-fixed-space . 15.0)
(next-note extra-space . 0.5)
(right-edge extra-space . 0.5))
} {
\new Staff \with {
\remove Time_signature_engraver
} {
c'4 c'4 c'4 c'4
d'4 d'4 d'4 d'4
}
}

LilyPond cross-staff stems

Cross-staff stem lengths set manually.



\layout {
ragged-right = ##t
\context {
\Score
proportionalNotationDuration = #(ly:make-moment 1 48)
\override NonMusicalPaperColumn
#'line-break-system-details =
#'((alignment-offsets . (0 -8)))
autoBeaming = ##f } }

\new PianoStaff <<
\new Staff = "RH" {
#(set-accidental-style 'forget)
\override Beam #'positions = #'(8 . 8)
\override Stem #'direction = #up
<d'>16 [
<d'>16
<d'>16
<d'>16 ]
}
\new Staff = "LH" {
\clef bass
\override Stem #'flag-style = #'no-flag
\override Stem #'length = #20
\override Stem #'cross-staff = ##t
<c>16
<c>16
<c>16
<c>16
}
>>

Stem overrides to 'flag-style, 'length and 'cross-staff all matter.