Permalink
Browse files

recording works and code restructure

  • Loading branch information...
1 parent f88f634 commit 8464d5fb34404bd48738fb7e4690b9f3815d97e8 Jon Vlachoyiannis committed Mar 9, 2011
View
@@ -4,15 +4,18 @@
(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 [music-as-data.mad]
[music-as-data.elements]
[music-as-data.globals]
+ [music-as-data.record]
+ [music-as-data.semantics]
[music-as-data.signalsnotes]))
-
(defn setup []
"Runs once."
(swap! *minim* (fn [minim] (Minim. *applet*)))
@@ -22,7 +25,8 @@
(new SineWave 440 1 (.sampleRate @*outp*)))))
(defn draw []
- (background-float 124))
+ (background-float 0)
+ (stroke 255))
(defapplet main :title "Music as Data"
:setup setup :draw draw :size [200 200])
@@ -33,13 +37,15 @@
(defn end [applet]
(stop applet))
-;; Create notes and load samples
+
+ ;; Create notes and load samples
;; after system started
(create-notes)
-;;(defsample kick "KickDrums1/kickdrum6.wav")
+(defsample kick "KickDrums1/kickdrum6.wav")
(defsample kick2 "KickDrums4/kickdrum154.wav")
-;;(defsample snare "SnareDrums1/snaredrum2.wav")
+(defsample snare "SnareDrums1/snaredrum2.wav")
(defsample snare2 "DistortedSnares2/distortedsnare52.wav")
(defsample hihat "HiHats1/hihat2.wav")
+(keep-looping)
@@ -8,7 +8,7 @@
(p (pattern [E4 E4 E4 E4 E4],2.5))
;; Drum Demos
-(times 8
+(times 2
(p (pattern [kick (+ hihat snare)],2)))
(times 4
(p (pattern [kick (+ hihat snare) [kick kick] (+ hihat snare)],3)))
@@ -9,5 +9,6 @@
(def *outp* (atom nil))
(def *sine* (atom nil))
(def *pattern* (atom []))
+(def *recorder* (atom []))
@@ -0,0 +1,17 @@
+(ns music-as-data.record
+ (:use [music-as-data.mad]
+ [music-as-data.elements]
+ [music-as-data.globals]))
+
+(defn start-rec [filename]
+ (swap! *recorder* (fn [out] (.createRecorder @*minim* @*outp* (str filename ".wav") true)))
+ (.beginRecord @*recorder*))
+
+(defn stop-rec []
+ (.endRecord @*recorder*)
+ (.save @*recorder*))
+
+
+
+
+
@@ -1,8 +1,14 @@
+(ns music-as-data.semantics
+ (:use [music-as-data.elements]
+ [music-as-data.mfunctions]))
+
+
(defn join [& notes]
- (Melement. 0 0 0 play-chord
+ (music-as-data.elements.Melement. 0 0 0 play-chord
(first (conj [] notes))))
;; Maybe defmulti?
(defmacro + [& more]
;; make chords like (+ kick hihat)
`(join ~@more))
+

0 comments on commit 8464d5f

Please sign in to comment.