[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
AW: "Quote" Chord Track in another Staff
From: |
sir.teddy.the.first |
Subject: |
AW: "Quote" Chord Track in another Staff |
Date: |
Sat, 8 Feb 2020 13:23:57 +0100 |
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.
%%%%%%%%%%%%%%%%%%%
\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 |
}
}
quoteChord = #(define-music-function
(parser location music)
(ly:music?)
#{
\context ChordNames = "chrds-2"
\quoteDuring "chrds" {
\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'
\new ChordNames = "chrds-2"
\new Staff = "2" \otherNotes
>>
}
%%%%%%%%%%%%%%%%%%%
> -----Ursprüngliche Nachricht-----
> Von: Thomas Morley <address@hidden>
> Gesendet: Samstag, 8. Februar 2020 13:02
> An: address@hidden
> Cc: lilypond-user <address@hidden>
> Betreff: Re: "Quote" Chord Track in another Staff
>
> Am Sa., 8. Feb. 2020 um 12:42 Uhr schrieb <address@hidden>:
> >
> > Hi all,
> >
> > please consider the following snippet:
> >
> >
> >
> > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> >
> > \version "2.19.83"
> >
> >
> >
> > notes = \relative c' {
> >
> > \repeat unfold 8 {
> >
> > c4 d e f |
> >
> > }
> >
> > }
> >
> >
> >
> > otherNotes = \relative c' {
> >
> > c1 d e f g^\markup "C" a^\markup "D" b c
> >
> > }
> >
> >
> >
> > chordTrack = \chordmode {
> >
> > \repeat unfold 2 {
> >
> > c1 d e f |
> >
> > }
> >
> > }
> >
> >
> >
> > \score {
> >
> > <<
> >
> > \new ChordNames \chordTrack
> >
> > \new Staff \notes
> >
> > \new Staff \otherNotes
> >
> > >>
> >
> > }
> >
> > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> >
> >
> >
> > I’ve got the normal chords at the top and I would like to have parts of that
> chord-track again over the second staff (simulated with the two markup-
> commands).
> >
> > Of course I could just use a second variable containing only the chords I
> want and leaving the rest blank, but I’m curious if there is a way to re-use
> the
> first chords.
> >
> > How can this be done in a more “elegant” way?
> >
> >
> >
> > Thanks in advance
>
> Hi,
>
> you could try (ee inline comments):
>
> 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' {
> c1 d e f
> %% refer to the preexisting and named ChordNames-context, to put in the
> quotes
> \context ChordNames = "chrds-2"
> \quoteDuring "chrds" {
> %% while putting quotes into the relevant ChordNames-context, refer to
> %% the preexisting and named Staff-context to continue entering "normal"
> %% stuff
> \context Staff = "2" { g1 a }
> }
> b c
> }
>
> \score {
> <<
> \new ChordNames \chordTrack
> \new Staff \notes
> %% initiate a ChordNames-context which may be filled form 'otherNotes'
> \new ChordNames = "chrds-2"
> \new Staff = "2" \otherNotes
> >>
> }
>
> Not sure, if someone would call it "elegent" ...
>
>
> Cheers,
> Harm
- "Quote" Chord Track in another Staff, sir.teddy.the.first, 2020/02/08
- Re: "Quote" Chord Track in another Staff, Thomas Morley, 2020/02/08
- AW: "Quote" Chord Track in another Staff,
sir.teddy.the.first <=
- Re: "Quote" Chord Track in another Staff, Thomas Morley, 2020/02/08
- Re: "Quote" Chord Track in another Staff, David Kastrup, 2020/02/08
- AW: "Quote" Chord Track in another Staff, sir.teddy.the.first, 2020/02/08
- Re: "Quote" Chord Track in another Staff, Thomas Morley, 2020/02/08
- AW: "Quote" Chord Track in another Staff, sir.teddy.the.first, 2020/02/08