exec
Also:
System context for Extempore:
System context for undertone:
The undertone “container”:
gen_servers
for state managementgen_server
that’s responsible for managing the backenderlang:open_port
(spawn_executable
)exec
library (which still uses Erlang ports)erlang:open_port
(spawn_executable
)exec
library (which still uses Erlang ports)erlang:open_port
(spawn_executable
)exec
library (which still uses Erlang ports)erlang:open_port
(spawn_executable
)exec
library (which still uses Erlang ports)gen_statem
using https://andrealeopardi.com/posts/connection-managers-with-gen_statem/Basics: a recursive function using pattern-matching in the function heads.
ackermann(0, N) ->
N+1;
ackermann(M, 0) ->
ackermann(M-1, 1);
ackermann(M, N) ->
ackermann(M-1, ackermann(M, N-1)).
(defun ackermann
((0 n) (+ n 1))
((m 0) (ackermann (- m 1) 1))
((m n) (ackermann (- m 1) (ackermann m (- n 1)))))
OTP: Erlang supervisor
-module('undertone.sup').
-behaviour(supervisor).
-export([start_link/0]).
-export([init/1]).
start_link() ->
supervisor:start_link({local, ?MODULE}, ?MODULE, []).
init([]) ->
{ok, {sup_flags(),
[child('undertone.server', start_link, [])]}}.
sup_flags() ->
#{strategy => one_for_one,
intensity => 3,
period => 60}.
OTP: LFE supervisor
(defmodule undertone.sup
(behaviour supervisor)
(export
(start_link 0)
(init 1)))
(defun start_link ()
(supervisor:start_link `#(local ,(MODULE)) (MODULE) '()))
(defun init (_args)
`#(ok #(,(sup-flags)
(,(child 'undertone.server 'start_link '())))))
(defun sup-flags ()
`#m(strategy one_for_one
intensity 3
xtlang:
(bind-func AudioBuffer_data_b64
(lambda (ab:AudioBuffer*)
(let ((b64size:i64 0)
(datsize:i64 (* (AudioBuffer_frames ab)
(AudioBuffer_channels ab) 4)))
(String (base64_encode (cast (tref ab 4) i8*)
datsize
(ref b64size))))))
Scheme:
(sys:load "libs/external/portmidi.xtm")
(pm_initialize)
(define *midi-out* (pm_create_output_stream 3))
(define midi-loop
(lambda (beat dur)
(mplay *midi-out*
(random (list 36 43 48 51 60 60 60 67 70 74 75))
(random 60 80)
dur 0)
(callback (*metro* (+ beat (* .5 dur)))
'midi-loop
(+ beat dur)
dur)))
(midi-loop (*metro* 'get-beat 4) 1/4)
Hi-res video of demo available here:
Ent drawing by Talbot Jenkins.
Beginnig of first piece in demo adapted for Piano, based upon “Journey of the Sorcerer” by Bernie Leadon of The Eagles.