bell notificationshomepageloginNewPostedit profiledmBox

Hoots : Complex beam in Lilypond I'm trying to reproduce a scanned score with Lilypond. The original (the part of interest, at least), looks like this : My Lilypond code is the following (I put the crescendo in the upper staff) - freshhoot.com

10% popularity   0 Reactions

Complex beam in Lilypond
I'm trying to reproduce a scanned score with Lilypond. The original (the part of interest, at least), looks like this :

My Lilypond code is the following (I put the crescendo in the upper staff) :

%%%%%%%%%%
%% VERSION
%%%%%%%%%%

version "2.20.0.3"

%%%%%%%%%
%% LYRICS
%%%%%%%%%

singerLyrics = lyricmode {
% Ah! |
}

%%%%%%%%%%%
%% PIANO UP
%%%%%%%%%%%

pianoUpper = relative c' {
clef "treble"
time 6/8
key c major

<f d'>4( <f d'>8 << {<g b>4[ f8} {f'8. d16 b8]}) >> |
}

%%%%%%%%%%%%
%% PIANO LOW
%%%%%%%%%%%%

pianoLower = relative c {
clef "bass"
time 6/8
key c major

g <f' g b> <f g b> g, <f' g b> <f g b> |
}

%%%%%%%%
%% SCORE
%%%%%%%%

score {
<<
new PianoStaff <<
new Staff = "upper" {new Voice = "singer" pianoUpper}
new Lyrics lyricsto singer singerLyrics
new Staff = "lower" pianoLower
>>
>>
}

And it produces the following result :

Which is upsetting, because I obviously don't want the beam to look like that.

Has someone an idea of how I can make the beam look better, like on my original scanned score?


Load Full (2)

Login to follow hoots

2 Comments

Sorted by latest first Latest Oldest Best

10% popularity   0 Reactions

Here's how I did it:

version "2.18.2"
include "english.ly"

global =
{
time 6/8
}

pianoUpper =
{
<< {
<f'd''>4( q8 f''8. d''16 <f'b'>8)
} {
s4. <g'b'>
} >>
}

dyn = { p4.< s4 s8! }

pianoLower = { clef bass g,8 <f g b> q g, q q }

score
{
new PianoStaff
{
<<
new Staff << global pianoUpper >>
new Dynamics dyn
new Staff << global pianoLower >>
>>
}
layout {}
}

I used Lilypond's << ... ... >> construct to get the upper and lower voices in the upper stave. Even though all the notes in the first half of the bar in the upper stave had their stems going up, so that was not a reason to put them in the two-voice construct, I put them in the upper voice of this two-voice construct anyway, so that the phrasing slur would belong to that upper voice. (A slur or phrasing slur doesn't work if it starts in one voice and ends in another.)


10% popularity   0 Reactions

You need to replace the << ... >> construct with this:

<< { f'8. d16 <a f>8 } { <g b>4 s8 } >>. Here's a lilybin1 where I did that for you: lilybin.com/jslb5y/1 (plus I wrapped the rest of the line into the construct to make the ties work).

The reason is simple: first of all, you used << {...} {...} >>, which does not make two independent voices, but pastes the contents of the two braces together. The condition is that both need to have the same rhythm (if they don't, weird stuff happens). So it's not what you would primarily want to use. I use it only when I need to write a lot of chords that have many repeating notes, like in this lilybin: lilybin.com/8dc2z0/1 .

What you want to use is the construct << { ... } { ... } >> (notice the two backslashes). That temporarily splits up the music into two different voices. The first brace is treated as voiceOne and the second one as voiceTwo, the settings like stemUp or tieDown do not transfer from outside to inside of this construct, and very importantly, you cannot have a tie/slur/beam starting outside and ending inside.

1 Lilybin is a web app that makes it possible to share Lilypond snippets. It compiles them and shows the resulting score. You can also edit the code as you want and compile again and again, so you can experiment more with the snippets.


Back to top Use Dark theme