rsc3/doc/examples/graph/synthetic-piano.rkt

24 lines
655 B
Racket

#lang racket
;; status - working as of 20220820
(require rsc3)
;; synthetic piano (jmcc)
(define sp
(lambda (_)
(let* ((n (i-rand 36 90))
(f (rand 0.1 0.5))
(ph (rand 0 (mul pi 2)))
(s (mul (impulse ar f ph) 0.1))
(e (decay2 s 0.008 0.04))
(c
(lambda (i)
(let* ((n0 (lf-noise2 ar 3000))
(o (list-ref (list -0.05 0 0.04) i))
(dt (fdiv 1 (midi-cps (add n o)))))
(comb-l (mul n0 e) dt dt 6))))
(l (sub (fdiv (sub n 36) 27) 1)))
(pan2 (mix-fill 3 c) l 1))))
(audition (out 0 (mix-fill 6 sp)))