;; length.sal -- using a length pattern generator object ;; (c) 2008 by Roger B. Dannenberg define function length-demo(number-of-notes) begin ;; grab some pitches from a heap ;; grab a length from another heap ;; use length pattern to regroup pitches from the first ;; heap into period lengths from the second heap ;; copy each period 4 times. ;; This could also be accomplished by setting the for: ;; parameter of the first heap to the second heap since ;; for: controls the period length. with pitch-pat = make-heap({c2 g2 c3 g3 a3}), length-pat = make-heap({3 5 7}), pat = make-copier(make-length(pitch-pat, length-pat), repeat: 4) return score-gen( score-len: number-of-notes, pitch: next(pat), ioi: 0.2, vel: 100) end exec score-play(length-demo((3 + 5 + 7) * 4 * 2))