see how when we re-assigned s1, the sequins is reset to it's first stage. this makes sense as we are creating a new sequins and replacing the old one with the new. sometimes we want to keep the index into the sequins, and just modify the data sightly (perhaps 1 note was off, and we're already using the sequins in a metro somewhere):
s = sequins
-- current solution
s1 = s{1,2,3}
s1:settable{4,5,6} -- requires different syntax
-- or use the hotswap library
hs = hotswap
hs.s1 = s{1,2,3}
hs.s1 = s{4,5,6}
behaviour of the 2 above solutions is identical. the difference is that the 2nd version doesn't require changing the syntax at all. hotswap is a special table that does some extra checks & balances whenever setting a value in the table. specifically it's for handling objects with internal state. at present that means sequins and timeline.
take this example of an arpeggiator, where we gradually morph the timeline in various ways, each without missing a beat or resetting any of the scales:
while the result is very wordy when written out as a block, this is designed for use in a text editor where you can re-evaluate a line of code at a time (LINK for howto). thus all the changes made above would be iterative modification of the line of text, and then re-running that line.
implementation
the way the library works is a very basic shim which just captures assignments & forwards everything through the internal hotswap and settable methods of timeline & sequins respectively. as a result, any bugs that are found are likely not the fault of hotswap, but the implementation of those methods.
the new sequins-transformer PR includes a number of fixes & extensions for sequins.settable. the timeline.hotswap function is only loosely tested currently, and while it works on a basic level, i haven't explored complex nesting of different features (beyond a sequins in an action-table). there is likely some bugs & edge-cases not handled.
extending
this library is intended to be extended as other stateful data structures ("classes"?) are identified that could benefit from live-piecemeal-modification. there may be a bunch of these on norns that i don't know about. on crow, ASL could potentially use this feature, but it's likely a very big undertaking as it'd have to interact with the C-layer.
simple library oriented toward live-coding, and specifically addressing the desire to re-run a line of code numerous times to change data piecemeal.
take the following example:
see how when we re-assigned
s1
, the sequins is reset to it's first stage. this makes sense as we are creating a new sequins and replacing the old one with the new. sometimes we want to keep the index into the sequins, and just modify the data sightly (perhaps 1 note was off, and we're already using the sequins in a metro somewhere):behaviour of the 2 above solutions is identical. the difference is that the 2nd version doesn't require changing the syntax at all.
hotswap
is a special table that does some extra checks & balances whenever setting a value in the table. specifically it's for handling objects with internal state. at present that meanssequins
andtimeline
.take this example of an arpeggiator, where we gradually morph the timeline in various ways, each without missing a beat or resetting any of the scales:
while the result is very wordy when written out as a block, this is designed for use in a text editor where you can re-evaluate a line of code at a time (LINK for howto). thus all the changes made above would be iterative modification of the line of text, and then re-running that line.
implementation
the way the library works is a very basic shim which just captures assignments & forwards everything through the internal
hotswap
andsettable
methods of timeline & sequins respectively. as a result, any bugs that are found are likely not the fault of hotswap, but the implementation of those methods.the new
sequins-transformer
PR includes a number of fixes & extensions forsequins.settable
. thetimeline.hotswap
function is only loosely tested currently, and while it works on a basic level, i haven't explored complex nesting of different features (beyond a sequins in an action-table). there is likely some bugs & edge-cases not handled.extending
this library is intended to be extended as other stateful data structures ("classes"?) are identified that could benefit from live-piecemeal-modification. there may be a bunch of these on norns that i don't know about. on crow,
ASL
could potentially use this feature, but it's likely a very big undertaking as it'd have to interact with the C-layer.