Created
November 3, 2013 20:14
-
-
Save rglass/7294296 to your computer and use it in GitHub Desktop.
My first Overtone piece: the most simplistic 12-tone variant.
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
(ns overtrial | |
(:use [overtone.live] | |
[overtone.inst.piano] | |
[overtone.inst.sampled-piano])) | |
(defonce metro (metronome 120)) | |
(defn play-12-loop | |
[m beat-num tone-row tone-buf] | |
(if (empty? tone-buf) | |
(play-12-loop m beat-num tone-row tone-row) | |
(do | |
(at (m (+ 0.25 beat-num)) (sampled-piano (note (first tone-buf)))) | |
(apply-at (m (+ 0.25 beat-num)) | |
play-12-loop | |
m | |
(+ 0.25 beat-num) | |
tone-row | |
(rest tone-buf) | |
[])))) | |
(defn play-12-tone | |
([m beat-num] | |
(play-12-tone m beat-num [:C4 :C#4 :D4 :D#4 :E4 :F4 :F#4 :G4 :G#4 :A4 | |
:A#4 :B4] [])) | |
([m beat-num genesis-row tone-row] | |
(if (empty? genesis-row) | |
(apply-at (m (+ 0.25 beat-num)) | |
play-12-loop | |
m | |
(+ 0.25 beat-num) | |
tone-row | |
[] | |
[]) | |
(let [current-note (choose genesis-row)] | |
(at (m (+ 0.25 beat-num)) (sampled-piano (note current-note))) | |
(apply-at (m (+ 0.25 beat-num)) | |
play-12-tone | |
m | |
(+ 0.25 beat-num) | |
(remove (fn [a-note] (= a-note current-note)) genesis-row) | |
(conj tone-row current-note) []))))) | |
(play-12-tone metro (metro)) | |
(stop) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment