Hi Aaron, Thanks for the quick and helpful response!
> Yes. The list-splicing forms of # and $ are #@ and $@, respectively. Ah! > In this case, we are using $@ to take the list of bare pitches and have the > parser handle them the same as if the user had simply entered them. Nice to know how that works. > I have learned to never make assumptions on performance without concrete, > profiling data. A good philosophy. > Mainly, I wanted to show you a different coding pattern just so you are aware > of the options available. Definitely appreciated! > music-pitches extracts just the pitch information from the music. That means > a lot of what makes up a music expression is lost in the process. For > instance, chords will appear as individual pitches. Depending on your needs, > this could be acceptable. It was also a relatively gentle way in to Scheme-ing. ;) > However, is it ultimately your intention to transform a music expression by > altering the pitches according to some process (like a \modalTranspose)? Yes. > If so, extracting pitches is probably not the best approach. Instead, you > will want to use music-map (or one of its kin) to help you traverse the music > expression, so you can then conditionally modify each part as needed. Very helpful! Here’s an example of what I’m currently playing around with: %%%% SNIPPET BEGINS \version "2.19.83" \language "english" rowrefs = #'(6 8 7 2 3 12 5 4 11 1 10 9) test = { ef4. <fs' a'>8 g2 r4 <b d''>8 cs' } xform-pitches = #(define-music-function (music) (ly:music?) (music-map (lambda (elem) (if (memq 'note-event (ly:music-property elem 'types)) (let* ((pitch (ly:music-property elem 'pitch)) (semitone (ly:pitch-semitones pitch)) (index (modulo semitone (length rowrefs)))) (ly:music-set-property! elem 'pitch (ly:make-pitch 0 (list-ref rowrefs index) 0)))) elem) music) music) \layout { \context { \Staff \name RowReductionStaff \alias Staff \inherit-acceptability RowReductionStaff Staff \omit Clef \omit TimeSignature \omit Stem \omit Flag \omit Beam \omit Dots \omit Rest \omit BarLine \override NoteHead.duration-log = #4 } } \score { << { \test } \new RowReductionStaff { \xform-pitches \test } >> } %%%% SNIPPET ENDS Thanks for your help so far! Cheers, Kieren. ________________________________ Kieren MacMillan, composer (he/him/his) ‣ website: www.kierenmacmillan.info ‣ email: i...@kierenmacmillan.info