无法实现 \include 来创建百合池样式表



我有一个有效的Lilypond文件,大约有80%的样式说明,我想将其用作其他歌曲的模板。 出于显而易见的原因,我宁愿将其放在样式表中,而不是复制/粘贴。 我很确定这是可行的,但是遵循Lilypond文档只会导致我破坏文件。

version "2.18.2"  % necessary for upgrading to future LilyPond versions.
header{
title = "Exercise: C, D, E Notes"
tagline = ""  % removed
}

paper{
#(set-paper-size "arch a" 'landscape)
system-system-spacing.basic-distance = #20
system-system-spacing.minimum-distance = #20
score-system-spacing.basic-distance = #20
markup-system-spacing.basic-distance = #15
indent = 0cm
}
%Text instructions for each section
mark_A = ^markup { small Fingering }^markup { bold "Treble Clef - Right Hand" }
mark_B = ^markup { small Fingering }^markup { bold "Bass Clef - Left Hand" }
%Association list of pitches to colors.
#(define color-mapping
(list
(cons (ly:make-pitch 0 0 -1/2) (rgb-color 0 0 0))
(cons (ly:make-pitch 0 0 0) (rgb-color 0 0 0))
(cons (ly:make-pitch 0 0 1/2) (rgb-color 0 0 0))
(cons (ly:make-pitch 0 1 -1/2) (rgb-color 0.8359375 0.64453125 0.796875))
(cons (ly:make-pitch 0 1 0) (rgb-color 0.8359375 0.64453125 0.796875))
(cons (ly:make-pitch 0 1 1/2) (rgb-color 0.8359375 0.64453125 0.796875))
(cons (ly:make-pitch 0 2 -1/2) (rgb-color 0.4453125 0.7421875 0.2655625))
(cons (ly:make-pitch 0 2 0) (rgb-color 0.4453125 0.7421875 0.2655625))
(cons (ly:make-pitch 0 2 1/2) (rgb-color 0.4453125 0.7421875 0.2655625))
(cons (ly:make-pitch 0 3 -1/2) (rgb-color 0.96875 0.6171875 0.15234375))
(cons (ly:make-pitch 0 3 0) (rgb-color 0.96875 0.6171875 0.15234375))
(cons (ly:make-pitch 0 3 1/2) (rgb-color 0.96875 0.6171875 0.15234375))
(cons (ly:make-pitch 0 4 -1/2) (rgb-color 0 0.67578125 0.9296875))
(cons (ly:make-pitch 0 4 0) (rgb-color 0 0.67578125 0.9296875))
(cons (ly:make-pitch 0 4 1/2) (rgb-color 0 0.67578125 0.9296875))
(cons (ly:make-pitch 0 5 -1/2) (rgb-color 0.91796875 0 0.54296875))
(cons (ly:make-pitch 0 5 0) (rgb-color 0.91796875 0 0.54296875))
(cons (ly:make-pitch 0 5 1/2) (rgb-color 0.91796875 0 0.54296875))
(cons (ly:make-pitch 0 6 -1/2) (rgb-color 0.671875 0.39453125 0.0546875))
(cons (ly:make-pitch 0 6 0) (rgb-color 0.671875 0.39453125 0.0546875))
(cons (ly:make-pitch 0 6 1/2) (rgb-color 0.671875 0.39453125 0.0546875))
))
%Compare pitch and alteration (not octave).
#(define (pitch-equals? p1 p2)
(and
(= (ly:pitch-alteration p1) (ly:pitch-alteration p2))
(= (ly:pitch-notename p1) (ly:pitch-notename p2))))
#(define (pitch-to-color pitch)
(let ((color (assoc pitch color-mapping pitch-equals?)))
(if color
(cdr color))))
#(define (color-notehead grob)
(pitch-to-color
(ly:event-property (ly:grob-property grob 'cause) 'pitch)))
%BEGINNING OF ACTUAL SHEET MUSIC
music_A = relative c' {
time 4/4
override Staff.TimeSignature #'style = #'() 
clef "treble"
override NoteHead #'color = #color-notehead
c4-mark_A-1 c-1 c-1 c-1 | d-2 d-2 d-2 d-2 | e-3 e-3 e-3 e-3 | e2-3 e-3 | break
e4-3 e-3 e-3 e-3 | d-2 d-2 d-2 d-2 | c-1 c-1 c-1 c-1 | c2-1 c-1  | bar "|." break
}

music_B = relative c {
time 4/4
override Staff.TimeSignature #'style = #'() 
clef "bass"
override NoteHead #'color = #color-notehead
e4-mark_B-3 e-3 e-3 e-3 | d-4 d-4 d-4 d-4 | c-5 c-5 c-5 c-5 | c2-5 c-5  | break
e4-3 e-3 e-3 e-3 | d-4 d-4 d-4 d-4 | c-5 c-5 c-5 c-5 | c2-5 c-5  | bar "|."
}
%Score Engraving
score{
new Staff music_A
layout{}
}

score{
new Staff music_B
layout{}
}
score{
new Staff {music_A music_B}
midi{
tempo 4 = 144
}
}

理想情况下,我想将\paper说明和大的间距到颜色部分拉到它们自己的模板中并包含它们。 我确信解决方案是显而易见的,但由于某种原因,Lilypond的文档不同意我的观点。

事实证明它真的很简单。 文档参考包括两个部分 - 一个(我首先找到的那个(贯穿一个非常复杂的场景,涉及定义变量等。 第二个(更简单(简单地使用:

include "filename.ly"

并粘贴该文件中的任何内容。 很抱歉浪费了时间,但希望有和我刚刚一样脑屁的人会发现这很有帮助。

相关内容

  • 没有找到相关文章

最新更新