On 27/10/13 17:47, Tom Cloyd wrote:
I need help with this construction: \once \override NoteColumn #'force-hshift = #{doesn't matter what you put here 'cause it rarely works anyway}

My ly code problem demo snippet is here: http://pastie.org/8433947

Works if you put put the shift command in two voices (+ve in one and -ve in another). See attached reworking of your snippet.

Nick
\version "2.16.0"
% (is Lilypond current version - checked 2013.09.28)
% template version 2013.10.26

ncShift = #(define-music-function (parser location move) (number?) #{
  \once \override NoteColumn #'force-hshift = #move
             #})
\header {  
  % <***** centered top *****>
  %dedication="dedication" %centered above title, top of page one
  title = "Problem snippet" %centered below dedication
  instrument = "Classic Guitar"  %{ centered below the subsubtitle, and at the top of pages (other than the first page). %}
}

global = {
  \clef "treble_8"
  \key c \major
  \time 3/4  
}

% * VOICE ONE ========================================
melody = \relative c {
  \voiceOne
  \global
  
  r4 a'' c ~ |
  c g b ~ |
  b f a ~ |
  a e a8 gis |
    
% * m  5 ===== ===== ===== =====
  r4 a b ~ | 
  b g a ~ | \break
  a f g ~ |
  g e d ~ |
  d c8 b b4 | \bar "||"

 }

% * VOICE THREE =======================================
% used only when there are three parts
alto = \relative c {
  \voiceThree
  \stemDown
  
  s4 c' a ~ |
  a b g ~ |
  g a f ~ |
  f gis b |

% * m  5 ===== ===== ===== =====  
  <<
    % continue voice three
    {\voiceTwo 
     s4 c8 b a4 ^~ |
     \ncShift #-0.5 a b8 a g4 ^~ |
     \ncShift #-0.5 g a8 g f4 ^~ |  
     \ncShift #-0.5 f gis f ^~ | 
     \ncShift #-0.5 f e d |} \\
    {\voiceFour s2.| s2.| s2.| s2.| 
     s4 g g8 a |}
  >>
  
 }                 

% * VOICE TWO ========================================
bass = \relative c {
  \voiceTwo
  
  a2. |
  a2. |
  a2. |
  a2. |
  
% * m  5 ===== ===== ===== =====
  a2. |
  \ncShift #0.01 a2. |
  \ncShift #0.01 a2. |
  \ncShift #0.01 a2. |
  \ncShift #0.01 a2. |
  
 }

structure = {
  \new Staff = "guitar" \with { \consists "Span_arpeggio_engraver" }
  <<
  %\set Staff.instrumentName="Classical Guitar"  %puts name to left of line one
  \set Staff.midiInstrument="acoustic guitar (nylon)"
  \set Staff.connectArpeggios = ##t  
  \context Voice = "melody" \melody
  \context Voice = "alto" \alto
  \context Voice = "bass" \bass
  >>
}

\score {
 \structure
 \layout {
   indent = 0.0\cm % remove indent on first staff   
 }
}
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to