Skip to content

Instantly share code, notes, and snippets.

@samaaron
Last active December 26, 2019 20:29
Show Gist options
  • Star 12 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save samaaron/997ba2902af1cf81a26f to your computer and use it in GitHub Desktop.
Save samaaron/997ba2902af1cf81a26f to your computer and use it in GitHub Desktop.
Steve Reich's Piano Phase - Sonic Pi vs Overtone
(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)
# 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