Skip to content

Instantly share code, notes, and snippets.

@trentgill
trentgill / scale.lua
Last active November 15, 2021 19:56
a lua-quantizer in the .scale style
function quantize( volt, scale, divs, range )
-- defaults
chrom = {0,1,2,3,4,5,6,7,8,9,10,11}
if scale == nil then scale = chrom end
local notes = #scale
if notes == 0 then
scale = chrom
notes = #scale
end
@trentgill
trentgill / chilly.cpp
Created September 16, 2021 17:48
some feedback on chilly-cheese emulation of coldmac
void process(const ProcessArgs& args) override {
// setup macro and macro cv
float macro = params[MACRO_PARAM].getValue();
float macrovolts = (macro * 10) - 5;
float macro_cvin = 0.f;
if ( inputs[MACRO_INPUT].isConnected() ) {
macro_cvin = inputs[MACRO_INPUT].getVoltage();
}
@trentgill
trentgill / maps_jf.lua
Created August 18, 2021 15:21
emulating just friends with a crow ASL
--- maps: S2E4 dynamic mutation
-- just friends emulator in ASL
function init()
output[1](oscillate( dyn{freq=800}:mul(0.8) + 120, dyn{lev=5}:mul(0.98)))
end
HLUT = {1,2,3,4} -- list of harmonics to 'Intone' toward
-- v (0..1): 0 == all at f, 1 == all at HLUT multiples of f.
function intone(f, v)
@trentgill
trentgill / maps_s2e4.lua
Last active August 18, 2021 15:17
maps s2e4 preparation
--- maps: S2E4 dynamic mutation
-- using ASL's new dyn{} variables for self-modifying signals
-- aliases
s = sequins
ws = ii.wsyn
wd = ii.wdel
cr = clock.run
--- maps: S2E3 long distance
-- using i2c to communicate to external devices
-- ???
s = sequins
ws = ii.wsyn
wd = ii.wdel
cr = clock.run
@trentgill
trentgill / bouncy.lua
Last active October 8, 2022 18:55
lil demo of ASL creating simple decaying oscillator tones
--- bouncy
-- tiny demo of ASL's dyn, generating a stream of bass notes from crow
-- little sequins of frequencies
PIT = sequins{ 110
, 110*1.5
, 110*1.25
, 110*1.666
, 110*1.333
}
@trentgill
trentgill / maps_s2e1.lua
Created July 2, 2021 13:06
Maps S2E1: Found Shapes
-- found shapes
-- setup
mys = sequins{0,2,4,7,9}
myt = sequins{1,1,1,1/2,1/2}
function time_fn()
while true do
clock.sync(myt())
nn()
end
@trentgill
trentgill / mutating.lua
Last active June 24, 2021 18:54
working through some issues in asl2's mutable / iterating type
-- feels different if you separate the ASL structure from the data
function modulator(height, risetime, falltime)
return loop{ to( height, risetime )
, to( 0, falltime)
}
end
function init()
starting_rise = 1
@trentgill
trentgill / flashcrash.lua
Last active June 8, 2021 01:27
flash crash quantizer script
--- flash crash
-- quantizer & w/syn output
function init()
input[1].mode('scale',{0,1,2,3,4,5,6,7,8,9,10,11})
ii.wsyn.ar_mode(1)
ii.wsyn.fm_ratio(1)
output[2].action = pulse()
end
@trentgill
trentgill / crow3_syntax.lua
Last active June 24, 2021 14:48
crow v3 syntax
--- crow syntax reference
-- many libs have multiple access styles
-- i think we need to be more explicit about the idiomatic choices
-- all examples / bowery / tutorials should use *the* way
--- input
_ = input[n].volts --> returns current voltage
input[n].query() --> sends voltage to the stream handler
input[n].mode('mode' [, args]) -- function style