lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Moving notes in a chord to the opposite side of the stem?


From: Paul Morris
Subject: Re: Moving notes in a chord to the opposite side of the stem?
Date: Mon, 09 Apr 2012 16:56:00 -0400
User-agent: Postbox 3.0.3 (Macintosh/20120304)

Thomas Morley wrote:
Am 9. April 2012 03:25 schrieb Paul Morris <address@hidden>:
Hello,  Is there a way to manually move some of the notes in a chord to the
opposite side of the stem, overriding the default placement?

I have looked through the docs and did not find a simple way to do this (the
NoteColumn #'force-hshift property only works with notes in different
voices, and trying to \override NoteHead #'X-offset  within a chord just
returned an error).  The best thing I came up with was this snippet:
http://lsr.dsi.unimi.it/LSR/Item?id=505

Following its example I was able to get the results I needed by doing this:


shiftR = {
  \once \override Stem #'X-offset = #.6
  \once \override NoteHead #'X-offset = #.6
}

<c' e' g' >4
<< { <c' e'> } \\ { \voiceThree \shiftR g' } >>

<d' f' a'>
<< { d' } \\ { \voiceThree  \shiftR < f' a'> } >>


See attached screenshot.  But it seems like there should be a way to do this
without having to introduce another voice?

Use a tweak.

Perhaps:

\version "2.14.2"

horOff =
#(define-music-function (parser location x-off music) (number? ly:music?)
         (set! (ly:music-property music 'tweaks)
	(acons 'extra-offset (cons x-off 0)
         (ly:music-property music 'tweaks)))
   music)

%shiftR = {
%  \once \override Stem #'X-offset = #.6
%  \once \override NoteHead #'X-offset = #.6
%}

{
<c' e' \horOff #1.2 g' >4
%<< { <c' e'> } \\ { \voiceThree \shiftR g' } >>

<d' \horOff #1.2 f' \horOff #1.2 a'>
%<< { d' } \\ { \voiceThree  \shiftR < f' a'> } >>
}

HTH,
  Harm

Thank you!  This works, but unfortunately (like the Hydra's heads) it introduces two other problems, one with horizontal spacing collisions and one with ledger lines.

1. Because the spacing engine does not take into account this low-level tweak, the tweaked notes sometimes collide with bar/measure lines and sometimes with other adjacent notes.  Is there a way to use Scheme to also increase the horizontal space given to the chord?  (I am still a beginner at Scheme.) 

Maybe by tweaking horizontal-skylines for the NoteColumn?
http://lilypond.org/doc/v2.14/Documentation/internals/notecolumn

2. If a note is on a ledger line, the ledger line is not offset with its note, but is left behind in its original position.  Is there a way to offset the ledger line as well as the note?

It seems like the ideal solution would be if there was a way to create a second NoteColumn for the chord and move some notes over into it?  Like what (I assume) happens automatically when a chord has notes that are an interval of a second apart? 

Thanks again,
-Paul


PS. I tried this, but it doesn't seem to have any effect, although it doesn't return any errors.  I imagine I'm not accessing the NoteColumn correctly.
\version "2.14.2"
chordTweak =
#(define-music-function (parser location l-sky r-sky music) (number? number? ly:music?)
         (set! (ly:music-property music 'tweaks)
    (acons 'horizontal-skylines (cons l-sky r-sky)
         (ly:music-property music 'tweaks)))
   music)

{
    \chordTweak #30 #60 <  c'' e'' g''>
}


reply via email to

[Prev in Thread] Current Thread [Next in Thread]