Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. ;;; NREV (the most popular Samson box reverb)
  2. (provide 'snd-nrev.scm)
  3. (if (provided? 'snd)
  4. (require snd-ws.scm)
  5. (require sndlib-ws.scm))
  6. (definstrument (nrev (reverb-factor 1.09) (lp-coeff 0.7) (volume 1.0))
  7. ;; reverb-factor controls the length of the decay -- it should not exceed (/ 1.0 .823)
  8. ;; lp-coeff controls the strength of the low pass filter inserted in the feedback loop
  9. ;; output-scale can be used to boost the reverb output
  10. (let ((dly-len (if (= (floor *clm-srate*) 44100)
  11. #(2467 2753 3217 3533 3877 4127 599 197 67 101 97 73 67 53 37)
  12. (and (= (floor *clm-srate*) 22050)
  13. #(1237 1381 1607 1777 1949 2063 307 97 31 53 47 37 31 29 17))))
  14. (chan2 (> (channels *output*) 1))
  15. (chan4 (= (channels *output*) 4)))
  16. (if (not dly-len)
  17. (let ((srscale (/ *clm-srate* 25641)))
  18. (define (next-prime val)
  19. (if (or (= val 2)
  20. (and (odd? val)
  21. (do ((i 3 (+ i 2))
  22. (lim (sqrt val)))
  23. ((or (= 0 (modulo val i)) (> i lim)) (> i lim)))))
  24. val
  25. (next-prime (+ val 2))))
  26. (set! dly-len #(1433 1601 1867 2053 2251 2399 347 113 37 59 53 43 37 29 19))
  27. (do ((i 0 (+ i 1)))
  28. ((= i 15))
  29. (let ((val (floor (* srscale (dly-len i)))))
  30. (if (even? val) (set! val (+ val 1)))
  31. (set! (dly-len i) (next-prime val))))))
  32. (let ((len (+ (floor *clm-srate*) (framples *reverb*)))
  33. (comb1 (make-comb (* .822 reverb-factor) (dly-len 0)))
  34. (comb2 (make-comb (* .802 reverb-factor) (dly-len 1)))
  35. (comb3 (make-comb (* .773 reverb-factor) (dly-len 2)))
  36. (comb4 (make-comb (* .753 reverb-factor) (dly-len 3)))
  37. (comb5 (make-comb (* .753 reverb-factor) (dly-len 4)))
  38. (comb6 (make-comb (* .733 reverb-factor) (dly-len 5)))
  39. (low (make-one-pole lp-coeff (- lp-coeff 1.0)))
  40. (allpass1 (make-all-pass -0.700 0.700 (dly-len 6)))
  41. (allpass2 (make-all-pass -0.700 0.700 (dly-len 7)))
  42. (allpass3 (make-all-pass -0.700 0.700 (dly-len 8)))
  43. (allpass4 (make-all-pass -0.700 0.700 (dly-len 9))) ; 10 for quad
  44. (allpass5 (make-all-pass -0.700 0.700 (dly-len 11)))
  45. (allpass6 (and chan2 (make-all-pass -0.700 0.700 (dly-len 12))))
  46. (allpass7 (and chan4 (make-all-pass -0.700 0.700 (dly-len 13))))
  47. (allpass8 (and chan4 (make-all-pass -0.700 0.700 (dly-len 14)))))
  48. (let ((filts (if (not chan2)
  49. (vector allpass5)
  50. (if (not chan4)
  51. (vector allpass5 allpass6)
  52. (vector allpass5 allpass6 allpass7 allpass8))))
  53. (combs (make-comb-bank (vector comb1 comb2 comb3 comb4 comb5 comb6)))
  54. (allpasses (make-all-pass-bank (vector allpass1 allpass2 allpass3))))
  55. (do ((i 0 (+ i 1)))
  56. ((= i len))
  57. (out-bank filts i
  58. (all-pass allpass4
  59. (one-pole low
  60. (all-pass-bank allpasses
  61. (comb-bank combs (* volume (ina i *reverb*))))))))))))
  62. ;;; (with-sound (:reverb nrev) (outa 0 .1) (outa 0 .5 *reverb*))