自编命令:分解和弦


lilypond没找到分解和弦的指令,特别是\chordmode下,只能打和弦本体,不能打分解和弦

所以试着设计了一下命令,由于不懂程序,摸索过程那叫一个昏天黑地……

直接讲结果::

一般模式下使用\ArpeggioChord

和弦模式下用\ArpeggioChordm

注意!这两项命令必须复制命令区的全部代码!

一般模式下性价比不高,更多是和弦模式好用……

先贴效果,再贴命令

\version "2.22.1"
\language "english"

%%%%%% 本文件设计了分解和弦的方法 %%%%%%%%

%%%%%%%%%%%%% 以下是命令区,要使用该命令请复制全部内容 %%%%%%%%%%%%%

%%%%%%%%%%%%% 基础指令区 %%%%%%

#(define (get-elements mymusic)
   (ly:music-property mymusic 'elements)
   )

#(define (get-sequential-music mymusic)
   (ly:music-deep-copy mymusic)
   )

%%%%%%%%% 一般模式下的和弦 %%%%%%%%

ArpeggioChord=
#(define-music-function (mymusic) (ly:music?)
   (make-sequential-music
    (apply append
      (map get-elements
        (get-elements (get-sequential-music mymusic)))))
   )

%%%%%%%%% chordmode 需要额外增加这一条 %%%%%%%

#(define (go-into-chordmode mymusic)
   (ly:music-property
    (ly:music-deep-copy mymusic)
    'element)
   )

%%%%%%%%% chordmode 模式下 %%%%%%%%

ArpeggioChordm=
#(define-music-function (mymusic) (ly:music?)
   (make-sequential-music
    (apply append
      (map get-elements
        (get-elements (get-sequential-music 
                      (go-into-chordmode mymusic))))))
   )

%%%%%%%%%% 命令区结束,复制到此为止 %%%%%%%%%%%

%%%%%%%%%% 命令应用实例 %%%%%%%%%%%%%%%%%%

\markup {"一般模式下的分解和弦"}

MyMusic={
  4
  
}

\markup {"这是原位"}
{ \MyMusic }

\markup {"这是分解"}
{
  \ArpeggioChord \MyMusic
}


\markup {"chordmode下的分解和弦"}
\markup {"这是原位"}
ChordList=
  \chordmode{
  % 可往这里填和弦
    
    c4:7 d4:7 e4:m7 g:maj7
  }
{
   \ChordList
}

\markup {"这是分解"}
{
  \ArpeggioChordm \ChordList
}

相关