Permalink
Browse files

Merge pull request #11 from gthomas/master

Use Quil and Clojure 1.4
  • Loading branch information...
2 parents bfb38bd + 79c3076 commit 7974067f3d77f9ff5fffe2e04d38ab0392f2ea20 @jonromero committed Jul 3, 2012
View
@@ -23,7 +23,7 @@ Each sample is being played at one time.
If you want to play a sample at the same time:
- (play! [kick (+snare hihat)])
+ (play! [kick (chord snare hihat)])
This will play kick at one time and snare+hihat at another.
@@ -78,7 +78,7 @@ and you are ready to start playing!
(p (pattern [A4 A2]))
- (p (pattern [kick snare (+ hihat snare)]))
+ (p (pattern [kick snare (chord hihat snare)]))
You can have it playing on a loop by executing:
(keep-looping)
@@ -102,6 +102,8 @@ In order to play a pause, you can play the _ note:
Designed and developed by Jon Vlachoyiannis (http://jon.is.emotionull.com).
+
+
# Thanks #
@mar_nas (for the incredible site mad.emotionull.com)
View
@@ -1,10 +1,12 @@
(defproject music-as-data "0.6.0"
:description "A Live Programming Language in Clojure using processing"
:url "http://mad.emotionull.com"
- :dependencies [[org.clojure/clojure "1.2.0"]
- [org.clojars.automata/rosado.processing "1.1.0"]
- [org.clojars.automata/ddf.minim "2.1.0"]
- [org.clojars.automata/minim-spi "2.1.0"]]
- :dev-dependencies [[swank-clojure "1.2.0"]]
+ :main music-as-data.core
+ :dependencies [
+ [quil "1.5.0"]
+ [org.clojure/clojure "1.4.0"]
+ [org.clojars.automata/ddf.minim "2.1.0"]
+ [org.clojars.automata/minim-spi "2.1.0"]]
+ :dev-dependencies [[swank-clojure "1.4.0"]]
:jvm-opts ["-Xms256m" "-Xmx1g" "-XX:+UseConcMarkSweepGC" "-server"])
View
@@ -1,24 +1,24 @@
;; Jon Vlachoyiannis 07/03/2011
;; jon@emotionull.com
-
(ns music-as-data.core
(:import [ddf.minim Minim]
[ddf.minim.signals SquareWave]
[ddf.minim AudioInput]
[ddf.minim AudioOutput]
[ddf.minim.signals SineWave])
- (:use [rosado.processing]
- [rosado.processing.applet])
+ (:use [quil.core]
+ [quil.applet]
+ [quil.dynamics])
(:use [music-as-data.mad]
[music-as-data.elements]
[music-as-data.globals]
[music-as-data.record]
- [music-as-data.semantics]
+ [music-as-data.semantics]
[music-as-data.signalsnotes]))
(defn setup []
"Runs once."
- (swap! *minim* (fn [minim] (Minim. *applet*)))
+ (swap! *minim* (fn [minim] (Minim. (current-applet))))
(swap! *outp* (fn [out]
(.getLineOut @*minim*)))
(swap! *sine* (fn [out]
@@ -32,15 +32,15 @@
:setup setup :draw draw :size [200 200])
(defn start [applet]
- (run applet))
+ (applet-start applet))
(defn end [applet]
- (stop applet))
+ (applet-exit applet))
;; Run this AFTER you have started the system
;; using
-(start main)
+;;(start main)
;; Create notes and load samples
;; after system started
@@ -53,7 +53,7 @@
;;(defsample snare2 "DistortedSnares2/distortedsnare52.wav")
(defsample hihat "HiHats1/hihat2.wav")
-(p (pattern [A4]))
+;(p (pattern [A4]))
;;(play! [A4 B4])
;;(keep-looping)
@@ -9,8 +9,8 @@
;; Drum Demos
(times 2
- (p (pattern [kick (+ hihat snare)],2)))
+ (p (pattern [kick (chord hihat snare)],2)))
(times 4
- (p (pattern [kick (+ hihat snare) [kick kick] (+ hihat snare)],3)))
+ (p (pattern [kick (chord hihat snare) [kick kick] (chord hihat snare)],3)))
(times 4
- (p (pattern [kick (+ hihat snare) [kick kick kick kick] kick kick kick kick (+ hihat snare)],3)))
+ (p (pattern [kick (chord hihat snare) [kick kick kick kick] kick kick kick kick (chord hihat snare)],3)))
@@ -1,14 +1,13 @@
(ns music-as-data.globals)
-(def *samples-path* "samples/")
+(def ^:dynamic *samples-path* "samples/")
(defn get-samples-path []
*samples-path*)
-(def *minim* (atom nil))
-(def *outp* (atom nil))
-(def *sine* (atom nil))
-(def *pattern* (atom []))
-(def *recorder* (atom []))
-
+(def ^:dynamic *minim* (atom nil))
+(def ^:dynamic *outp* (atom nil))
+(def ^:dynamic *sine* (atom nil))
+(def ^:dynamic *pattern* (atom []))
+(def ^:dynamic *recorder* (atom []))
@@ -6,8 +6,8 @@
(:import (processing.core PApplet PImage PGraphics PFont))
(:use [music-as-data.globals]
[music-as-data.mfunctions])
- (:use [rosado.processing]
- [rosado.processing.applet]))
+ (:use [quil.core]
+ [quil.applet]))
(defn p
@@ -28,7 +28,6 @@
(calc-duration m-element duration (count m-element)))
(assoc m-element :duration duration))))
-
(defn calc-duration [elements duration count]
(map #(pattern % (/ duration count))
elements))
@@ -1,14 +1,15 @@
(ns music-as-data.semantics
- (:use [music-as-data.elements]
- [music-as-data.mfunctions]))
-
+ (:use
+ [music-as-data.elements]
+ [music-as-data.mfunctions])
+ (:import [music_as_data.elements Melement]))
(defn join [& notes]
- (music-as-data.elements.Melement. 0 0 0 play-chord
+ (Melement. 0 0 0 play-chord
(first (conj [] notes))))
;; Maybe defmulti?
-(defmacro + [& more]
- ;; make chords like (+ kick hihat)
- `(join ~@more))
+(defmacro chord [& more]
+;; make chords like (chord kick hihat)
+ `(join ~@more))
@@ -1,8 +1,7 @@
(ns music-as-data.signalsnotes
(:use [music-as-data.signals]
- [music-as-data.globals]))
-
-(defrecord Melement [volume pitch duration play-fn data])
+ [music-as-data.globals])
+ (:import [music_as_data.elements Melement]))
(defn create-notes []
;; FIXME - macro here!

0 comments on commit 7974067

Please sign in to comment.