% ------------------------------------------------------------------------- % Extra custom functions % ------------------------------------------------------------------------- % Alternative chords #(define (pitches-bass-inversion-context-list music context) "Creates a list containing relevant pitches, bass, inversion and context to serve as argument for `ignatzek-chord-names', derived from @var{music} " (let* (;; work on a copy of `music', warranting not to change it (m-add (ly:music-deep-copy music)) (ev-notes-orig (event-chord-notes m-add)) ;; if chord is an inversion some pitches are below root, in this case ;; 'octavation-property is set. ;; reset pitch of them ;; TODO this is an ugly hack, find better method (ev-notes (map (lambda (m) (if (and (not (null? (ly:music-property m 'octavation))) (= (ly:music-property m 'octavation) -1)) (begin (ly:music-set-property! m 'pitch (ly:pitch-transpose (ly:music-property m 'pitch) (ly:make-pitch 1 0 0))) m) m)) ev-notes-orig)) ;; sort the ptches ascending as expected by `ignatzek-chord-names' (ev-pitches (sort (map (lambda (m) (ly:music-property m 'pitch)) ev-notes) ly:pitch