Live coding visuals Clojure and openFrameworks

Live coding visuals with Clojure and openFrameworks.

You can edit shader programs using Lisp and send them just in time to the Not Analog server. Not Analog is a display server running on a gaming pc with a high end graphics acceleration. It serves for visuals only. The server is based on openFrameworks, written in C++ and the OpenGL shading language.

For live editing Atom and its prot-REPL plugin is used. Clojure transforms your code snippets to fragment shader programs and send them to this openFramework based visualization server.

You can mix generative code fragments with different inputs channels: a WEB cam, a microphone, movie files, image sequences, a joystick or Open Sound Control messages.

Some experimental videos made with Not Analog can be found at vimeo.

A black and white example with code.
(ns lv.demo)
(use 'lv.core)

(def decay (atom 1.0))
(reset! decay 1.0)
(uniform :u0 #(swap! decay (fn [v] (max (/ v 1.005) 0.01))))
(uniform :u0 #(swap! decay (fn [v] (min (* v 1.05)  1.0))))
(uniform :u0 #(+ 1))

(raster :r0
  (v 1)
  (dotimes [n (* u0 11)]
    (set dir (ifeven n 1 -1))
    (set speed (* dir (+ n 1) 0.011 f))
    (v (* v (distance  (* (vec2 x y) 2)
                       (vec2 (cos speed)
                             (sin speed)))))
  (set edge 2.0)
  (set border 0.25)
  (v (smoothstep (- edge border) (+ edge border) (* v 5)))

(raster :r1 [r0]
  (rot (* f 0.05))
  (v (- 1 r0.v))

(raster :r2 [r0 r1]
  (kaleid (* 2 (sin01 (* 0.05 f))))
  (repeat-x 2) (repeat-y 2)
  (v (mod (+ r0.v r1.v) 1.0))

(render 3)
(raster :r3 [r0 r2 r3]
  (repeat-y -1.01)
  (repeat-x -1.01)
  (v (* 1.05 r0.v (mix r2.v r3.v 0.975)))

Software used