monome / crow

Crow speaks and listens and remembers bits of text. A scriptable USB-CV-II machine
GNU General Public License v3.0
162 stars 34 forks source link

Dev4.0 #476

Closed trentgill closed 1 year ago

trentgill commented 1 year ago

Just a temporary PR to have a public zip file for testing.

trentgill commented 1 year ago

@dndrks please do further testing using this branch as it includes all of the updates for the proposed 4.0

direct download: https://github.com/monome/crow/suites/11236996367/artifacts/575310576

this fixes all the issues from the timeline branch (:times resets correctly, 'reset' works correctly on score), and changes to the new :play and :stop behaviour as discussed. also uses timeline.real name change.

currently running the long-time test to see if the random stopping is fixed... EDIT: had this running for a good 15mins and the it's still swinging away:

timeline.loop{sequins{0.6,0.4}, function() output[4](pulse(0.005,2)) end}

EDIT AGAIN: this has been running for a good 5-6 hours and still banging away nicely. i think we're good to go!


once we get this all tested, i think this is the release candidate for 4.0 and will be time to move onto documentation and tooling updates (eg: norns firmware update)

dndrks commented 1 year ago

rad rad rad!! @trentgill , so super exciting!!!!

prior bugs

all resolved! ### `timeline` freezes - [x] **********************************status: resolved!********************************** ```lua tl = timeline kick = function() output[1](pulse()) end snare = function() output[2](pulse()) end mypairs = {1, kick, 2, snare, 0.5, snare, 0.3, kick, 0.2, snare} timeline.loop(mypairs) ``` ### `times` freezes - [x] **status: resolved** ```lua tl = timeline kick = function() output[1](pulse()) end mykick = tl.queue():loop{2, kick}:times(3) ``` ### `reset` freezes - [x] **status: resolved** ```lua tl = timeline s = sequins kick = function() output[1](pulse()) end snare = function() output[2](pulse()) end tl.score{ 0, kick , s{2,1}, snare , 2, kick , 3, snare , 4, 'reset' } ```

new feature questions

timeline.real all works! did run into an edge-case, which is fun + totally fine but just to be aware of for docs note: ```lua tl = timeline s = sequins kick = function() print("kick: "..clock.get_beats()) end snare = function() print("snare: "..clock.get_beats()) end hat = function() print("hat: "..clock.get_beats()) end tl.real{ 0, kick , 1, hat , 5, kick , 1, snare , 2, function() print('reset') end , 2, 'reset' } ``` if timestamps are mistakenly written in as durations, crow will bundle the steps together and execute everything at once. eg. the above returns: ```lua kick: 4927.0 hat: 4929.002 kick: 4937.004 snare: 4937.004 reset kick: 4937.004 hat: 4939.006 kick: 4947.008 snare: 4947.008 reset kick: 4947.008 hat: 4949.01 ``` this is expected, yeah?
hotswap ### initial problem building off of the original example: ```lua tl = timeline function bang() print 'a' end printing = tl.loop{ 1, bang } ``` **assumptions:** this should take over printing `a`, because i’m overwriting the `printing` var: ```lua > printing = tl.loop{2, function() print 'b' end} ``` **results:** - *`b` never prints and `a` continues to print* - *`printing` now has a new scripting identity moving forward, whereas its previous identity is still frozen running in the `tl.loop` action* ### using the API successfully if i want to switch the `printing` timeline’s function and/or the `loop` timing, i need to use a `hotswap`: ```lua > tl.hotswap(printing, { 2, function() print 'b' end }) ``` **results:** - *successfully started printing `b` at half the pace of the previous `loop`* - *this also worked: `tl.hotswap(printing, tl.loop{2,function() print 'b' end })`* ### using the API less successfully my second successful result led me to another assumption: i should be able to hotswap `loop` for another `timeline` mode, yeah? eg. ```lua > tl.hotswap(printing, tl.score{ 5, function() print 'c' end }) ``` and while this _does_ change the printed value to `c` at a 5 beat timestamp, it also **loops**. i assume this is because what’s actually happening behind-the-scenes is that `hotswap` can't change the `timeline` mode, but it does scrape the new time and function and drops them into the previously-running mode, so my previous execution actually resulted in: ```lua tl.loop{ 5, function() print 'c' end } ``` totally rad if this is expected, just want to note it so that it’s highlighted in the docs 🙂! if there’s any additional info that i’m missing / misunderstanding, please lmk! **oh! generally, i’m also curious if `hotswap` is going to be its own library as outlined in [https://github.com/monome/crow/pull/456](https://github.com/monome/crow/pull/456) ?**
trentgill commented 1 year ago

@dndrks thanks for this. the function swapping thing is something i found & noted in the timeline PR as well. i wrote up some more notes about it there, but basically it's a feature of how lua works and i don't know if there's a way around it. hotswap seems like the solution for now.

re: hotswap library. yes it will be included. i had pushed it to 4.1, but honestly it's a tiny library and seemed to work well. i thought it was contributing to the timelines-stopping-running-after-some-time issue, but turns out it was not causally related. my only concern is that it's one more layer to introduce people to. i think we can manage that with documentation though so i'll get it all bundled together and do some more testing this afternoon.

@dndrks @tehn i'll get everything merged this afternoon as there's lots of tricky git navigation that needs to happen. omw to test drive some cars though, so it'll be your tomorrow-workday before i get it all done. thank you both for the work! really happy to see this all coming together, and excited to writeup some new docs to communicate all these new really cool features!

dndrks commented 1 year ago

shweee!!


@trentgill , oh jeez sorry, i think i muddied the water on this:

the function swapping thing is something i found & noted in the timeline PR as well

the initial problem was totally from that PR :) my real q's covered under using the API less successfully, where i had assumed that i could use hotswap to not only swap variables but whole timeline modes, following the success of the other tests outlined in that section.


rad rad rad, can't wait to dig in to docs with ya!! also ooo new transportation!! vrooooom