Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat is the best way to automatically transpose a LilyPond source file into multiple keys?
    primarykey
    data
    text
    <p><strong>problem</strong></p> <p>I'm using <a href="http://lilypond.org/web/" rel="noreferrer">LilyPond</a> to typeset sheet music for a church choir to perform. Depending on who is available on any given week, songs will be played in various keys. We have an amazing pianist who can play anything we throw at her and the guitarists will typically pencil in alternate chords, but I want to make things easier by having beautifully typeset sheet music available in any key we want.</p> <p>So say we're going to sing our ABCs. First I'll take whatever source transcriptions available and enter it into a LilyPond script:</p> <pre><code>melody = \relative c' { c c g g a a g2 f f e e d d c2 } </code></pre> <p>I want the ability to transpose this automatically, so if I want the whole thing in 'G' I wrap the song in a \transpose call like so:</p> <pre><code>melody = \transpose c g \relative c' { c c g g a a g2 f f e e d d c2 } </code></pre> <p>What I really want is to substitute something for the 'g' and generate the output for melody multiple times. Simple LilyPond variables don't seem to work here, and so far I've been unsuccessful in defining a scheme function to do this.</p> <p>What I've resorted to for the moment is taking the above file, call it twinkle.ly and turning it into an M4 script called twinkle.ly.m4, the contents of which look like this:</p> <pre><code>melody = \transpose c _key \relative c' { c c g g a a g2 f f e e d d c2 } </code></pre> <p>I then compile the while thing by executing the following line:</p> <pre><code>&gt; m4 -D _key=g twinkle.ly.m4 &gt; twinkle_g.ly &amp;&amp; lilypond twinkle_g.ly </code></pre> <p>I've written a Makefile to do this for me, defining rules for every song I have and every key I'm interested in.</p> <p><strong>question</strong> There's got to be a better way of going about this. Given that Lilypond supports embedded scheme, I would prefer to not use a macro preprocessed on it. Has anybody else come up with a solution to this same problem?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload