Skip to content

Instantly share code, notes, and snippets.

--- abstracted grid key mappings from functionality
-- demonstrate a simple string-based grid-layout system where each key is
-- addressed with a standard structure. direct handling for row and column
-- groups of keys that all call the same underlying function.
--
-- concept is to have a generic grid handler function, and wrap all of the
-- script specific functionality into a simple table of locations and
-- matching functions that will be called when that key is pressed or
-- released.
--
local ag =
{grid = {}
,fns = {}}
function ag.init(tab_or_g, fns)
if type(tab_or_g) == 'table' then
-- TODO for version with switchable layers
ag.grid = tab_or_g.grid
ag.fns = tab_or_g.fns
else -- assume grid obj
@trentgill
trentgill / sequins_arith.lua
Created November 14, 2021 05:01
sequins_arithmetic
-- base sequins
s1 = s{0,4,7}
s1(),s1(),s1() --> 0, 4, 7
-- apply a pattern 'transformer' function to maybe add an octave
s1:fn(function(n) return (n>5) and n or n+12 end)
s1(),s1(),s1() --> 12, 16, 7
@trentgill
trentgill / chance.lua
Last active November 15, 2023 01:29
timeline chance
--- some possible implementations of a probable function
-- really comes down to whether it's a timeline native behaviour
-- or if we just want a general fn to a wrap an application with chance
-- original version without chance
notesss = { 1, kick
, 1, {ii.wsyn.play_note, s{0,-12}, 2}
}
-- tl.chance is a function that takes a probability, and an action
@trentgill
trentgill / fledge_error
Created March 7, 2023 22:33
fledge error report
# script clear
# script load: /home/we/dust/code/fledge/fledge.lua
### initializing data folder
# script run
>> reading PMAP /home/we/dust/data/fledge/fledge.pmap
m.read: /home/we/dust/data/fledge/fledge.pmap not read.
Engine.register_commands; count: 0
___ engine commands ___
___ polls ___
amp_in_l
@trentgill
trentgill / how-to-git.md
Created June 26, 2022 16:13
a sketch of a future git how-to focused on thought patterns

how to git.

these are the mental patterns that i associate with git actions. whenever you have the following thoughts, try these actions.

you don't need github to get started. only once you want to share, move between computers, or you don't have a local backup solution.

"yay! this scrap of code is working!"

@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 / 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 / crow_prop.lua
Last active February 16, 2022 00:16
crow v3.1 livecoding & sequencing propositions
--- new elements for sequencing fun!
----------------------------------------------------------------------
----------------------------------------------------------------------
s = sequins
-- table call with a string is treated as a table of chars
cs = s"abcd" -- equivalent to s{'a','b','c','d'}
@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();
}