;; encapsulation.sal -- uses many calls to notes function ;; (c) 2008 by Roger B. Dannenberg define variable *score* define function notes(start, tempo, transpose) begin with pitch-pat = make-heap(list(C4, D4, DS4, F4, FS4, GS4, A4, B4, C5)), dur-pat = make-heap(list(s, s, s, sd, sd, sd, i, i, id, id, qd)) return score-shift( score-gen(score-len: 9, pitch: transpose + next(pitch-pat), ioi: tempo * next(dur-pat)), start) end set *score* = nil loop for i from 0 below 6 set *score* = score-merge(*score*, notes(2 * i, exp(i / -6.0), i * 5)) end exec score-play(*score*)