Created
July 21, 2012 17:45
-
-
Save ctford/3156530 to your computer and use it in GitHub Desktop.
Phantom fundamental
This file contains 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
(definst bell [frequency 300 duration 20.0 h0 1.0 h1 0.5 h2 0.4 h3 0.25 h4 0.20 h5 0.125] | |
(let [harmonic-decay [h0 h1 h2 h3 h4 h5] | |
proportional-partial | |
(fn [harmonic proportion] | |
(let [envelope (env-gen (perc 0.01 (* duration proportion))) | |
overtone (* (inc harmonic) frequency)] | |
(* envelope proportion (sin-osc overtone)))) | |
partials (map-indexed proportional-partial harmonic-decay) | |
whole (mix partials)] | |
(detect-silence whole :action FREE) | |
whole)) | |
;(bell 300 20.0) | |
;(bell 300 20.0 0.0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment