; phasing-woodruff.sal ; based on phasing-woodruff.lsp by John Woodruff ; translated by Roger fB. Dannenberg ; Dec 2008 ;; Note: this is not an exact translation of phasing-woodruff.lsp define function calc-rhy(number1, number2) begin if number1 < 120 then set number1 = number1 ; no adjustment else if number1 < 180 then set number1 = 240 - number1 else if number1 < 240 then set number1 = number1 - 120 else if number1 < 300 then set number1 = 360 - number1 return number1 / number2 end begin ;; score-one plays the note a4 with a rhythmic value specified by ;; the function calc-rhy with ioi exec score-gen(save: quote(score-one), score-dur: 60, pre: setf(ioi, calc-rhy(sg:count, 300.0)), pitch: a4, ioi: ioi, dur: ioi / 2.0, post: #display("one", sg:count, ioi)) end begin ;; score-two plays f4, a4, cs5 or f5 depending on the value ;;; of count with one, ioi exec score-gen(save: quote(score-two), score-dur: 60, pre: progn(setf(one, sg:count % 4), setf(ioi, calc-rhy(sg:count, 300.0))), pitch: second(assoc(one, {{0 65} {1 69} {2 73} {3 77}})), vel: interpolate(sg:start, 0, 20.0, 60, 127), ioi: ioi, dur: ioi / 2.0) end begin ;; score-three plays the note cs5 with a rhythmic value specified by ;; the function cacl-rhy with ioi exec score-gen(save: quote(score-three), score-dur: 60, pre: setf(ioi, calc-rhy(sg:count, 302.0)), pitch: cs5, vel: interpolate(sg:start, 0, 20.0, 60, 127), ioi: ioi, dur: ioi / 2.0) end ;; pwev generates an exponential envelope. This one fades out from 55 ;; to 60 seconds, where it ends. ;; timed-seq turns a score into a sound. Timed-seq is used instead ;; of score-play because score-play plays the score directly. Here, ;; we want the score as a sound so that we can multiply by the envelope ;; to make it fade out. The play command plays the resulting sound. ;; play pwev(1, 55, 1, 60, 0.001) * timed-seq(score-merge(score-one, score-two, score-three))