Skip to content

Instantly share code, notes, and snippets.

@CircuV
Last active August 29, 2015 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CircuV/d272d3c1279289b5681a to your computer and use it in GitHub Desktop.
Save CircuV/d272d3c1279289b5681a to your computer and use it in GitHub Desktop.
;;; as_part_midi.xtm -- live performance
;; based on Andrew Sorensen "A Study in Pärt" Impromptu performance
;; A study in simplicity - a study in Pärt.
;; Based on Arvo Pärt 'Cantus in Memory of Benjamin Britten'
;; https://vimeo.com/2434054
;;
;; Orginal code translated to Extempore
;; http://extempore.moso.com.au
;;
;; Author: cv
;; Keywords: extempore, live-coding, impromptu, arvo pärt
;;; Commentary:
;;; Code:
;; load MIDI library
(sys:load "libs/external/rtmidi.xtm")
;; midi stuff
(define *midi-out* (midi_new_outdevice))
;; query for valid midi output devices
(midi_query_outports *midi-out*)
;; now open output port (assuming port 0)
(midi_open_outport *midi-out* 0)
;; play midi test note
(play-midi-note (now) *midi-out* 72 20 10000 0)
;; requires pc_ivl-lib Pitch Class Library
(sys:load "libs/core/pc_ivl.xtm")
;; set tempo
(*metro* 'set-tempo 80)
;; define scale
(define scale (pc:scale 0 'aeolian))
(define volume 1)
;; performance starts here
(define arvo
(lambda (time start pitch dur channel)
(play-midi-note (*metro* time) *midi-out* pitch
(real->integer volume)
(*metro* 'dur dur) channel)
(set! volume (+ volume 1)) (println volume)
(callback (*metro* (+ time (* 0.5 dur))) 'arvo (+ time dur)
(if (> pitch (- start 12))
start
(pc:relative start -1 scale))
(if (> pitch (- start 12))
(pc:relative pitch -1 scale)
start)
(random '(3 2 1))
channel)))
;; start playing violin ensemble part
(arvo (*metro* 'get-beat 4) 96 96 3 0)
;; add second violin part
(arvo (*metro* 'get-beat 4) 84 84 3 0)
;; add viola ensemble
(arvo (*metro* 'get-beat 4) 72 72 3 1)
;; add cello ensemble
(arvo (*metro* 'get-beat 4) 60 60 3 2)
;; changes to arvo code
;; decrease volume (set! volume (- volume 1)) (println volume)
;; change durations
;; (set! volume (- volume 1)) (println volume)
;; (random '(3 2 4))
(define arvo
(lambda (time start pitch dur channel)
(play-midi-note (*metro* time) *midi-out* pitch
(real->integer volume)
(*metro* 'dur dur) channel)
(set! volume (- volume 1)) (println volume)
(callback (*metro* (+ time (* 0.5 dur))) 'arvo (+ time dur)
(if (> pitch (- start 12))
start
(pc:relative start -1 scale))
(if (> pitch (- start 12))
(pc:relative pitch -1 scale)
start)
(random '(3 2 4))
channel)))
;; change durations
;; (random '(3 2 6 4))
;; change durations
;; (random '(3 6 4))
;; change durations
;; (random '(6 5 4))
;; decrease volume (set! volume (- volume 0.5)) (println volume)
;; decrease volume (set! volume (- volume 0.25)) (println volume)
;; stop decrease volume (set! volume (- volume 0)) (println volume)
;; change durations
;; change durations
;; (random '(6 5 8))
;; decrease volume (set! volume (- volume 0.25)) (println volume)
;; change durations
;; (random '(6 7 8))
;; change durations
;; (random '(6 12 8))
;; decrease volume (set! volume (- volume 0.125)) (println volume)
;; stop decrease volume (set! volume (- volume 0)) (println volume)
;; stop recursion
(define arvo)
;; the end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment