Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

46 lines
2.0KB

  1. (provide 'snd-jcrev.scm)
  2. (if (provided? 'snd)
  3. (require snd-ws.scm)
  4. (require sndlib-ws.scm))
  5. (definstrument (jc-reverb low-pass (volume 1.0) amp-env)
  6. "(jc-reverb (low-pass #f) (volume 1.0) (amp-env #f)) -- Chowning reverb"
  7. (let ((allpass1 (make-all-pass -0.700 0.700 1051))
  8. (allpass2 (make-all-pass -0.700 0.700 337))
  9. (allpass3 (make-all-pass -0.700 0.700 113))
  10. (comb1 (make-comb 0.742 4799))
  11. (comb2 (make-comb 0.733 4999))
  12. (comb3 (make-comb 0.715 5399))
  13. (comb4 (make-comb 0.697 5801))
  14. (chns (channels *output*))
  15. (file-dur (framples *reverb*)))
  16. (let ((len (floor (+ *clm-srate* file-dur)))
  17. (filts (if (= chns 1)
  18. (vector (make-delay (seconds->samples .013)))
  19. (vector (make-delay (seconds->samples .013))
  20. (make-delay (seconds->samples .011)))))
  21. (combs (make-comb-bank (vector comb1 comb2 comb3 comb4)))
  22. (allpasses (make-all-pass-bank (vector allpass1 allpass2 allpass3))))
  23. (if (or amp-env low-pass)
  24. (let ((flt (and low-pass (make-fir-filter 3 (float-vector 0.25 0.5 0.25))))
  25. (envA (make-env :envelope (or amp-env '(0 1 1 1)) :scaler volume :duration (/ len *clm-srate*))))
  26. (if low-pass
  27. (do ((i 0 (+ i 1)))
  28. ((= i len))
  29. (out-bank filts i (* (env envA) (fir-filter flt (comb-bank combs (all-pass-bank allpasses (ina i *reverb*)))))))
  30. (do ((i 0 (+ i 1)))
  31. ((= i len))
  32. (out-bank filts i (* (env envA) (comb-bank combs (all-pass-bank allpasses (ina i *reverb*))))))))
  33. (do ((i 0 (+ i 1)))
  34. ((= i len))
  35. (out-bank filts i (* volume (comb-bank combs (all-pass-bank allpasses (ina i *reverb*))))))))))
  36. ;;; (with-sound (:reverb jc-reverb) (fm-violin 0 .1 440 .1 :reverb-amount .3))
  37. ;;; (with-sound (:reverb jc-reverb) (outa 0 .1) (outa 0 .5 *reverb*))
  38. ;;; (with-sound (:reverb jc-reverb :reverb-data '((:low-pass #t))) (outa 0 .1) (outa 0 .5 *reverb*))
  39. ;;; (with-sound (:statistics #t :reverb jc-reverb :reverb-data '((:low-pass #t))) (outa 0 .1) (outa 100000 .1) (outa 0 .5 *reverb*) (outa 100000 .5 *reverb*))