2

Lilypond has a \transpose command: the following notation

\transpose c d { \relative c' { c4 d e f g } }

produces

enter image description here

I was wondering if I can use this command somehow to produce transposed notation, i.e.

\relative d' { d4 e fis g a }

or if there are another other tricks to do this. Currently I'm using find & replace in a text editor, which is rather error-prone.

I am using Lilypond's notation to store melodies for another program, that's why I want to have it in a specific key rather than to rely on \transpose to be present.

5
  • a job for grep?
    – Aaron
    Feb 6 at 18:59
  • I'm certain I can program a solution in half a dozen languages - I was just hoping Lilypond has this built-in...
    – Glorfindel
    Feb 6 at 19:01
  • 1
    \lilygrep? :-)
    – Aaron
    Feb 6 at 19:13
  • SInce there are some doubts in existing answers: You want to create lilypond code containing the transposition result, not simply a transposed score - corrrect?
    – guidot
    Feb 6 at 20:37
  • @guidot correct
    – Glorfindel
    Feb 6 at 20:38

2 Answers 2

2

You are confused about what LilyPond does. LilyPond is not an editor. It processes your input but does not work on it. While there are things like \displayLilyMusic, they are not really reflecting a relation to the input of the program.

Instead you need (or at least you call for) an editor that has a grasp of LilyPond input syntax and can work with it. There does not appear to exist a useful Emacs mode for this, but the LilyPond IDE "Frescobaldi" has numerous input conversion tools for converting absolute/relative notation and also for transposing the input in-place.

2
  • 1
    There is also the command line utility python-ly, but the Frescobaldi IDE is much more user friendly.
    – ksnortum
    Feb 7 at 14:43
  • I'll give Frescobaldi a try, thanks!
    – Glorfindel
    Feb 7 at 20:53
0

How is your example not transposed notation? Are you thinking of, say, \transpose d c, namely transposing what is entered as d to notation based on c? If you are producing MIDI, you may also want to look up the \transposition command. Actually, what is wrong with the LilyPond manual section for transposing instruments?

1
  • I am using Lilypond's notation to store melodies for another program, that's why I want to have it in a specific key rather than to rely on \transpose to be present.
    – Glorfindel
    Feb 6 at 18:56

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.