Skip to content

Instantly share code, notes, and snippets.

View samaaron's full-sized avatar

Sam Aaron samaaron

View GitHub Profile
@samaaron
samaaron / core.clj
Created December 11, 2011 00:04 — forked from deltam/core.clj
Overtone jingle bells
(ns overtone-chrismas.core
(:use [overtone.live]))
(definst beep [freq 440]
(let [env (env-gen (perc 0.1 0.2) :action FREE)]
(* env (sin-osc freq))))
; ドレミの周波数を定義
(def doremi {:none 0
:do :c3
@samaaron
samaaron / tarai.clj
Created December 2, 2011 13:55 — forked from kawabata/tarai.clj
tarai mawashi in overtone
(ns tarai.core
(:use [overtone.live]))
;; basic.clj より
(defsynth foo [freq 200 dur 0.5]
(let [src (saw [freq (* freq 1.01) (* 0.99 freq)])
low (sin-osc (/ freq 2))
filt (lpf src (line:kr (* 10 freq) freq 10))
env (env-gen (perc 0.1 dur) :action FREE)]
(out 0 (pan2 (* 0.1 low env filt)))))
@samaaron
samaaron / gist:1398198
Created November 27, 2011 21:41
Clojure mk-tmp-dir!
(defn mk-tmp-dir!
"Creates a unique temporary directory on the filesystem. Typically in /tmp on
*NIX systems. Returns a File object pointing to the new directory. Raises an
exception if the directory couldn't be created after 10000 tries."
[]
(let [base-dir (file (System/getProperty "java.io.tmpdir"))
base-name (str (System/currentTimeMillis) "-" (long (rand 1000000000)) "-")
tmp-base (mk-path base-dir base-name)
max-attempts 10000]
(loop [num-attempts 1]
@samaaron
samaaron / gist:1377020
Created November 18, 2011 16:52
Mostly Lazy Satie Bumper
(ns examples.satie
(:use [clojure.core.match :only [match]]
[overtone.live]
[overtone.inst sampled-piano])
(:require [polynome.core :as poly]))
;;Erik Satie Gnossienne No. 1
(def phrase1a [:iii :v :iv# :iii :iii :ii# :iii :ii#])
(def phrase1b [:iii :v :iv# :iii :v# :vi :v# :vi])
(def phrase1c [:iii :v :iv# :iii :iii :ii# :i :vii- :vi- :vii- :vi- :vii- :i :vii- :vii- :vi-])
@samaaron
samaaron / gist:1377018
Created November 18, 2011 16:52
mostly lazy dubstep bumper
(ns mostly.lazy.dubstep
(:use [overtone.live]
[overtone.helpers.file]
[clojure.core.match :only [match]]
[polynome.core :as poly]))
;;Ian Hall's drum pack: http://www.freesound.org/people/ianhall/packs/691/
(def drum-path "~/Desktop/samples/drums")
(def hhat-path (mk-path [drum-path "13246__ianhall__hihat-closed.aif"]))
(def snar-path (mk-path [drum-path "13253__ianhall__snare.aif"]))
@samaaron
samaaron / gist:1373905
Created November 17, 2011 17:55
Overtone: audiocat - concatting two audio files
(ns audiocat
(:use [overtone.live]
[overtone.helpers.audio-file]))
(def samp1 (load-sample "assets/GEM4_1.aif"))
(def samp2 (load-sample "assets/GEM4_10.aif"))
(def s1-data (buffer-data samp1))
(def s2-data (buffer-data samp2))
@samaaron
samaaron / gist:1319995
Created October 27, 2011 16:05
Orchestra: initial codebase
;; This buffer is for notes you don't want to save, and for Lisp evaluation.
;; If you want to create a file, visit that file with C-x C-f,
;; then enter the text in that file's own buffer.
(ns overtone.studio.sequencer
(:use [overtone.live]))
(defn- long?
[val]
(when (= Long (type val))
@samaaron
samaaron / gist:1310599
Created October 24, 2011 22:46
Improcess Video Credits (for the Computer Music Journal)
.-.`
+hhhhh+`
+hhysyhhs
hs. -sh/
:` `yh.
+ho
`sh:
/hs
.hhh:
/yhhhy/
@samaaron
samaaron / gist:1309367
Created October 24, 2011 15:56
Simple coordinated ping mechanism - only plays the ping if two buttons are pressed at the "same" time
(ns examples.coordination
(:use [overtone.live]
[overtone.inst.synth])
(:require [polynome.core :as poly]))
;;ping
(def m (poly/init "/dev/tty.usbserial-m64-0790"))
(poly/on-press m (fn [x y s]
@samaaron
samaaron / gist:1298602
Created October 19, 2011 15:19
Overtone ascii-art welcome
_____ __
/ __ /_ _____ _____/ /_____ ____ ___
/ / / / | / / _ \/ ___/ __/ __ \/ __ \/ _ \
/ /_/ /| |/ / __/ / / /_/ /_/ / / / / __/
\____/ |___/\___/_/ \__/\____/_/ /_/\___/
Programmable Music.