Hi David, > This will also adjust eis and eses to e. Note names are numbers and can > be compared with = . (make-music 'NoteEvent m) is silly and creates an > unnecessary copy. You can just use m instead.
Thanks — current version: %%% SNIPPET BEGINS \version "2.25.11" adjustPitch = #(define-music-function (pitchIn pitchOut music) (ly:pitch? ly:pitch? ly:music?) (music-map (lambda (m) (if (music-is-of-type? m 'note-event) (if (and (= (ly:pitch-notename (ly:music-property m 'pitch)) (ly:pitch-notename pitchIn)) (= (ly:pitch-alteration (ly:music-property m 'pitch)) (ly:pitch-alteration pitchIn))) (ly:music-set-property! m 'pitch (ly:make-pitch (ly:pitch-octave (ly:music-property m 'pitch)) (ly:pitch-notename pitchOut) (ly:pitch-alteration pitchOut))) m) #f) m) music)) testmusic = \fixed c' { c4 d es e f g c' es' eis' } { \testmusic } { \adjustPitch ees e \testmusic } %%% SNIPPET ENDS Q: Is there a more efficient way to test for note name and alteration independent of octave? > If you do, you don't replace any music, so music-map is unnecessary. > This can be better done with for-some-music . I tried a few times, but got errors (about returning unspecified). Hints appreciated. As for next step(s): I’m thinking some let-ing would make sense? Thanks, Kieren. ______________________________________________ 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.