5

I want to provide a pattern (e.g., the C major arpeggio, C E G) and have Lilypond automatically show it transposed (as one score) in all 12 scales.

Here's my current attempt:

music = { c' e' g' s }

\new Staff {
  \transpose c c   { \music }
  \transpose c f   { \music }
  \transpose c bes { \music }
  \transpose c ees { \music }
  \transpose c aes { \music }
  \transpose c des { \music }
  \transpose c fis { \music }
  \transpose c b   { \music }
  \transpose c e   { \music }
  \transpose c a   { \music }
  \transpose c d   { \music }
  \transpose c g   { \music }
}

I don't know how to add a text above each pattern indicating the transposition key (e.g., C, F, Bb, etc...). I would like the final product to look something like this:

enter image description here

Note: I would like this code to work regardless of the length of the pattern (which could be longer than one measure).

4

Look into the chord names engraver, which does exactly this and works together perfectly with \transpose.

3

Something like

\version "2.18.0"

musicnotes = { c' e' g' s }
music = <<
  \context ChordNames \with { alignAboveContext = "mus" }
  { c1*0 $(skip-of-length musicnotes) }
  \context Staff = "mus" \musicnotes
>>

\new Staff = "mus" {
  \transpose c c   { \music }
  \transpose c f   { \music }
  \transpose c bes { \music }
  \transpose c ees { \music }
  \transpose c aes { \music }
  \transpose c des { \music }
  \transpose c fis { \music }
  \transpose c b   { \music }
  \transpose c e   { \music }
  \transpose c a   { \music }
  \transpose c d   { \music }
  \transpose c g   { \music }
}

seems to work. Note that \context does not recreate a context that already exists.

  • nice one, this is awesome! – nath Jan 7 '18 at 23:47
  • 1
    Adding the documentation: lilypond.org/doc/v2.18/Documentation/notation/… --- all this time using Lilypond, and I still miss things! Cool function that I'll have to incorporate more where appropriate. – Neal Jan 8 '18 at 13:48
  • +1 as it addresses the OP's issue "I would like this code to work regardless of the length of the pattern". – Rosie F Oct 8 '18 at 8:41
0
\version "2.18.2"

music = { c' e' g' s }
chord = { c1 }

\score {
  <<
    \chords {
      \transpose c c   { \chord }
      \transpose c f   { \chord }
      \transpose c bes { \chord }
      \transpose c ees { \chord }
      \transpose c aes { \chord }
      \transpose c des { \chord }
      \transpose c fis { \chord }
      \transpose c b   { \chord }
      \transpose c e   { \chord }
      \transpose c a   { \chord }
      \transpose c d   { \chord }
      \transpose c g   { \chord }
    }
    \new Staff {
      \transpose c c   { \music }
      \transpose c f   { \music }
      \transpose c bes { \music }
      \transpose c ees { \music }
      \transpose c aes { \music }
      \transpose c des { \music }
      \transpose c fis { \music }
      \transpose c b   { \music }
      \transpose c e   { \music }
      \transpose c a   { \music }
      \transpose c d   { \music }
      \transpose c g   { \music }
    }
  >>
}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.