Skip to content

Commit

Permalink
Updated demo code.
Browse files Browse the repository at this point in the history
  • Loading branch information
oubiwann committed Feb 21, 2021
1 parent 0b43469 commit f6e2668
Show file tree
Hide file tree
Showing 3 changed files with 218 additions and 17 deletions.
139 changes: 139 additions & 0 deletions examples/lambda-days-2021/arp-demo.xtm
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
;;;; An undertone / Extempore demonstration of arpeggios
;;;;

;; For use in setting up song in the LFE undertone REPL, having executed the
;; following:
;; (undertone.repl.extempore:start)
;;
;; Then:
;; (load "priv/xt-midi/lambda-days-2021/init.xtm")
;;
;; Then, in the REPL, load the required functions:
;; (load "priv/xt-midi/lambda-days-2021/util.xtm")
;; (load "priv/xt-midi/lambda-days-2021/funs.xtm")
;;
;; After that, load the notes, chords, and arpeggios:
;; (load "priv/xt-midi/lambda-days-2021/notes.xtm")

;; From Extempore, you can do:
;;(define prefix "/Users/dmcgreggor/lab/lfe/undertone/examples/lambda-days-2021/")
(define prefix "/Users/oubiwann/lab/lfe/undertone/examples/lambda-days-2021/")

(sys:load (string-append prefix "init.xtm"))
(sys:load (string-append prefix "util.xtm"))
(sys:load (string-append prefix "funs.xtm"))
(sys:load (string-append prefix "notes.xtm"))
(sys:load (string-append prefix "moog-ipad-minimoog.xtm"))

;; Now you're ready to set up the MIDI channels (coupled to tracks in the DAW)
;; for the score ... and play it:

(pm_print_devices)

;;(define primary-midi-device-id 3) ; ; Arturia Moog modular V (virtual synth)
(define primary-midi-device-id 5) ; Behringer Model D (physical synth/eurorack)
(define *midiout* (pm_create_output_stream primary-midi-device-id))

(define midi-chan-1 0)

(define seq-1 (list c3 c4 c3 c4 a#3 g3))
(define seq-1 (list c3 c4 c3 c4 a#3 g3 a#3 g3))
;(define seq-1 (list c3 c3 a#3 g3 c4 c3 c4 g3))
(define seq-1 (list c3 c3 a#3 g3 c4 c4 a#3 g3))
(define seq-1 (list c3 c3 c4 c4 a#3 g3))
(define seq-1 (list c4 c3 a#3 g3))
(define seq-1 (list c4 c3))

;; tune seq:
(define seq-1 (list a4))
(define seq-1-pulse (list 127))

(define seq-1-pulse (list 127 127 127 127 127 127))
(define seq-1-pulse (list 127 127 127 127 127 127 127 127))

(define beats-per-measure 8)
(define note-timing 1/2)

(*metro* 'set-tempo 108)

(define midi-loop
(lambda (beat dur nlst plst)
(mplay *midiout*
(car nlst)
(car plst)
dur
midi-chan-1)
(if (null? (cdr nlst))
(callback (*metro* (+ beat (* 1 dur)))
'midi-loop
(+ beat dur)
note-timing
seq-1
seq-1-pulse)
(callback (*metro* (+ beat (* 1 dur)))
'midi-loop
(+ beat dur)
note-timing
(cdr nlst)
(cdr plst)))))

(midi-loop (*metro* 'get-beat beats-per-measure) note-timing seq-1 seq-1-pulse)

(define midi-loop
(lambda (beat dur plist) #t))

(define cc-vals (list 0 10 20 30 40 50 60 70 80 100 120))
(define cc-vals (list 0.0 0.25 0.5 0.25 0.0))

(define general-volume 7)
(define cutoff-filter-3 16)
(define resonance-filter-3 17)
(define cutoff-filter-2 18)
(define resonance-filter-2 19)
(define resonance-filter-1 71)
(define release-time-env-1 72)
(define attack-time-env-1 73)
(define cutoff-filter-1 74)
(define decay-time-env-1 75)
(define rate-lfo-1 76)
(define anount-fm-1-filter-1 77)
(define sustain-level-env-1 79)
(define attack-time-vca-1 80)
(define decay-time-vca-1 81)
(define sustain-level-vca-1 82)
(define release-time-vca-1 83)
(define vca-1-soft-clip 85)
(define wet-level-delay 91)
(define wel-level-chorous 93)

(define cc-midi-chan-1 0)

(define midi-cc-loop
(lambda (beat cc plst)
(mcc *midiout*
cc
(car plst)
cc-midi-chan-1)
(if (null? (cdr plst))
(callback (*metro* beat)
'midi-cc-loop
beat
cc
cc-vals)
(callback (*metro* beat)
'midi-cc-loop
beat
cc
(cdr plst)))))

(define cc cutoff-filter-1)
(define cc resonance-filter-1)

(define cc-beats-per-measure 12)

(midi-cc-loop (*metro* 'get-beat cc-beats-per-measure) cc cc-vals)

(send-midi-cc (now) *midiout* cc 15 cc-midi-chan-1)

(define midi-cc-loop
(lambda (beat cc plist) #t))
85 changes: 71 additions & 14 deletions examples/lambda-days-2021/td-demo.lfe
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,42 @@
(xt.midi:list-devices)

(set device-name "*midiout*")
(set device-id 2)

(set device-id 3) ; Arturia Moog modular V (virtual synth)
;;(set device-id 5) ; Behringer Model D (physical synth/eurorack)
(xt.midi:set-out-stream! device-name device-id)

(set sequence-name "seq-1")

(set beats-per-minute 108)

;;; Effects Sequence

(set midi-channel 1)
(set sequence-name "seq-sfx")

(set seq-sfx1 '(c2))
(set pulse-sfx1 '(127))
(set beats-per-measure-sfx 1)
(set note-timing-sfx "12")

(set opts-sfx (xt.seq:midi-opts sequence-name
device-name
device-id
midi-channel
seq-sfx1
pulse-sfx1
beats-per-minute
beats-per-measure-sfx
note-timing-sfx))

(xt.seq:start opts-sfx)
(xt.seq:stop opts-sfx)

;;; Pad Sequence

;;; Main Sequence

(set midi-channel 0)
(set sequence-name "seq-1")

(set seq1 '(c3 c4 c3 c4 a#3 g3))
(set seq2 '(c3 c4 c3 c4 a#3 g3 a#3 g3))
Expand All @@ -28,10 +58,10 @@
(set seq6 '(c4 c3 a#3 g3))
(set seq7 '(c4 c3))

(set pulse1 '(1 1 1 1 1 1))
(set pulse2 '(1 1 1 1 1 1 1 1))
(set pulse3 '(1 1 1 1))
(set pulse4 '(1 1))
(set pulse1 '(127 127 127 127 127 127))
(set pulse2 '(127 127 127 127 127 127 127 127))
(set pulse3 '(127 127 127 127))
(set pulse4 '(127 127))

(set beats-per-minute 108)
(set beats-per-measure 6)
Expand Down Expand Up @@ -81,37 +111,64 @@
;; After ramp-up, ramp-down the cutoff a bit
(xt.midi:cc-ramp (mupd opts 'cc-code (cutoff-filter-1)) 40 30 5)

;; Start a long ramp of the pulse witdth
;; Start a long ramp-down of the pulse witdth
(xt.midi:cc-ramp (mupd opts 'cc-code (width-osc-123)) 127 0 60)

(xt.seq:set-midi-notes! (mupd opts 'notes seq6 'pulses pulse3))

;; Ramp-down delay
(xt.midi:cc-ramp (mupd opts 'cc-code (wet-level-delay)) 60 30 10)

;; Change oscillator to be a lower octave
(xt.midi:cc (mupd opts 'cc-code (transpose-osc-1) 'cc-value 60))
(xt.midi:cc (mupd opts 'cc-code (transpose-osc-3) 'cc-value 80))

;; Reset the pulse witdth high
(xt.midi:cc (mupd opts 'cc-code (width-osc-123) 'cc-value 127))

(xt.seq:set-midi-notes! (mupd opts 'notes seq7 'pulses pulse4))

;; Change oscillators to be higher octaves
(xt.midi:cc (mupd opts 'cc-code (transpose-osc-1) 'cc-value 80))
(xt.midi:cc (mupd opts 'cc-code (transpose-osc-3) 'cc-value 127))

;; Ramp-up delay
(xt.midi:cc-ramp (mupd opts 'cc-code (wet-level-delay)) 30 60 10)

(xt.seq:set-midi-notes! (mupd opts 'notes seq2 'pulses pulse2))

;; Ramp-up cutoff again
(xt.midi:cc-ramp (mupd opts 'cc-code (cutoff-filter-1)) 30 40 5)

(xt.seq:set-midi-notes! (mupd opts 'notes seq3))
(xt.seq:set-midi-notes! (mupd opts 'notes seq3 'pulses pulse2))

;; Ramp-up and then down the resonance
;; Ramp-up the resonance
(xt.midi:cc-ramp (mupd opts 'cc-code (resonance-filter-1)) 0 80 5)

(xt.seq:set-midi-notes! (mupd opts 'notes seq4))
;; Ramp-down the resonance
(xt.midi:cc-ramp (mupd opts 'cc-code (resonance-filter-1)) 80 10 5)

(xt.seq:set-midi-notes! (mupd opts 'notes seq1 'pulses pulse1))
(xt.seq:set-midi-notes! (mupd opts 'notes seq4 'pulses pulse2))

;; Ramp-down cutoff
(xt.midi:cc-ramp (mupd opts 'cc-code (cutoff-filter-1)) 40 25 10)

(xt.seq:set-midi-notes! (mupd opts 'notes seq1 'pulses pulse1))

;; Ramp-down oscilator 2
(xt.midi:cc-ramp (mupd opts 'cc-code (gain-mixer-2)) 80 45 10)

;; Ramp-up pulse width
(xt.midi:cc (mupd opts 'cc-code (transpose-osc-1) 'cc-value 90))

;; Ramp-up other oscilators
(xt.midi:cc-ramp (mupd opts 'cc-code (gain-mixer-1)) 80 100 10)
(xt.midi:cc-ramp (mupd opts 'cc-code (gain-mixer-3)) 80 100 10)

;; Ramp-up delay
(xt.midi:cc-ramp (mupd opts 'cc-code (wet-level-delay)) 60 92 10)

(xt.seq:stop opts)




(xt.seq:stop opts)
11 changes: 8 additions & 3 deletions examples/lambda-days-2021/td-demo.xtm
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@

(pm_print_devices)

;;(define primary-midi-device-id 4)
(define primary-midi-device-id 3)
;;(define primary-midi-device-id 3) ; ; Arturia Moog modular V (virtual synth)
(define primary-midi-device-id 5) ; Behringer Model D (physical synth/eurorack)
(define *midiout* (pm_create_output_stream primary-midi-device-id))

(define midi-chan-1 0)
Expand All @@ -44,7 +44,12 @@
(define seq-1 (list c4 c3 a#3 g3))
(define seq-1 (list c4 c3))

(define seq-1-pulse (list 127 1 1 1 1 1))
;; tune seq:
(define seq-1 (list a4))
(define seq-1-pulse (list 127))

(define seq-1-pulse (list 127 127 127 127 127 127))
(define seq-1-pulse (list 127 127 127 127 127 127 127 127))

(define beats-per-measure 8)
(define note-timing 1/2)
Expand Down

0 comments on commit f6e2668

Please sign in to comment.