【问题标题】:Lilypond: Change color of notes below and above a certain pitchLilypond:改变低于和高于某个音高的音符颜色
【发布时间】:2019-06-01 10:16:13
【问题描述】:

在为录音机(长笛)编写 Lilypond 乐谱时,我希望我可以通过更改颜色来自动标记超出乐器范围的音高音符。

这个想法是,例如,所有低于 f 的绝对音高和高于 g'' 的所有绝对音高都为低音乐器着色为红色。男高音、中高音和女高音乐器也是如此。

我在coloring notes 上发现了一个有用的问题,但仍有一段代码我无法编写:

#(define (ambitus-notehead-alt grob)
  ( **code_i_cannot_write** )
#(define (ambitus-notehead-tenor grob)
  ( **code_i_cannot_write** )
#(define (ambitus-notehead-bass grob)
  ( **code_i_cannot_write** )

\score {
  \new Staff \relative c' {
    \override NoteHead #'color = #ambitus-notehead-alt
    \music_altrecorder
  }
  \new Staff \relative c' {
    \override NoteHead #'color = #ambitus-notehead-tenor
    \music_tenorrecorder
  }
  \new Staff \relative c' {
    \override NoteHead #'color = #ambitus-notehead-bass
    \music_bassrecorder
  }
}

【问题讨论】:

    标签: lilypond


    【解决方案1】:

    这里有一个功能可以满足你的需求:

    \version "2.19.82"
    
    #(define (colour-out-of-range grob)
       (let* ((pch (ly:event-property (event-cause grob) 'pitch))
              (semitones (ly:pitch-semitones pch)))
              (cond ((< semitones 0) red)
                    ((> semitones 24) red)
                    (else black))))
    
    \score {
      \new Staff \relative c' {
        \override NoteHead.color = #colour-out-of-range
        g8 a b c d e f g a b c d e f g a b c d e f g
      }
    }
    

    制作:

    要根据您的仪器范围对其进行自定义,请更改 (&lt; semitones 0)(&gt; semitones 24) 的值。 0 的值是中间 C (C4),增量为 1 等于一个半音。因此,在上述情况下,范围在 C4-C6 之间。您需要对低于中间 C 的音高使用负值(例如 -5 是 G3)。

    【讨论】:

      猜你喜欢
      • 2020-03-27
      • 2010-12-26
      • 2011-12-17
      • 1970-01-01
      • 2013-09-30
      • 1970-01-01
      • 2021-10-26
      相关资源
      最近更新 更多