Am Sa., 8. Feb. 2020 um 13:23 Uhr schrieb <sir.teddy.the.fi...@gmail.com>: > > Hi, > thank you for this solution. > I only made a very small adjustment and now at least I would call it > "elegant". > I put all the commands needed to "quote" from the chord track into a > function, so now I only have to type one command instead of three. > I'm not versed enough in using Lilypond to know if this can be shortened even > more or if there are some situations where it won't work at all, but I'm > going to stick with it because it's still more elegant than what I used > before. > Thank you.
Glad I could help. Some remarks: > > %%%%%%%%%%%%%%%%%%% > \version "2.19.83" > > chordTrack = \chordmode { > \repeat unfold 2 { > c1 d e f | > } > } > > %% make 'chordTrack' quotable > \addQuote "chrds" { \chordTrack } > > notes = \relative c' { > \repeat unfold 8 { > c4 d e f | > } > } > This relies on matching context-names, so you have to care about them manually > quoteChord = #(define-music-function No need for 'parser location' in music-functions for 2.19.x, you could delete them > (parser location music) > (ly:music?) > #{ > \context ChordNames = "chrds-2" > \quoteDuring "chrds" { I'd use $music instead, refer to the Extending manual for the difference. Although I doubt it makes a difference here, I'm used to be a paranoiac ... > \context Staff = "2" { #music } > } > #} > ) > > otherNotes = \relative c' { > c1 d e f g a \quoteChord { b } c > } > > \score { > << > \new ChordNames \chordTrack > \new Staff \notes > %% initiate a ChordNames-context which may be filled form 'otherNotes' Likely more robust to do: \new ChordNames = "chrds-2" { #(skip-of-length otherNotes) } > \new ChordNames = "chrds-2" > \new Staff = "2" \otherNotes > >> > } > %%%%%%%%%%%%%%%%%%% Cheers, Harm