Created
May 28, 2012 16:28
-
-
Save devn/2819981 to your computer and use it in GitHub Desktop.
Dan Reeder - Two Songs That I know
This file contains hidden or 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
| (ns two-songs.core | |
| (:use [overtone.live] | |
| [overtone.inst.sampled-piano]) | |
| (:require [overtone.music.pitch :as pitch])) | |
| (def metro (metronome 120)) | |
| (def chord-seq [(pitch/chord :e4 :major) | |
| (pitch/chord :c#4 :minor7) | |
| (pitch/chord :f#4 :minor7) | |
| (pitch/chord :b4 :major)]) | |
| (def bass-line [40 49 42 47]) | |
| (def song (interleave bass-line chord-seq)) | |
| (defn play-song [t dur notes] | |
| (if (seq? (first notes)) | |
| (at t (doseq [note (first notes)] | |
| (sampled-piano note))) | |
| (at t (sampled-piano (first notes)))) | |
| (apply-at (+ t dur) #'play-song (+ t dur) dur (next notes) [])) | |
| ;; (play-song (now) 1200 (cycle song)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment