Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update jam because the sampled piano is broken.
- Loading branch information
Showing
1 changed file
with
25 additions
and
36 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,31 @@ | ||
(ns jazz.standards.in-the-mood | ||
(:use leipzig.scale, leipzig.melody, leipzig.live, leipzig.chord | ||
overtone.inst.sampled-piano | ||
[overtone.live :only [at ctl sample freesound-path]])) | ||
|
||
(defn in-time | ||
"Transform both :time and :duration according to timing." | ||
[timing notes] | ||
(->> notes | ||
(map (fn [{start :time, duration :duration, :as note}] | ||
(-> note | ||
(assoc :duration (- (timing (+ start duration)) | ||
(timing start)))))) | ||
(where :time timing))) | ||
|
||
(defn mapthen [f & args] | ||
(->> args | ||
(apply map f) | ||
(reduce #(then %2 %1)))) | ||
|
||
(defmethod play-note :beat | ||
[note] | ||
((sample (freesound-path 802)))) | ||
|
||
(defmethod play-note :default | ||
[{midi :pitch, start :time, duration :duration}] | ||
(let [id (sampled-piano midi)] | ||
(at (+ start duration) (ctl id :gate 0)))) | ||
(ns jazz.standards.in-the-mood | ||
(:use leipzig.scale, leipzig.melody, leipzig.live, leipzig.chord, leipzig.temperament | ||
[overtone.live :only [FREE adsr line:kr sin-osc definst hpf lpf clip2 env-gen]])) | ||
|
||
(def in-the-mood | ||
(let [bassline [] | ||
hook [] | ||
beat (->> [] (where :part (is :beat)))] | ||
(let [bassline [] | ||
hook []] | ||
(->> | ||
bassline | ||
(with hook) | ||
(where :pitch (comp low B flat major)) | ||
(with beat) | ||
(in-time (bpm 90))))) | ||
bassline | ||
(with hook) | ||
(where :pitch (comp equal low B flat major)) | ||
(tempo (bpm 90))))) | ||
|
||
(comment (jam (var in-the-mood))) | ||
(comment (def in-the-mood nil)) | ||
|
||
(defmethod play-note :default | ||
[{midi :pitch seconds :duration}] | ||
(-> midi (overchauffeur seconds 1500))) | ||
|
||
(definst overchauffeur [freq 110 dur 1.0 top 1500 vol 0.25] | ||
(-> (sin-osc freq) | ||
(+ (* 1/3 (sin-osc (* 2.01 freq)))) | ||
(+ (* 1/2 (sin-osc (* 3.01 freq)))) | ||
(+ (* 1/8 (sin-osc (* 5.01 freq)))) | ||
(+ (* 2 (sin-osc (* 0.5 freq)))) | ||
(clip2 0.7) | ||
(lpf top) | ||
(hpf 20) | ||
(* (env-gen (adsr 0.01 0.2 0.8 0.2) (line:kr 1 0 dur) :action FREE)) | ||
(* vol))) |