Skip to content

Instantly share code, notes, and snippets.

@lygaret
Created October 8, 2015 07:15
Show Gist options
  • Save lygaret/f633cefef15eb2654fbb to your computer and use it in GitHub Desktop.
Save lygaret/f633cefef15eb2654fbb to your computer and use it in GitHub Desktop.
;; https://soundcloud.com/jonathan-raphaelson/overtone-experiment-1
(ns overtonetute.core
[:use [overtone.live]])
(use 'overtone.inst.drum)
(definst swave [freq 440 attack 0.001 sustain 0.4 release 0.1 vol 0.005]
(lpf (* (env-gen (env-lin attack sustain release) 1 1 0 1)
(sin-osc freq)
vol)))
(defn snote [n]
(swave :freq (midi->hz (note n)) :sustain 2.0))
(defn play-chord [a-chord]
(doseq [note a-chord] (snote note)))
(defn chord-progression-beat [m b]
(let [time (now)]
(at (m (+ 0 b)) (play-chord (chord :c4 :major)))
(at (m (+ 4 b)) (play-chord (chord :g3 :major)))
(at (m (+ 8 b)) (play-chord (chord :a3 :minor)))
(at (m (+ 14 b)) (play-chord (chord :f3 :major)))
(apply-at (m (+ 16 b)) chord-progression-beat m (+ 16 b) [])))
(defn drumline [m b]
(at (m (+ 0 b)) (open-hat))
(at (m (+ 1.1 b)) (kick)
(at (m (+ 2 b)) (closed-hat))
(at (m (+ 3 b)) (open-hat))
(at (m (+ 3.5 b)) (kick))
(at (m (+ 5 b)) (open-hat))
(at (m (+ 5.5 b)) (kick))
(at (m (+ 7 b)) (open-hat))
(at (m (+ 7.5 b)) (kick))
(apply-at (m (+ 8 b)) drumline m (+ 8 b) [])))
(defonce metro (metronome 160))
(defn song []
(chord-progression-beat metro (metro))
(drumline metro (metro)))
;;(recording-start "~/song.wav")
;;(song)
;;(recording-stop)
;;(stop)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment