While working on #nepenthe it occurred to me that I might finally be able to come up with a relatively painless solution for expressing #banjo 5th string notes in standard notation.
... on a five string banjo, the 5th string is pretty much always played as an open string; in the older "stroke" style and more modern clawhammer and scruggs styles, it often functions as a drone. In the classic fingerstyle era, the fifth string is often cleverly used as a way to facilitate left-hand jumps up or down the neck; you don't have to fret it, so a note on the fifth string gives you a little extra time to move your left hand.
Back when banjo music was published in standard notation, the convention for communicating "play this note on the open 5th string" was to engrave the note+duration as usual, but add an upright stem with a sixteenth note flag.
A few years ago a kind soul on the #lilypond mailing list showed me how it is possible to achieve this by using multiple voices and overriding the beaming/duration for the 16th note, but as you might imagine it's a bit of a pain in the ass when you've got multiple 5th string notes in a given piece; it's exciting to think I might be able to implement a #handlebars tag to do most of the dirty work.
Anyway, on to the tip: While thinking about logic for such a tag, I found myself wondering how one would handle a half or whole note on the fifth string; When Lilypond encounters the same note with different durations in two voices, it engraves the two side by side, which makes sense... but not for this highly specific fringe case.
Poking around for solutions, I found that Lilypond has two helpful commands for exactly this situation, '\mergeDifferentlyHeadedOn` and `\mergeDifferentlyDottedOn`.
For the example in the graphic, the Lilypond markup that lets the sixteenth and half notes occupy the same space is:
<<
\fixed c' { \once \mergeDifferentlyHeadedOn \once \mergeDifferentlyDottedOn \once \autoBeamOff g16*8\5 }
\\
\fixed c' { g2\5 }
>> d4 b
... so to automagically generate everything within << >>, I'm imagining a tag like:
{{banjo5thStr dur="2"}}
...with logic to calculate the duration override for that 16th note, and an optional 'pitch' attribute to support the older so-called 'Rice' and 'Briggs' tunings.
... the tradeoff here is that MIDI output from this markup will have that note doubled up; when writing Lilypond "by hand" I've adopted a practice of putting 5th string notes in a separate part with silences between them and then just omitting that part from MIDI, but I'm not about to try to implement support for *that* pattern here. I can live with it.
I should say that I don't think I've ever actually seen a banjo piece with a half or whole note sounded on the fifth string, but I like handling fringe cases when they occur to me.
#handlebars #lilypond #banjo #nepenthe #lilypondtips
When generating #tablature, LilyPond's default behavior is to place the notes as low on the fingerboard as it can, and also to use open strings whenever it can.
I was glad to find just now that you can override both of those behaviors if you're trying to arrange something further up the neck:
tl;dr:
\set TabStaff.minimumFret = #[n]
\set TabStaff.restrainOpenStrings = ##t
(where [n] is the lowest fret you want to LilyPond to consider when calculating where to put a note on the fretboard)
This and more about LilyPond tab basics:
https://lilypondcookbook.com/post/75545613870/fretted-strings-1-guitar-basics
#music #lilypond #t #tablature #lilypondtips
Because I just had to look this up for the millionth time (hat-tip https://stackoverflow.com/questions/29463069/lilypond-displays-chords-over-every-bar/29468573#29468573) , here's how to make #lilypond only display chord names on chord changes - add this inside your ChordNames block:
\set chordChanges = ##t
In other words, if you set 'chordChanges' to true and your score has three bars of 'ees' chords in a row followed by 'f:m', it will render like this: