Hi Robin,

2012/2/11 Robin Bannister <r...@dataway.ch>:
> Thomas Morley wrote:
>>
>> how about the code below?  Is there something wrong with it?
>>
>> (Tested with "2.14.2" and "2.15.24")
>
>
> I thought Neil was implying it would stop working. I see it works with
> 2.15.29 too.
> But the result seems pretty halfbaked to me; what additional information is
> the player given via (the clutter of) slashes and percents?

agreed, completely. I merely tried to make work what Francisco wanted.

> Slash noteheads are something else.

Personally I'd prefer sth like the attached. But it might not work
with the latest devel-version due to the changes with EventChord. (I
can't test it. "2.15.24" is currently my highest version.)

Cheers,
  Harm
\version "2.14.2"

% http://lists.gnu.org/archive/html/lilypond-user/2009-01/msg00588.html
% http://lists.gnu.org/archive/html/lilypond-user/2009-01/msg00628.html 
% http://lists.gnu.org/archive/html/lilypond-user/2011-11/msg00196.html

#(define (has-duration? music) 
  (ly:duration? (ly:music-property music 'duration))) 

#(define (not-has-duration? music) 
  (not (has-duration? music))) 

keepsOnlyFirstNote = #(define-music-function (parser location music) (ly:music?) 
(music-map 
  (lambda (evt) 
   (if (eq? 'EventChord (ly:music-property evt 'name)) 
      (let ((elts (ly:music-property evt 'elements))) 
       (if (has-duration? (car elts)) 
            (ly:music-set-property! evt 'elements (cons 
                 (car elts) 
                 (filter not-has-duration? (cdr elts))))))) 
  evt) 
music)) 

chordAlign =
#(define-music-function (parser location dir)(number?)

        (define (chordNameCallback grob)
	"
	LEFT = -1
	RIGHT = 1
	CENTER = 0
	"
          (let* ((ch (ly:text-interface::print grob)))
          	(ly:stencil-aligned-to ch X dir)))
        ;; "2.15.24": remove the "$" in the following expression!
#{
        %\once 
        \override ChordNames.ChordName #'stencil = #$chordNameCallback
#})

Changes = \chordmode { \chordAlign #-1 r4 g:m r4 f8 d8:m7 ~ d1:m7 r4 g:m r4 f8 d8:m7 ~ d1:m7}
Melody = \relative c'' { 
        g4 c a f ~ 
        f1 \break  
        g4 c a f ~ 
        f1	   
}

\score {
        <<
        \new RhythmicStaff \with { 
        	\override VerticalAxisGroup #'staff-staff-spacing =		
 		      #'((basic-distance . 1)
 		         (minimum-distance . 1)
 		         (padding . 1))
 	\accepts "ChordNames"
        } 
        <<
        \new Voice \chords { \Changes }
        \new Voice { \keepsOnlyFirstNote \Changes }
        >>
          
        \new Staff {
                \key f \major
                \clef treble
                \time 4/4
                \Melody  
        }
 >>
 \layout {
   indent=0
            \context {
            	    \ChordNames
            	      \override ChordName #'Y-offset = #4
            	      \override ChordName #'font-size = #'-1
            	      noChordSymbol = ##f
            	      chordChanges = ##t
            }
            \context {
            	    \RhythmicStaff
     	      \override StaffSymbol #'staff-space = #(magstep -3)
     	      \override StaffSymbol #'line-count = #0
     	      \override BarLine #'stencil = ##f
     	      \override TimeSignature #'transparent = ##t
     	      \override NoteHead #'style = #'slash 
     	      \override NoteColumn #'X-offset = #0.5
     	      fontSize = #-7
     	      \override Stem #'direction = #UP % = \stemUp 
            }
            
 } % layout
} % score  

<<attachment: chord-rhythm-02.png>>

_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to