\version "2.22.0" tuneMIDI = #(define-music-function (scale music) (list? ly:music?) (for-some-music (lambda (m) (let ((pitch (ly:music-property m 'pitch))) (if (ly:pitch? pitch) (let* ((tones (ly:pitch-tones pitch)) (r (ly:moment-main (ly:moment-mod (ly:make-moment tones 0) (ly:make-moment 6 0)))) (offset (assv-ref scale r))) (ly:message "~s" r) (if offset (let* ((transpose-pitch (ly:make-pitch 0 0 offset)) (new-pitch (ly:pitch-transpose pitch transpose-pitch))) (ly:music-set-property! m 'pitch new-pitch) #t) #f)) #f))) music) music) myNotes = \relative { a b c d e f gis a b c d e f gis a } { \myNotes } \score { \tuneMIDI #'( ; Lower F (5/2 tones above C) by 1/10 tone. (5/2 . -1/10) ; Raise G# by 1/10 tone. (4 . 1/10) ) \myNotes \midi { } }