我正在使用4部分声乐。我试图在每个声部中使关键音符的颜色不同。基于以前的答案和lilypond片段,我有这段代码:
%Association list of pitches to colors.
#(define color-mapping
(list
(cons (ly:make-pitch 0 6 FLAT) (x11-color 'blue))))
%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 (event-cause grob) 'pitch)))
然后在每个声音中我称之为:
\override NoteHead.color = #color-notehead
这使得得分中的每一个Bb都是蓝色的,这是一个很好的开始。但是我希望能够将Bb配成蓝色,声音两个绿色等,这样我的歌手一眼就可以看出他们有补品音符。
笨重的解决方案是制作4种不同版本的音乐,并且每个版本只能在一个声音中调用覆盖NoteHead.color。并根据语音部分为每位歌手提供不同的版本。
是否有编码方式来执行此操作,其中特定音符是每种语音的不同颜色?
答案 0 :(得分:0)
最简单的解决方案可能是为每种不同的声音定义不同的功能,而在每个功能定义中,您都使用不同的颜色。这是一个有两个声音的例子:
\version "2.19.53"
%Association list of pitches to colors.
#(define color-mapping-voice1
(list
(cons (ly:make-pitch 0 6 FLAT) (x11-color 'blue))))
#(define color-mapping-voice2
(list
(cons (ly:make-pitch 0 6 FLAT) (x11-color 'red))))
%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-voice1 pitch)
(let ((color (assoc pitch color-mapping-voice1 pitch-equals?)))
(if color
(cdr color))))
#(define (pitch-to-color-voice2 pitch)
(let ((color (assoc pitch color-mapping-voice2 pitch-equals?)))
(if color
(cdr color))))
#(define (color-notehead-voice1 grob)
(pitch-to-color-voice1
(ly:event-property (event-cause grob) 'pitch)))
#(define (color-notehead-voice2 grob)
(pitch-to-color-voice2
(ly:event-property (event-cause grob) 'pitch)))
{
\new Staff <<
\new Voice{
\voiceOne
\override NoteHead.color = #color-notehead-voice1
bes' bes' d'' f''
}
\new Voice{
\voiceTwo
\override NoteHead.color = #color-notehead-voice2
bes d' f' bes'
}
>>
}
产: