Last active
August 29, 2015 14:05
-
-
Save CircuV/438be788bf453113f7f0 to your computer and use it in GitHub Desktop.
Transscript of live performance in extempore from Andrew Sorensen at OSCON 2014 Keynote: "The Concert Programmer"
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
;;; as_oscon_2.xtm -- live performance | |
;; by Andrew Sorensen OSCON 2014 Keynote: "The Concert Programmer" | |
;; Author: cv | |
;; Keywords: extempore | |
;;; Commentary: | |
;;; Code: | |
;; First, load the library where the sampler infrastructure is | |
;; located. Have a look at this file in your editor to see how the | |
;; sampler works. | |
;; load library | |
(sys:load "libs/external/instruments_ext.xtm") | |
;; Now define the sampler instrument and DSP callback function (in | |
;; this case, it just calls the sampler closure) | |
(define-sampler sampler sampler_note_hermite_c sampler_fx) | |
(define-sampler sampler2 sampler_note_hermite_c sampler_fx) | |
(define-instrument fmsynth fmsynth_note_c fmsynth_fx) | |
;; synth part | |
(bind-func dsp:DSP | |
(lambda (in time chan dat) | |
(cond ((< chan 2.0) | |
(+ (sampler in time chan dat) | |
(sampler2 in time chan dat) | |
(fmsynth in time chan dat))) | |
(else 0.0)))) | |
(dsp:set! dsp) | |
;; requires pc_ivl-lib | |
(sys:load "libs/core/pc_ivl.xtm") | |
;; finally, let's load up a piano. There are some piano samples in | |
;; assets/samples/piano which are named according to the midi pitch | |
;; number they represent (so we'll want to use parse-sample-names-1) | |
;; load piano samples | |
(load-sampler sampler "assets/samples/piano" 0 parse-sample-names-1) | |
;; load drum samples | |
(load-sampler sampler2 "assets/samples/808" 0 parse-sample-names-1) | |
;; Performance adapted from Andrew Sorensen OSCON 2014 Keynote: "The Concert Programmer" | |
;; https://www.youtube.com/watch?v=yY1FSsUV-8c | |
;; snippet | |
;;(define name | |
;; (lambda (beat ps ds) | |
;; (play inst (car ps) volume (car ds)) | |
;; (callback (*metro* (+ beat (* 0.5 ( car ds)))) 'name (+ beat (car ds)) | |
;; (rotate ps -1) | |
;; (rotate ds -1)))) | |
;; | |
;;(name (*metro* 'get-beat 4) pitches durations) | |
;; | |
;; end snippet | |
;; performance starts here | |
;; start tune | |
(define left-hand | |
(lambda (beat ps ds) | |
(play sampler (car ps) 80 (car ds) ) | |
(callback (*metro* (+ beat (* 0.5 ( car ds)))) 'left-hand (+ beat (car ds)) | |
(rotate ps -1) | |
(rotate ds -1)))) | |
(left-hand (*metro* 'get-beat 4) (list 55 55 57 59) (list 1)) | |
;; add root and modify tune | |
(define root 52) | |
(define left-hand | |
(lambda (beat ps ds) | |
(play sampler (car ps) 80 (car ds)) | |
(play 1/2 sampler root 80 (car ds)) | |
(callback (*metro* (+ beat (* 0.5 ( car ds)))) 'left-hand (+ beat (car ds)) | |
(rotate ps -1) | |
(rotate ds -1)))) | |
;; add harmonic progression | |
(define left-hand | |
(lambda (beat ps ds) | |
(if (= 0 (modulo beat 8)) | |
(set! root (random (remove root (list 52 50 48))))) | |
(play sampler (car ps) 80 (car ds)) | |
(play 1/2 sampler root 80 (car ds)) | |
(callback (*metro* (+ beat (* 0.5 ( car ds)))) 'left-hand (+ beat (car ds)) | |
(rotate ps -1) | |
(rotate ds -1)))) | |
;; add right hand | |
(define scale (pc:scale 4 'aeolian)) | |
(define right-hand | |
(lambda (beat dur) | |
(play sampler | |
(pc:quantize (cosr (+ root 24) (cosr 5 3 1/2) 7/3) scale) | |
(cosr 80 20 7/3) | |
(* 2.0 dur)) | |
(callback (*metro* (+ beat (* 0.5 dur))) 'right-hand (+ beat dur) dur))) | |
(right-hand (*metro* 'get-beat 4) 1/4) | |
;; add base line | |
(define bassline | |
(lambda (beat ps ds) | |
(play fmsynth root 80 (* (car ps) (car ds)) 1.0 0.5) | |
(callback (*metro* (+ beat (* 0.5 ( car ds)))) 'bassline (+ beat (car ds)) | |
(rotate ps -1) | |
(rotate ds -1)))) | |
(bassline (*metro* 'get-beat 4) (list .25 .25 .6) '(3/2 1 3/2)) | |
;; modified right-hand with sparkling fmsynth | |
(define right-hand | |
(lambda (beat dur) | |
(play sampler | |
(pc:quantize (cosr (+ root 24) (cosr 5 3 1/2) 7/3) scale) | |
(cosr 80 20 7/3) | |
(* 2.0 dur)) | |
(if (> (random) .6) | |
(play fmsynth | |
(pc:quantize (+ 7 (cosr (+ root 24) (cosr 5 3 1/2) 7/3)) scale) | |
(cosr 80 20 7/3) | |
(* 0.2 dur) 0.5 5.0)) | |
(callback (*metro* (+ beat (* 0.5 dur))) 'right-hand (+ beat dur) dur))) | |
;; add kick drum | |
(define kick | |
(lambda (beat dur) | |
(play sampler2 36 127 dur) | |
(play -1/4 sampler2 36 100 (* 0.5 dur)) | |
(callback (*metro* (+ beat (* 0.5))) 'kick (+ beat dur) dur))) | |
(kick (*metro* 'get-beat 4) 1) | |
;; add high hats | |
(define hats | |
(lambda (beat dur) | |
(play sampler2 (random '(44 42)) (cosr 100 80 (random '(7/3 5/2))) dur) | |
(callback (*metro* (+ beat (* 0.5))) 'hats (+ beat dur) dur))) | |
(hats (*metro* 'get-beat 4) 1/4) | |
;; modify harmonic progression left hand | |
(define left-hand | |
(lambda (beat ps ds) | |
(if (= 0 (modulo beat 8)) | |
(set! root (random (remove root (list 52 50 48 43))))) | |
(play sampler (car ps) 80 (car ds)) | |
(play 1/2 sampler root 80 (car ds)) | |
(callback (*metro* (+ beat (* 0.5 ( car ds)))) 'left-hand (+ beat (car ds)) | |
(rotate ps -1) | |
(rotate ds -1)))) | |
;; modify right-hand modify fmsynth part | |
(define right-hand | |
(lambda (beat dur) | |
(play sampler | |
(pc:quantize (cosr (+ root 24) (cosr 5 3 1/2) 7/3) scale) | |
(cosr 80 20 7/3) | |
(* 2.0 dur)) | |
(if (> (random) .0) | |
(play fmsynth | |
(pc:quantize (+ 12 (cosr (+ root 24) (cosr 5 3 1/2) 7/3)) scale) | |
(cosr 80 20 7/3) | |
(* 0.2 dur) 0.5 5.0)) | |
(callback (*metro* (+ beat (* 0.5 dur))) 'right-hand (+ beat dur) dur))) | |
;; modify left hand again harmonic progression | |
(define left-hand | |
(lambda (beat ps ds) | |
(if (= 0 (modulo beat 8)) | |
(set! root (random (remove root (list 48 43))))) | |
(play sampler (car ps) 80 (car ds)) | |
(play 1/2 sampler root 80 (car ds)) | |
(callback (*metro* (+ beat (* 0.5 ( car ds)))) 'left-hand (+ beat (car ds)) | |
(rotate ps -1) | |
(rotate ds -1)))) | |
;; now start pulling everything out | |
(define left-hand | |
(lambda (beat ps ds) | |
(if (= 0 (modulo beat 8)) | |
(set! root (random (remove root (list 52 50 48 43))))) | |
(play sampler (car ps) 80 (car ds)) | |
(play 1/2 sampler root 80 (car ds)) | |
(callback (*metro* (+ beat (* 0.5 ( car ds)))) 'left-hand (+ beat (car ds)) | |
(rotate ps -1) | |
(rotate ds -1)))) | |
(define left-hand | |
(lambda (beat ps ds) | |
(if (= 0 (modulo beat 8)) | |
(set! root (random (remove root (list 48 43))))) | |
(play sampler (car ps) 80 (car ds)) | |
(play 1/2 sampler root 80 (car ds)) | |
(callback (*metro* (+ beat (* 0.5 ( car ds)))) 'left-hand (+ beat (car ds)) | |
(rotate ps -1) | |
(rotate ds -1)))) | |
(define right-hand | |
(lambda (beat dur) | |
(play sampler | |
(pc:quantize (cosr (+ root 24) (cosr 5 3 1/2) 7/3) scale) | |
(cosr 80 20 7/3) | |
(* 2.0 dur)) | |
(if (> (random) .6) | |
(play fmsynth | |
(pc:quantize (+ 7 (cosr (+ root 24) (cosr 5 3 1/2) 7/3)) scale) | |
(cosr 80 20 7/3) | |
(* 0.2 dur) 0.5 5.0)) | |
(callback (*metro* (+ beat (* 0.5 dur))) 'right-hand (+ beat dur) dur))) | |
;; modify right hand above cosr 80 downto cosr 10 steps 10 | |
(define right-hand | |
(lambda (beat dur) | |
;; (play sampler | |
;; (pc:quantize (cosr (+ root 24) (cosr 5 3 1/2) 7/3) scale) | |
;; (cosr 10 20 7/3) | |
;; (* 2.0 dur)) | |
(if (> (random) .6) | |
(play fmsynth | |
(pc:quantize (+ 7 (cosr (+ root 24) (cosr 5 3 1/2) 7/3)) scale) | |
(cosr 80 20 7/3) | |
(* 0.2 dur) 0.5 5.0)) | |
(callback (*metro* (+ beat (* 0.5 dur))) 'right-hand (+ beat dur) dur))) | |
;; stop right hand | |
(define right-hand) | |
;; stop kick drum | |
(define kick) | |
;; stop bassline | |
(define bassline) | |
;; stop hihat and modified left hand | |
(define hats) | |
(define left-hand | |
(lambda (beat ps ds) | |
(if (= 0 (modulo beat 8)) | |
(set! root (random (remove root (list 48 43))))) | |
(play sampler (car ps) 80 12.0) ;;(car ds)) | |
(play sampler root 80 12.0))) ;;(car ds)) | |
;; (callback (*metro* (+ beat (* 0.95 ( car ds)))) 'left-hand (+ beat (car ds)) | |
;; (rotate ps -1) | |
;; (rotate ds -1)))) | |
;; the end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment