tidalcycles / Tidal

Pattern language
http://tidalcycles.org/
GNU General Public License v3.0
2.27k stars 255 forks source link

encloseEvent & query windowing functions #1093

Open geikha opened 4 months ago

geikha commented 4 months ago

This PR is a work in progress, it hasn't been tested with the new tactus functionallity

Related: https://github.com/tidalcycles/strudel/pull/1142

With this PR I try to introduce a "new" way of time altering functions to Tidal. A method which I'll be calling windowing. This method is actually done in some ways by other functions, but this PR simplifies the process and introduces new functions. The idea is that for every query with a given state arc, Tidal queries an expanded window (for example, the whole cycleArc surrounding the query, or by some lookahead), processes the events found and then windows it back down to the original arc via the use of the new encloseEvent function. This function takes an Arc and an Event, and returns Just the Event as if it was queried from the given Arc, or Nothing (if it shouldn't be there in the first place). This makes it easy to implement functions which alter times of events between a single cycleArc.

UI functions added:

The alter functions have some buggy edge cases I'm trying to explore (events at the exact end of the cycle, negative results, etc).

fill sorts events just in case, but i have no idea if this actually necessary on tidal (it is on strudel, i was replicating jader's work with the events on this one)

I've noted there's an old TODO fill function on the Pattern package, I think it should be easier to implement with the new functions... I'll take a look.


TODO:

geikha commented 4 months ago

Would fix https://github.com/tidalcycles/Tidal/issues/761