;; my-first-merge.sal -- example using score-merge ;; ;; (c) 2008 by Roger B. Dannenberg ; Compute and merge 6 different scores: ; 1, 2, 3a, 3b, 3c and 3d. ; Score-1 is the "melody", derived from an octatonic ; scale emitted by a palindrome pattern. set pitch-1 = make-palindrome( list(ef3, e3, fs3, g3, a3, bf3, c4, cs4)) set rhythm-1 = make-accumulation( {.22 .23 .25 .26 .28 .29 .31}) define function score-1-helper(count) set vel-1 = interpolate(count, 0, 40, 47, 125), ioi-1 = next(rhythm-1) exec score-gen(save: quote(score-1), score-len: 48, pre: score-1-helper(sg:count), pitch: next(pitch-1), ioi: ioi-1, vel: vel-1, dur: vel-1 * 0.01 * ioi-1) ; Score-2: chords that punctuate the melodic material set pitch-2 = make-random( list(list(list(c2, d3, ef4, f5)), list(nil), list(list(cs1, ds2, e3, fs4)), list(gs5))) set rhythm-2 = make-random( list(i, id, list(s, keyword(weight), .5), sd)) set vel-2 = make-heap({80 90 100}) define function score-2-helper() set vel-2-item = next(vel-2) exec score-gen(save: quote(score-2), begin: 7, score-dur: 4.5, pre: score-2-helper(), pitch: next(pitch-2), ioi: next(rhythm-2), vel: vel-2-item, dur: vel-2-item * 0.005) ; Scores 3a-3d: an accompaniment to pitch material set pitch-3a = make-cycle(list(c4, d5, ef6, f6)) set rhythm-3a = make-heap({0.01 0.035 0.048}) exec score-gen(save: quote(score-3a), begin: 2.8, score-len: 4, pitch: next(pitch-3a), vel: interpolate(sg:count, 0, 60, 3, 80), ioi: next(rhythm-3a), dur: 0.1) set pitch-3b = make-cycle(list(cs3, ds4, e5, fs6, gs7)) set rhythm-3b = make-heap({0.01 0.035 0.048}) exec score-gen(save: quote(score-3b), begin: 3.75, score-len: 5, pitch: next(pitch-3b), vel: interpolate(sg:count, 0, 60, 4, 80), ioi: next(rhythm-3b), dur: 0.1) set pitch-3c = make-cycle(list(c4, d5, ef6, f6)) set rhythm-3c = make-heap({0.01 0.035 0.048}) exec score-gen(save: quote(score-3c), begin: 4.1, score-len: 4, pitch: next(pitch-3c), vel: interpolate(sg:count, 0, 60, 3, 80), ioi: next(rhythm-3c), dur: 0.1) ; 3d generates chords set pitch-3d = make-cycle(list(list(cs2, ds3, e4), nil, list(ds3, e4, fs5), list(e4, fs5, g6), list(fs5, g6, gs7), list(g6, a7, as7))) set rhythm-3d = make-heap({0.12 0.124 0.126 0.128 0.132}) exec score-gen(save: quote(score-3d), begin: 4.1, score-len: 6, pitch: next(pitch-3d), vel: interpolate(sg:count, 0, 40, 5, 70), ioi: next(rhythm-3d), dur: 0.1) ;; now merge the scores set the-score = score-merge(score-1, score-2, score-3a, score-3b, score-3c, score-3d) ;; play it exec score-play(the-score)