Created
November 6, 2012 00:12
-
-
Save jbclements/4021330 to your computer and use it in GitHub Desktop.
Code from class, 2012-11-05
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require (planet clements/rsound:4:3)) | |
(require (planet clements/rsound:4:3/filter)) | |
(define SONG (rs-read "/tmp/bette-davis-eyes.wav")) | |
(define (looper sound) | |
(local [(define len (rs-frames sound))] | |
(network () | |
[ctr ((loop-ctr len 1))] | |
[out (/ (+ (rs-ith/left sound ctr) | |
(rs-ith/right sound ctr)) | |
2)]))) | |
#|Recurrence relation: | |
y[n] = ( 1 * x[n- 4]) | |
+ ( 4 * x[n- 3]) | |
+ ( 6 * x[n- 2]) | |
+ ( 4 * x[n- 1]) | |
+ ( 1 * x[n- 0]) | |
+ ( -0.9217826364 * y[n- 4]) | |
+ ( 3.7553687929 * y[n- 3]) | |
+ ( -5.7449584093 * y[n- 2]) | |
+ ( 3.9113581121 * y[n- 1]) | |
gain at dc : mag = 1.131484017e+06 phase = 0.0000000000 pi | |
|# | |
(signal-play | |
(network () | |
[sound ((looper SONG))] | |
;[t1 ((tap 1 0.0) sound)] | |
;[t2 ((tap 2 0.0) sound)] | |
;[t3 ((tap 3 0.0) sound)] | |
;[t4 ((tap 4 0.0) sound)] | |
;[b1 (prev out 0.0)] | |
;[b2 ((tap 1 0.0) (prev out 0.0))] | |
;[b3 ((tap 2 0.0) (prev out 0.0))] | |
;[b4 ((tap 3 0.0) (prev out 0.0))] | |
;[out (+ sound | |
; (* 4 t1) | |
; (* 6 t2) | |
; (* 4 t3) | |
; t4 | |
; (* 3.9113581121 b1) | |
; (* -5.7449584093 b2) | |
; (* 3.7553687929 b3) | |
; (* -0.9217826364 b4))] | |
;[quieter (* 0.000001 out)] | |
#;[fc (sine-wave 0.3)] | |
[out (lpf/dynamic 0.4 sound)] | |
[out2 (- sound out)] | |
)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment