Skip to content

Instantly share code, notes, and snippets.

@damionjunk
Created December 20, 2011 05:02
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save damionjunk/1500336 to your computer and use it in GitHub Desktop.
Save damionjunk/1500336 to your computer and use it in GitHub Desktop.
Binaural Beats with Overtone and Clojure
(ns overtone-clj-toys.binaural
(:use [overtone.live]))
;;
;; Binaural Beat Synthesis:
;; Generates binaural beats given the provided carrier and desired
;; frequency. Brown noise is used to soften the background and
;; block out outside noise.
;; freq effect
;; < 4 Delta, Sleep
;; 3 - 7 Theta, relaxation, meditation
;; 7 - 13 Alpha, Relaxation while Awake
;;
(defsynth bbeat [amp 0.3
carrier 440
freq 4.5]
(let [freq-a carrier
freq-b (+ carrier freq)
env (lin-lin (sin-osc:kr (* freq (/ 1 60))) -1.0 1.0 0.5 1.0)
left (+ (* 0.8 (sin-osc freq-a)) (* env (brown-noise)))
right (+ (* 0.8 (sin-osc freq-b)) (* env (brown-noise)))]
(out 0 (* amp left))
(out 1 (* amp right))))
;;(bbeat 0.2 440 3)
;;(stop)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment