;; Franco 20131019
;; The five notes from Close Encounters of the Third Kind (CETK).
;; This is a simple infinite loop that makes use of clock
;; to decide what to play. Clock is a variable that starts from
;; 0 and increases by 1 at each iteration.
;; The idea is simple:
;; - We define num=10: each sequence has length 10.
;; - When clock modulo num is 0, we play a heart beat
;; - When clock modulo num is 0, we play a5
;; - We play the other notes when modulo is 1, 2, 3, 4
;; - The last note c5 has double length
;; - We don't do anything when modulo is 5, 6, 7, 8;
;; - We decrease the interval (bpm) between sequences when modulo is 9.
;; - When the interval is below 0.1, we re-set bpm to 0.8
(require fluxus-018/fluxa)
(define f4 349.23)
(define c5 523.25)
(define f5 698.46)
(define g5 783.99)
(define a5 880)
(define num 10)
(define bpm 0.8)
(seq
(lambda (time clock)
; a nice heartbeat, every other one
(when (zmod clock 2)
(play time (mul (sine (mul 100 (pow (adsr 0 0.1 0.8 1) 6)))
(adsr 0 0.5 0.4 5))))
(when (eq? (modulo clock num) 0)
(play time
(mul (saw g5) (adsr 0 0.05 0.05 (* 0.9 bpm)))))
(when (eq? (modulo clock num) 1)
(play time
(mul (saw a5) (adsr 0 0.05 0.05 (* 0.9 bpm)))))
(when (eq? (modulo clock num) 2)
(play time
(mul (saw f5) (adsr 0 0.05 0.05 (* 0.9 bpm)))))
(when (eq? (modulo clock num) 3)
(play time
(mul (saw f4) (adsr 0 0.05 0.05 (* 0.9 bpm)))))
(when (eq? (modulo clock num) 4)
(play time
(mul (saw c5) (adsr 0 0.05 0.05 (* 1.9 bpm)))))
(when (eq? (modulo clock num) 9)
(set! bpm (* 0.92 bpm)))
(when (< bpm 0.1)
(set! bpm 0.8))
bpm))