djphazer / O_C-Phazerville

The kitchen sink of O_C firmware - do all the things!
http://firmware.phazerville.com/
243 stars 37 forks source link

Global Sequence Length for MiniSeq, and SwitchSeq tweaks #74

Closed nbeirne closed 5 months ago

nbeirne commented 6 months ago

These are all the tweaks I have made since opening https://github.com/djphazer/O_C-Phazerville/pull/67. I rebased on top of the current beta version and discovered you already merged my code! Thanks!

Tweaks:

For review, each commit is self-contained. It will be easier to review each commit individually, then look at the whole thing. The largest change, global sequence lengths, is fully inside of this one commit: https://github.com/djphazer/O_C-Phazerville/pull/74/commits/f50f20de00962f34e2c202ecfa056152fb4715e7

I want to keep the first two commits separated, but the "tweaking" of SwitchSeq can be squashed before merging.

djphazer commented 6 months ago

Excellent work, sir! You clearly know what you're doing! 😉

I especially appreciate the math correction for Proportion, which should benefit everything else that uses it. I'll eventually fixup the other commit with this new solution when I rebase things again... dev/1.7 is basically a temporary staging area.

I'll admit I didn't realize there was room to squeeze more stuff into GlobalSettings... I was thinking about trying to add global quantizer settings in there as well... how many bytes do we have to spare? 🤔

nbeirne commented 6 months ago

We don't have much at this point. Just before I left my house for the night I discovered that one of the variants actually fails to compile because something else is taking space (or the memory space is smaller). I want to into specifically why tomorrow.

One way to get a tonne of space back is to remove some of the global patterns - right now there are 8, with 16 steps and 16 bits per step. Removing one gives us 256 bits. I think realistically 4 is probably enough if we are already breaking compatibility? Who knows that's a decision for you - I’m sure we can find the space elsewhere. Maybe.

djphazer commented 6 months ago

I've been thinking about this... I'm eventually going to reconfigure the GlobalSettings storage, but not until I do another major version bump, so as not to disturb existing installations...

Meanwhile, I had an idea to cleverly store the length parameter within the last step of each user_pattern. Length will be 32 by default, but if it's shorter, the last step would be unused... Perhaps if the top 3 bits are set, the bottom 5 bits would be length. The necessary stipulation would be that the last step cannot be both muted and accented.

Haven't tried it yet, just brainstorming at work.

nbeirne commented 6 months ago

Edit: I just realized that this approach would apply the same restriction, where we can't mute+accent any stage. I'm leaving the comment as-is, because it might help with brainstorming.

That's a good idea. I think we can go even further on it - the final 3 bits being set in any sequence can be a "skip". For our purposes, we'd add skips from back-to-front to accomplish different lengths, but we can also skip middle steps (ie, take steps 4-20 out of a sequence to get a 16 step sequence). The benefit would be preserving the original values of the stages, at the downside of length being a little more complex to calculate.

If we don't care about preserving the OG values, we can actually use the 5 empty bits, of every skipped stage, for other creative uses. Possibly a repeat of previous step, ala Metropolis?

djphazer commented 6 months ago

lol you kinda lost me, but it's definitely tricky... it's worth noting that "accent" is up for different interpretations - I want to add a config parameter for it: glide / tie / ratchet / etc, and maybe "skip" as well? Maybe mute+accent is different behavior? We're really milking these bits!

I was initially debating 5 vs. 6 bits for the note value... is 32 scale degrees a wide enough range? For semitones, or microtonal scales, not really... but 64 is a bit excessive. Maybe it could be simple to use 0xFF as a special case value?

nbeirne commented 6 months ago

Sorry, it's a half-thought through idea. The final two bits being set would be the skip, so we support 4 modes: none, mute, accent, and skip.

When the final two bits are set the step is fully ignored and we move to the next non-skipped step. So in the following case, the final two steps are skipped and we go from step 8 directly to step 1. Sequence length is counted as 7.

0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x03 

In the following case, step 3 and step 6 are skipped. Sequence length is counted as 6.

0x00 0x00 0x03 0x00 0x00 0x03 0x03 0x00

Does that make the basic idea more clear?

djphazer commented 5 months ago

These tweaks were squashed into v1.7.1 with the exception of the global pattern_lengths - I used my strategy for storing length in the last step instead, and I think it works well enough! Feel free to follow up with other tweaks and improvements.

nbeirne commented 5 months ago

fair enough! I have a few ideas for apps which take advantage of the mini sequences. This one is stable though!