Last active
December 26, 2019 20:29
-
-
Save samaaron/997ba2902af1cf81a26f to your computer and use it in GitHub Desktop.
Steve Reich's Piano Phase - Sonic Pi vs Overtone
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 overtone.examples.compositions.piano-phase | |
(:use overtone.live | |
overtone.inst.sampled-piano)) | |
;; Steve Reich's Piano Phase | |
(def piece [:E4 :F#4 :B4 :C#5 :D5 :F#4 :E4 :C#5 :B4 :F#4 :D5 :C#5]) | |
(defn player | |
[t speed notes] | |
(let [n (first notes) | |
notes (next notes) | |
t-next (+ t speed)] | |
(when n | |
(at t | |
(sampled-piano (note n))) | |
(apply-by t-next #'player [t-next speed notes])))) | |
(def num-notes 1000) | |
(do | |
(player (now) 338 (take num-notes (cycle piece))) | |
(player (now) 335 (take num-notes (cycle piece)))) | |
;;(stop) |
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
# Steve Reich's Piano Phase | |
# Requires Sonic Pi v2.6 | |
notes = (ring :E4, :Fs4, :B4, :Cs5, :D5, :Fs4, :E4, :Cs5, :B4, :Fs4, :D5, :Cs5) | |
live_loop :slow do | |
play notes.tick, release: 0.1 | |
sleep 0.3 | |
end | |
live_loop :faster do | |
play notes.tick, release: 0.1 | |
sleep 0.295 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment