\version "2.22" test={ c'8 d' ees' f' g'4 r \bar "||" } harms=\chordmode { c1 } rectify= #(define-music-function (n music) (number? ly:music?) (if (> n 0) #{ \transpose #(ly:make-pitch 0 0 (/ n 2)) #(ly:make-pitch 0 1 (/ (- n 2) 2)) #music #} (if (< n 0) #{ \transpose #(ly:make-pitch 0 1 (/ n 2)) #(ly:make-pitch 0 0 (/ (+ n 2) 2)) #music #} music))) notes= #(define-music-function (l) (list?) (define (L n) (if (< n (length l)) (list-ref l n) 0)) #{ \rectify #(L 0) \test \rectify #(L 1) \transpose c cis \test \rectify #(L 2) \transpose c d \test \rectify #(L 3) \transpose c ees \test \rectify #(L 4) \transpose c e \test \rectify #(L 5) \transpose c f \test \rectify #(L 6) \transpose c fis \test \rectify #(L 7) \transpose c g \test \rectify #(L 8) \transpose c gis \test \rectify #(L 9) \transpose c a \test \rectify #(L 10) \transpose c bes \test \rectify #(L 11) \transpose c b \test #}) harmonics= #(define-music-function (l) (list?) (define (L n) (if (< n (length l)) (list-ref l n) 0)) #{ \rectify #(L 0) \harms \rectify #(L 1) \transpose c cis \harms \rectify #(L 2) \transpose c d \harms \rectify #(L 3) \transpose c ees \harms \rectify #(L 4) \transpose c e \harms \rectify #(L 5) \transpose c f \harms \rectify #(L 6) \transpose c fis \harms \rectify #(L 7) \transpose c g \harms \rectify #(L 8) \transpose c gis \harms \rectify #(L 9) \transpose c a \harms \rectify #(L 10) \transpose c bes \harms \rectify #(L 11) \transpose c b \harms #}) combined= #(define-music-function (p l) (ly:pitch? list?) #{ \transpose c #p << \new ChordNames \harmonics #l \new Staff \notes #l >> \bar "|." #}) \score { \combined c #'() \layout { } } \score { \combined d #'(0 1 0 0 0 0 1 0 1 0 0 0) \layout { } } \score { \combined a #'(0 1 0 0 0 0 1 0 1 0 0 1) \layout { } }