You noticed yourself that this does not work well with chords, but it
also does not play overly well with \relative if you write \av c' for
example.

In the \samePitch function, i try to play with the property
'to-relative-callback. It seems to work also here but of course, it is
heavier -:(  (see below )
For chords, is it conceivable to imagine a ly:pitches? function, (so for
chords), that would be compatible in #{ #}, in the same way ly:pitch? is.
And even, an ly:pitch?-or-ly:pitches? function for notes and chords ?
(well, probably with better names ...)

--
Gilles



%%%%%%%%%%
#(define (set-rel-callback tied-music)
"set all pitches to the pitch of the first note, in relative mode."
(let((not-first? #f))
    (map-some-music
      (lambda (x)
        (case (ly:music-property x 'name)
          ((or NoteEvent EventChord)
             (if not-first?
               (ly:music-set-property! x 'to-relative-callback
                  (lambda (x p) ; set pitch to the prev value
                      (ly:prob-set-property! x 'pitch p)
                      p)))
               (set! not-first? x)
             x)
          (else #f)))
      tied-music)))


av = #(define-music-function (parser location x) (ly:pitch?)
(set-rel-callback
    #{
      $x 8 ~  $x 4
    #}))

   \new Staff \relative c' {
      c4. \av c' f4
      fis4. \av fis, g4
   }
%%%%%%%%%

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

Reply via email to