Skip to content

Instantly share code, notes, and snippets.

View mattearnshaw's full-sized avatar

Matt Earnshaw mattearnshaw

View GitHub Profile
(ns music.so-empty-forms
(:use [overtone.live]))
(declare fade-envelope)
(declare line-osc)
; Six Empty Forms (for Agnes Martin) – Mark So (2006)
(definst I []
(let [t (* 22 60)]
@mattearnshaw
mattearnshaw / viz.pde
Last active July 9, 2016 14:14
schizviz
import ddf.minim.*;
import ddf.minim.analysis.*;
import ddf.minim.spi.*;
import ddf.minim.ugens.*;
Minim minim;
AudioOutput output;
MultiChannelBuffer buf;
AudioRecordingStream stream;
FilePlayer player;
@mattearnshaw
mattearnshaw / gist:ba3928a256d55341e288
Created July 20, 2015 12:49
kraehenbuehl harmonizing algorithm
(ns kraehenbuehl.core
(:require [leipzig.scale :as scale]
[leipzig.chord :refer [root triad inversion]]
[overtone.music.pitch :refer [find-note-name]]))
;eg. (kraehenbuehl (comp scale/G scale/major) [62 64 62 60 59])
;=> ((43 55 59 62) (52 55 59 64) (47 54 59 62) (38 54 57 60) (43 50 55 59))
(declare pitch-class)
(declare triad-with-top)
(def scaffold (load-sample "scaffold.flac"))
(def park (load-sample "hyde-park.flac"))
(def valetta (load-sample "valettasnip.flac"))
(def buf1 (buffer 2048))
(def buf2 (buffer 2048))
(definst spectralblend [buf-a 0 buf-b 1 hold-time 60 x-over-time 10]
(let [amp1 2.5
amp2 1.4540 ; magic numbers for amplitude correction
@mattearnshaw
mattearnshaw / gist:6f1525d580e7fc966fac
Last active August 29, 2015 14:14
Parkinson Cuts
/* Contributions from B0s→φµ+µ−decays
Candidates are rejected if
- 5321<mK(π→K)µµ<5411MeV/c2 and either:
- 1010<mK(π→K)<1030MeV/c2 and the pion satisfies DLLKπ>−10;
- or 1030<mK(π→K)<1075MeV/c2 and the pion satisfies DLLKπ>10. */
RooFormulaVar B0stoPhimm("B0stoPhimm", "!((5321<@0<5411) && "
"((1010<@1<1030 && @2>-10) ||"
"(1030<@1<1075 && PI_PIDK>10)))",
RooArgList(B0_MM, B0_kpiswapMass, Pi_PIDK));
extract () {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) rar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;