;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;
;;; La misma funcion pero con un desplazamiento espacial
;;; con un rango dinamico pequeno en las frecuencias
;;; puede ser utilizada como doppler
;;;
;;; juanig\_at\_ccrma
;;;
;;; (c) 2005
(define brisa-ex
(lambda* (comienzo dur amp
#:key
(frecuencias '(0 700 1 8000 ))
(radianes '(0 0.707 1 0.707))
(amp-env '(0 0.10 1 0.98))
(pan-env '(0 0.0 1.0 90.0 ))
(angulo 0.00) (distancia 1.0)
)
(let* ((inicio (floor (* comienzo (srate))))
(longitud (floor (* dur (srate))))
(ruido (make-rand :frequency (* 0.44 (srate))
:amplitude amp))
(env-frecu (make-env :envelope frecuencias
:duration dur))
(env-rad (make-env :envelope radianes
:duration dur))
(filtro (make-formant :frequency 440
:radius 0.25))
(env-a0 (make-env :envelope amp-env
:duration dur))
(env-a1 (make-env :envelope amp-env
:duration dur))
(izq (make-env :envelope pan-env
:scaler (/ 1.0 90.0)
:duration dur ))
(der (make-env :envelope pan-env
:scaler (/ 1.0 90.0)
:duration dur ))
(loc (make-locsig :channels (channels)
:degree angulo
:distance distancia))
(salida-a (make-vct longitud))
(salida-b (make-vct longitud)))
(vct-map! salida-a
(lambda ()
(let ((rd (env env-rad))
(fr (env env-frecu))
(p-val (env izq)))
(set! (mus-xcoeff filtro 2) (- rd ))
(set! (mus-ycoeff filtro 1)
(b1-de-frec-rad rd fr))
(set! (mus-ycoeff filtro 2) (b2-de-radianes rd))
(locsig-set! loc 0 (- 1.0 p-val))
(* (locsig-ref loc 0) (env env-a0)
(formant filtro (rand ruido))))))
(vct-map! salida-b
(lambda ()
(let ((rd (env env-rad))
(fr (env env-frecu)))
(set! (mus-xcoeff filtro 2) (- rd ))
(set! (mus-ycoeff filtro 1)
(b1-de-frec-rad rd fr))
(set! (mus-ycoeff filtro 2) (b2-de-radianes rd))
(locsig-set! loc 1 (env der))
(* (locsig-ref loc 1) (env env-a1)
(formant filtro (rand ruido))))))
(vct->channel salida-a inicio longitud #f 0)
(vct->channel salida-b inicio longitud #f 1))))
;;; (load "brisa.scm")
;;; (brisa-ex 0 2 0.5)
;;; (brisa-ex 0 5 0.5)
;;; (brisa-ex 0 0.125 0.8)
(define olas
(lambda (num durac)
(let ((inic 0.0))
(do ((i 0 (1+ i)))
((= i num))
(begin
(brisa-ex inic
durac
0.8
:frecuencias '(0 3000 0.5 8000 1 2000)
:amp-env '(0 0.0 0.5 0.98 1 0.0) )
(set! inic (+ inic durac)))))))
;;; (olas 2 5)
;;; (olas 4 10)
(define pingpong
(lambda (num durac)
(let ((inic 0.0))
(do ((i 0 (1+ i)))
((= i num))
(begin
(brisa-ex inic
durac
0.8
:frecuencias '(0 30 1 12000)
:amp-env '(0 0.0 0.5 0.98 1 0.0)
:pan-env '(0 0.0 1.0 90.0 ))
(brisa-ex (+ inic durac)
durac
0.8
:frecuencias '(0 30 1 12000)
:amp-env '(0 0.0 0.5 0.98 1 0.0)
:pan-env '(0 90.0 1.0 0.0))
(set! inic (+ inic (* 2 durac))) ) ))))
;;; (pingpong 1 0.25)
;;; (pingpong 2 0.25)
;;; (pingpong 5 0.65)
;;; (pingpong 12 0.125)
|