lilypond-user
[Top][All Lists]
Advanced

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

Re: "Quote" Chord Track in another Staff


From: Thomas Morley
Subject: Re: "Quote" Chord Track in another Staff
Date: Sat, 8 Feb 2020 14:29:30 +0100

Am Sa., 8. Feb. 2020 um 14:18 Uhr schrieb <address@hidden>:
>
> If I've understood everything you said correctly, I should have now made all 
> the necessary changes:

Well, not all changes were _necessary_, p.e. using 'parser location'
in music-functions still works. Superfluous, though.

>
> %%%%%%%%%%%%%%%%%%%%%%%%%
> \version "2.19.83"
>
> quoteChord = #(define-music-function
>     (staffName music)
>     (string? ly:music?)
>
>     #{
>       \context ChordNames = #(string-append staffName "-chords")
>         \quoteDuring "chrds" {
>           \context Staff = $staffName { $music }
>         }
>     #}
> )

You could do
quoteChordSecond = \quoteChord "second" \etc

>
> 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 |
>   }
> }
>
> otherNotes = \relative c' {

Then here:
  c1 d e f g a \quoteChordSecond { b } c

>   c1 d e f g a \quoteChord "second" { b } c
> }
>
> \score {
>   <<
>   \new ChordNames \chordTrack
>   \new Staff \notes
>   %% initiate a ChordNames-context which may be filled form 'otherNotes'
>   \new ChordNames = "second-chords" { #(skip-of-length otherNotes) }
>   \new Staff = "second" \otherNotes
>   >>
> }
> %%%%%%%%%%%%%%%%%%%%%%%%%
>
> Now I should not encounter any problems as long as I always name the 
> ChordNames corresponding the staff, "(name-of-the-staff)-chords".
> Is there a way to store ' \quoteChord "second" ' in a variable so I only have 
> to define it once per staff?
> That would shorten it even further.

Cheers,
  Harm



reply via email to

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