Saturday, August 13, 2011

LilyPond remove empty staves

In recent versions of LilyPond \RemoveEmptyStaffContext has been changed to ...

\layout {
\context {
\Staff
\RemoveEmptyStaves
% To use the setting globally, uncomment the following line:
% \override VerticalAxisGroup #'remove-first = ##t
}
}

... though it remains to be seen whether \RemoveEmptyStaffContext is deprecated or not.

Thursday, May 12, 2011

Accidentally creating a new context

Consider the following layout block:

\layout {
\context {
\type "Engraver_group"
\consists "Time_signature_engraver"
\consists "Axis_group_engraver"
\name "TimeSig"
\override TimeSignature #'font-size = #3
\override TimeSignature #'break-align-symbol = ##f
\override TimeSignature #'X-offset =
#ly:self-alignment-interface::x-aligned-on-self
\override TimeSignature #'self-alignment-X = #CENTER
\override TimeSignature #'after-line-breaking =
#shift-right-at-line-begin
}
\context {
\Score
\accepts TimeSig
}
\context {
\Staff
\remove "Time_signature_engraver"
}
}

The layout comes from the LilyPond snippet repository and allows for time signatures above staves:

\new Score <<
\new TimeSig {
\time 2/4 s2
\time 3/4 s2.
}
\new StaffGroup <<
\new Staff { c'4 c'4 c'4 c'4 c'4 }
\new Staff { c'4 c'4 c'4 c'4 c'4 }
>>
>>


But this can get messed up:

\new Score <<
\new TimeSig {
#(set-accidental-style 'forget)
\time 2/4 s2
\time 3/4 s2.
}
\new StaffGroup <<
\new Staff { c'4 c'4 c'4 c'4 c'4 }
\new Staff { c'4 c'4 c'4 c'4 c'4 }
>>
>>


The accidental style setting causes an unwanted new staff to be instantiated.

Make sure to keep Scheme commands out of nonsemantic contexts to avoid this behavior.

Friday, December 18, 2009

Bar line thickness

Adjusting LilyPond bar line thickness does nothing.

\new Staff {
c'1
c'1
c'1
\override Staff.BarLine #'color = #red
\override Staff.BarLine #'thickness = #0.5
c'1
}



Adjusting bar line hair-thickness does the trick.

\new Staff {
c'1
c'1
c'1
\override Staff.BarLine #'color = #red
\override Staff.BarLine #'hair-thickness = #0.5
c'1
}

Monday, June 29, 2009

Red, boxed markup




\version "2.13.2"

\new Staff {
\set Score.proportionalNotationDuration = #(ly:make-moment 1 16)
c'4
\override TextScript #'staff-padding = #4
\override TextScript #'self-alignment-X = #left
c'4 ^ \markup \with-color #red \override #'(box-padding . 1.0)
\box \hcenter-in #3 \line { 2 / 3 }
c'4
c'4
\bar "||"
}

Sunday, June 28, 2009

The right version of LilyPond for OS X

There's been some craziness regarding the correct version of LilyPond for OS X users for sometime. The LilyPond download page ...

http://lilypond.org/web/install/

... lists three different situations:

  • MacOS X 10.5 (Leopard)
  • MacOS X (Intel) 10.4
  • MacOS X (G3, G4, G5) 10.3 and newer

I find all three of these a touch confusing. So here's what works for me.

I have a MacOS X (Intel) 10.4 iMac at home. And, happily, clicking on the corresponding link on the LilyPond download page always works. The only confusing bit, however, is that you if you inspect downloaded executable in the Finder (using cmd-I for 'info'), the info box that the Finder shows you will say that the application is 'Application (PowerPC)'.



I *think* this is just a mistake. But I've never been certain. Anyway, the point is that the MacOS X (Intel) 10.4 link on the LilyPond download site does indeed work, even if the binary is mislabelled.

The situation with my MacBook running Leopard is more complicated. I have never once followed the MacOS X (Leopard) 10.5 link on the LilyPond download page. The link takes you away from the LilyPond site and has a bunch of instructions that have never made much sense to me. Happily, though, what does work for me is to download from the MacOS (G3, G4, G5 Macs) 10.3 and newer link on the LilyPond download page.

Now this is highly counterintuitive. It seems like downloading a binary for the old, old type of Mac hardware would be exactly the wrong thing to do for a MacBook made of the (almost) newest type of Mac hardware. But this does in fact work.

I think the one caveat here is that I never use the LilyPond GUI and always call LilyPond from the commandline. I think that running the LilyPond GUI on my MacBook with the old G3 version of the binary would probably fail.

convert-ly and multiple versions of Python

The LilyPond convert-ly script lives here under a standard OS X install of LilyPond:

/Applications/LilyPond.app/Contents/Resources/bin/convert-ly

The script is written in Python but starts with the following directive to the shell:

#!/usr/bin/python

If you have multiple versions of Python installed on your system, convert-ly may find an old version of Python and be unable to start. Fix this by changing the first line of convert-ly to this:

#!/usr/bin/env python