我有一种情况,我有一段重复出现的音乐,只有轻微的变化。我想把一个基片作为一个变量。然后重复使用它多次,每次都通过替换一些注释或度量来更改它。下面是一个简化的示例
base = { c4 c c c }
% pseudo function replace MUSIC FROM TO ORIG
% FROM and To are pairs of numbers COUNT DURATION
from = #'(1 2)
to = #'(3 4)
var1 = replace { d4 } from to base
% this means replace
% from "after 1 half note into the music"
% to "after 3 quarter notes into the music"
% that is replace the third beat with { d4 }
% this will be equivalent to
var1 = { c4 c d c }
我该怎么做?
这方面的LilyPond解决方案是tag
。我还没有找到一个内置的功能来动态更改音乐表达。然而,对于变体用例,标记可以达到这个目的。上面的例子就是这个
base = { c4 c tag #'base c tag #'var1 d c }
var1 = keepWithTag #'var1 base