Search code examples
lilypondtypesettingmusic-notation

use Lilypond to transpose pattern around circle of fifths


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).


Solution

  • If you want automatic note names, it can be achieved by transposing chords. Something like this produces a similar result to what you show. It is not simple and elegant but it is automatic in the sense that you don't need to know the destination chord previously.

    \version "2.19.31"
    
    cOne=\chordmode {c1} 
    
    mOne={ c'4 e' g' s }
    
    
    <<
      \new ChordNames{
        \transpose c f {\transpose c f { \cOne }}
        \transpose c f { \cOne }
        \cOne  
        \transpose c g { \cOne }
        \transpose c g { \transpose c g { \cOne }}
        \transpose c g { \transpose c g { \transpose c g { \cOne }}}
      }
    
      \new Staff {
        \transpose c f,  {\transpose c f { \mOne }}
        \transpose c f { \mOne }
        \mOne
        \transpose c g { \mOne }
        \transpose c g, { \transpose c g { \mOne }}
        \transpose c g, { \transpose c g { \transpose c g { \mOne }}}
      }
    >>
    

    sample lilypond output