;; window.sal -- using a window pattern generator object ;; (c) 2012 by Roger B. Dannenberg define function window-demo(number-of-notes) begin ;; make a sequence 1, 1, 1, 1, ... using cycle({1}) ;; accumulate to form 1, 2, 3, 4, ... ;; use window to take overlapping 6-note sequences ;; (variations: try make-window on more complex melodies ;; try a duration pattern of length 6, ;; try a duration pattern of length 5, ;; try different window sizes than 6, ;; try different window skips than 1) with melody-pat = make-accumulate(make-cycle({1})), pitch-pat = make-window(melody-pat, 6, 1) return score-gen( score-len: number-of-notes, pitch: 30 + next(pitch-pat), ioi: 0.1, vel: 100) end exec score-play(window-demo(100))