encloseEvent & query windowing functions #1093
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is a work in progress, it hasn't been tested with the new tactus functionallity
Related: tidalcycles/strudel#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:
quant k
: quantizes the times of events to steps of (1/k) cycles. Inputting 0 will bypass the effect.fill m
: fills gaps between events, essentially a proper legato (name being debated @ Real legato strudel#1142)alterT f
: takes a Time modifying function to alter the cyclePos of the eventsalterF f
: sames as above but uses a Double functionThe
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:
fill
encloseEvent
actually handle analog events?