Hi Werner, Wouldn’t ly:pitch-diff save some of your work?
Just a thought-experiment… Kieren > On Jul 16, 2024, at 2:32 AM, Werner LEMBERG <[email protected]> wrote: > > > I want to find the interval size of a two-note chord in a music > function, and I came up with the following solution. > > ```tex > showInterval = > #(define-music-function (ev-chord) > (ly:music?) > > (define (interval-string a b) > (number->string (1+ (ly:pitch-steps (- b a))))) > > (let* ((notes (extract-named-music ev-chord 'NoteEvent)) > (bottom (ly:music-property (first notes) 'pitch)) > (top (ly:music-property (second notes) 'pitch)) > (dur (ly:music-property (first notes) 'duration))) > (make-relative (bottom top) > #{ < #bottom #top > #} > #{ < $bottom $top > $dur > ^ #(interval-string bottom top) #}))) > > \relative c' { > \showInterval <d a'>4 \showInterval <d d'>4 > } > ``` > > Is there a better, less convoluted way to do that? Any advice is > highly appreciated. ______________________________________________ My work day may look different than your work day. Please do not feel obligated to read or respond to this email outside of your normal working hours.
