Skip to content

Commit

Permalink
Remove trailing parens (except on melody/chord definitions).
Browse files Browse the repository at this point in the history
  • Loading branch information
ctford committed Jan 7, 2012
1 parent 9eaf0e4 commit 809b56f
Showing 1 changed file with 13 additions and 28 deletions.
41 changes: 13 additions & 28 deletions src/overtunes/songs/before.clj
@@ -1,7 +1,6 @@
(ns overtunes.songs.before
(:use [overtone.live])
(:use [overtunes.instruments.organ-cornet])
)
(:use [overtunes.instruments.organ-cornet]))

(def melody
[:C3 :Bb3 :Eb3 :G3 :Eb3]
Expand Down Expand Up @@ -58,54 +57,40 @@
(defn play-note [tone instrument duration]
(let [
seconds (/ duration 1000)
frequency (midi->hz (note tone))
]
(instrument frequency seconds)
)
)
frequency (midi->hz (note tone))]
(instrument frequency seconds)))

(defn play-chord [tones instrument duration]
(if (not (empty? tones))
(let [
root (first tones)
bass [(- root 12) (- root 24)]
with-bass (concat bass tones)
]
(mix (map (fn [tone] (play-note tone instrument duration)) with-bass))
)
)
)
with-bass (concat bass tones)]
(mix (map (fn [tone] (play-note tone instrument duration)) with-bass)))))

(defn play-progression [progression metro start]
(let [
beats-per-chord 4
duration (* beats-per-chord (beat-length metro))
]
duration (* beats-per-chord (beat-length metro))]
(if (not (empty? progression)) ( do
(at (metro start) (play-chord (first progression) organ-cornet duration))
(play-progression (rest progression) metro (+ start beats-per-chord))
))
)
)
(play-progression (rest progression) metro (+ start beats-per-chord))))))

(defn play-melody [melody metro start]
(let [
beats-per-note 2
duration (* beats-per-note (beat-length metro))
]
duration (* beats-per-note (beat-length metro))]
(if (not (empty? melody)) ( do
(at (metro start) (play-note (first melody) organ-cornet duration))
(play-melody (rest melody) metro (+ start beats-per-note))
))
)
)
(play-melody (rest melody) metro (+ start beats-per-note))))))

(defn n-times [n items] (flatten (repeat n items)))

(defn play [chords metro] ( do
(play-melody (n-times (/ (count chords) 2.5) melody) metro (metro))
(play-progression (concat chords finish) metro (metro))
))
(play-progression (concat chords finish) metro (metro))))

(defn full-version []
(play (concat start middle start middle variation) (metronome 60)))

(defn full-version [] (play (concat start middle start middle variation) (metronome 60)))
(defn short-version [] (play variation (metronome 200)))

0 comments on commit 809b56f

Please sign in to comment.