Skip to content

vars function in scripted cycles#109

Closed
unlessgames wants to merge 15 commits intomasterfrom
cycle-user-vars
Closed

vars function in scripted cycles#109
unlessgames wants to merge 15 commits intomasterfrom
cycle-user-vars

Conversation

@unlessgames
Copy link
Copy Markdown
Collaborator

An initial draft for the discussed vars function on the cycle object.

Works similar to map in that you can supply either a static table or a function returning a table.

I guess we'll need a different context for vars? Since variables are only being assigned once per generate instead of each event, the fields related to a single step are meaningless.

Currently the table variant directly inserts the variables to the cycle instead of passing around the table contrary to the case with map, whereas the callback variant follows a similar pattern to the mapping_function.

Not sure what else should happen with the callback and its errors here, but it seems to work fine so far.

emuell and others added 15 commits December 16, 2025 21:05
optionally glides an existing note to the specified target pitch instead of starting a new note
- run previous sequences for an entire pattern length or up to 4 steps to look past possible glided notes
- memorize time where a note *will* stop so note glides can check if a note is playing or will be stopped
... and update samples to next phrase when time bases change
... it's already exported in the prelude and is necessary in order to create completely custom or
fallback patterns
- build with `fwasm-exceptions` to fix build errors with recent rustc/emscripten compilers
- update lua-src-rs accordingly
* separate cycle tests
* variable values & targets in cycle
* inject `Parameter` values into `Cycle` as vars, parsing enum strings as "sub-cycle" expressions
* perf tweaks
@unlessgames unlessgames closed this Mar 6, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 6, 2026

Benchmark for 3b35d45

Click to view benchmark
Test Base PR %
Cycle/Generate 48.0±0.60µs 52.2±0.47µs +8.75%
Cycle/Parse 299.2±6.38µs 309.4±3.78µs +3.41%
Rust Phrase/Clone 447.2±13.42ns 420.0±5.20ns -6.08%
Rust Phrase/Create 64.6±1.37µs 65.9±0.87µs +2.01%
Rust Phrase/Run 643.8±4.68µs 647.9±21.75µs +0.64%
Rust Phrase/Seek 137.3±253.99µs 135.2±248.08µs -1.53%
Scripted Phrase/Clone 644.9±15.22ns 626.3±7.90ns -2.88%
Scripted Phrase/Create 983.7±8.33µs 1009.7±29.77µs +2.64%
Scripted Phrase/Run 1674.2±10.64µs 1648.4±20.89µs -1.54%
Scripted Phrase/Seek 219.4±444.01µs 206.4±412.50µs -5.93%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants