Created
May 2, 2016 19:25
-
-
Save ninadsp/57c939f30bc745b41cc05b304e27e5a2 to your computer and use it in GitHub Desktop.
Barcamp Bangalore Spring 2016 session - Orchestrating from the Command line
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
;; A demo of Extempore (https://github.com/digego/extempore) | |
;; Based on tutorials from http://benswift.me/extempore-docs/index.html | |
;; and tutorials from the source (https://github.com/digego/extempore/tree/master/examples) | |
;; Step 1 - Fetch source and compile | |
;; Step 2 - Configure the editor and get a hang of the keyboard shortcuts | |
;; Step 3 - Evaluate the following code samples one block at a time | |
;; extempore basics | |
;; What is the time now | |
(print (now)) | |
;; What is the unix-time now | |
(clock:clock) | |
;; load the instruments file | |
(sys:load "libs/core/instruments.xtm") | |
;; define a synth using the provided components | |
;; synth_note_c and synth_fx | |
(bind-instrument synth synth_note_c synth_fx) | |
;; add the instrument to the DSP output callback | |
(bind-func dsp:DSP | |
(lambda (in time chan dat) | |
(synth in time chan dat))) | |
(dsp:set! dsp) | |
;; play a single note | |
(play-note (now) synth 71 80 10000) | |
;; schedule three nodes to play in succession | |
(define play-seq | |
(lambda () | |
(play-note (now) synth 60 80 10000) | |
(play-note (+ (now) 22050) synth 64 80 10000) | |
(play-note (+ (now) 44100) synth 67 80 10000))) | |
;; play | |
(play-seq) | |
;; to play a chord, remove the addition to (now) and try evaluating again | |
;; take play-seq a notch higher and set up an octave | |
(define play-octave | |
(lambda () | |
(play-note (now) synth 69 80 10000) | |
(play-note (+ (now) 22000) synth 71 80 10000) | |
(play-note (+ (now) 44000) synth 73 80 10000) | |
(play-note (+ (now) 66000) synth 74 80 10000) | |
(play-note (+ (now) 88000) synth 76 80 10000) | |
(play-note (+ (now) 110000) synth 78 80 10000) | |
(play-note (+ (now) 132000) synth 80 80 10000) | |
(play-note (+ (now) 154000) synth 81 80 10000) | |
)) | |
;; play | |
(play-octave) | |
;; an example of temporal recursion | |
(define temporal_101 | |
(lambda () | |
(play-note (now) synth 60 100 *second*) | |
(callback (+ (now) (* 2 *second*)) 'temporal_101))) | |
(temporal_101) | |
;; The next set of files are available in the source, experiment | |
;; with each one by one to better understand Extempore | |
;; | |
;; core/polysynth.xtm | |
;; core/audio_101.xtm | |
;; external/electrofunk.xtm | |
;; external/game-of-life.xtm | |
;; That's all, folks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment