\version "2.12.0" %schemeIndentOn besideCN = #(define-music-function (parser location where what) (integer? string?) #{\once \override ChordNames.ChordName #'stencil = #(lambda (grob) (let* ( (whatlen (string-length $what)) (clamped (lambda (index) (cond ((< index 0) 0) ((> index whatlen) whatlen) (else index)))) (split (clamped (cond ((negative? $where) (+ $where whatlen 1)) ((positive? $where) (- $where 1)) (else (quotient whatlen 2))))) (insert (lambda (i-side i-text) ; (integer? string?) (if (> (string-length i-text) 0) (ly:grob-set-property! grob 'text (markup #:put-adjacent 0 i-side (ly:grob-property grob 'text) i-text)))))) (if (and (= $where CENTER) (odd? whatlen)) (insert -1 (substring $what split (+ split 1)))) (insert -1 (substring $what 0 split )) (insert 1 (substring $what split whatlen ))) (ly:text-interface::print grob)) #}) replaceCN = #(define-music-function (parser location new) (markup?) #{\once \override ChordNames.ChordName #'stencil = #(lambda (grob) (grob-interpret-markup grob $new)) #}) % %schemeIndentOff %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% sharpadj = \markup { \translate #'(0.0 . 0.5) \fontsize #-1 \sharp } flatadj = \markup { \translate #'(0.2 . 0.2) \fontsize #-1 \flat } nullCN = \replaceCN \markup \null slash = \markup { \bold \fontsize #1 \char ##x2044 } % fraction slashCN = \replaceCN \slash percent = \markup { \bold \fontsize #1 \char ##x066A } % arabic percentCN = \replaceCN \percent %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% harmonies = \chordmode { f1:maj \besideCN #LEFT "( " e2:m5-.7 \besideCN #RIGHT " )" a2:7 d1:m \besideCN #CENTER "( )" gis1:7 % a middle character is used twice \bar "||" \break \besideCN #-1 "beside" a1 % i.e. #LEFT \besideCN #-2 "beside" a1 \besideCN #-3 "beside" a1 \besideCN #-4 "beside" a1 \bar "||" \break bes2:m \replaceCN \markup \line { "/A" \flatadj } bes2:m/aes % elide root as LSR776 \replaceCN \markup { "F" \small "phryg" } bes4:m/f % rename \nullCN bes4:m/f \slashCN bes4:m/f \slashCN bes4:m/f % strum beats \nullCN bes2:m/f \percentCN bes2:m/f % simile \bar "||" } << \new ChordNames { \set chordChanges = ##f \harmonies } \new Staff { \repeat unfold 22 r2 } >> \paper { indent = 0\mm line-width = 160\mm - 2.0 * 0.4\in line-width = #(- line-width (* mm 3.000000)) } \layout { } % chordnames can collide: % http://lists.gnu.org/archive/html/lilypond-user/2011-06/msg00232.html