问题
我正在使用LilyPond 来排版供教堂唱诗班表演的乐谱。 根据每周有空的人员,歌曲将以不同的调进行播放。 我们有一位出色的钢琴家,她可以演奏我们向她扔的任何东西,而吉他手通常会用铅笔写出替代和弦,但我想通过提供我们想要的任何调的精美排版乐谱来让事情变得更容易。
假设我们要唱 ABC 歌曲。 首先,我将采用任何可用的源转录并将其输入 LilyPond 脚本中:
melody = \relative c' {
c c g g
a a g2
f f e e
d d c2 }
我希望能够自动转置它,所以如果我想要“G”中的整个内容,我将歌曲包装在 \transpose 调用中,如下所示
melody = \transpose c g \relative c' {
c c g g
a a g2
f f e e
d d c2 }
:我真正想要的是用一些东西代替“g”并多次生成旋律的输出。 简单的 LilyPond 变量在这里似乎不起作用,到目前为止,我还没有成功定义一个方案函数来执行此操作。
我目前所采取的方法是获取上述文件,将其命名为 twinkle.ly 并将其转换为名为 twinkle.ly.m4 的 M4 脚本,其内容如下所示:
melody = \transpose c _key \relative c' {
c c g g
a a g2
f f e e
d d c2 }
然后我通过执行来编译 while 内容以下行:
> m4 -D _key=g twinkle.ly.m4 > twinkle_g.ly && lilypond twinkle_g.ly
我编写了一个 Makefile 来为我执行此操作,为我拥有的每首歌曲和我感兴趣的每个键定义规则。
问题
必须有更好的方法来解决这个问题。 鉴于 Lilypond 支持嵌入式方案,我宁愿不使用对其进行预处理的宏。 还有其他人想出解决同样问题的方法吗?
problem
I'm using LilyPond 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.
So say we're going to sing our ABCs. First I'll take whatever source transcriptions available and enter it into a LilyPond script:
melody = \relative c' {
c c g g
a a g2
f f e e
d d c2 }
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:
melody = \transpose c g \relative c' {
c c g g
a a g2
f f e e
d d c2 }
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.
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:
melody = \transpose c _key \relative c' {
c c g g
a a g2
f f e e
d d c2 }
I then compile the while thing by executing the following line:
> m4 -D _key=g twinkle.ly.m4 > twinkle_g.ly && lilypond twinkle_g.ly
I've written a Makefile to do this for me, defining rules for every song I have and every key I'm interested in.
question
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?
发布评论
评论(3)
您可以引用旋律变量并将其移调为所需的调:
如果要将移调输出为单独的文件,请将它们嵌入到 \book 块中。
You can refer to the melody variable and have it transposed in the desired keys:
If you want to output the transpositions as separate files, embed them into \book blocks.
如果您想创建同一片段的两份副本,一份转置,一份不转置,您可以使用
\displayLilyMusic
。 例如,将显示
复制此输出并将其粘贴到您想要的任何位置。
If you want to create two copies of the same fragment, one transposed and one not, you can use
\displayLilyMusic
. For example,will display
Copy this output and paste it wherever you want.
使用免费的lilypond 的 Frescobaldi 编辑器。
它提供了一个强大的转置工具。
Use the free Frescobaldi editor for lilypond.
It provides a powerful transposition tool.