Skip to content

Instantly share code, notes, and snippets.

@fronx
Last active December 20, 2015 14:59
Show Gist options
  • Select an option

  • Save fronx/6150730 to your computer and use it in GitHub Desktop.

Select an option

Save fronx/6150730 to your computer and use it in GitHub Desktop.
; (this is all fantasy code.)
;
; a response is a thing that takes in a trigger, and outputs a sequence of intensities.
;
; parentheses are used for zooming in.
; if a sequence has three items, it is automatically interpreted as a triplet. (same for any number of notes.)
; symbols can be mapped to note configurations using a "let"-like construct.
; parsing of strings using "notes": add spaces between all characters, then interpret as list.
; example:
(notation [o {:intensity 60} O {:intensity 100}]
(let [a (response [t] (match t o (notes "(Oo)"))) ; parentheses for zooming in
b (response [t] (match t o (notes "(OoO)"))) ; triplets!
ts (trigger (notes "____o___"))]
(concat (a ts) (b ts))))
; => (notes "____(Oo)___ ____(OoO)___")
; => '(_ _ _ _ ({:intensity 100} {:intensity 60}) _ _ _
; _ _ _ _ ({:intensity 100} {:intensity 60} {:intensity 100}) _ _ _)
; shorter syntax (assuming a scope that defines the "Oo" notation):
(fold-notes "____o___" "(Oo)")
; => '(_ _ _ _ ({:intensity 100} {:intensity 60}) _ _ _)
; depending on things like trigger intensity, a response might prefire:
(response [trigger]
(on (> (:intensity trigger) 70) (left-shift (notes "oO") 1) ; prefire!
(> (:intensity trigger) 20) (notes "Oo")))
@fronx
Copy link
Author

fronx commented Aug 4, 2013

@pje the fantasy program introduces it in line 11.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment