Skip to content

Instantly share code, notes, and snippets.

@ctford
Created July 21, 2012 17:45
Show Gist options
  • Save ctford/3156530 to your computer and use it in GitHub Desktop.
Save ctford/3156530 to your computer and use it in GitHub Desktop.
Phantom fundamental
(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