;; score-apply.sal -- example using score-apply ;; ;; (c) 2008 by Roger B. Dannenberg set my-score = {{0 0 {score-begin-end 0 3}} {0 2 {flute pitch: 74 vel: 100}} {2 1 {flute pitch: 75 vel: 90 }}} define function transform-accidentals( start, dur, expr) begin if member(expr-get-attr(expr, keyword(pitch)) % 12, {1 3 6 8 10}) then return list(start, dur, cons(quote(violin), params-transpose(rest(expr), keyword(pitch), 12))) else return list(start, dur, expr) end set my-new-score = score-apply(my-score, quote(transform-accidentals)) exec score-print(new-score)