integrating grooveduck or zero-crossings into phasor-based beat slicer
I could use a little help integrating either grooveduck or zero crossing faders into the phasor-based sample slicer in gen~. Ideally only a slight delay would be introduced to smooth out amplitude discontinuities. I'm much more comfortable programming in Max but I'm having a hard time with learning gen. I've been working at this for a long time but I'm hoping someone here has the knowledge and skill to do this in a few minutes.
The usual starting point would be to have two players and briefly crossfade between them. The point being that neither player can make a sudden jump (waveform cut) unless it is fully crossfaded out.
Then it is all about figuring out when to schedule crossfaded to achieve the slicing effect you want.
It might be easier to decouple the player playback from the phasor. First, get the phasor's rate of change, or slope, via phasor -> delta -> wrap -0.5 0.5. You can then accumulate that using a history & + loop. That will give you an endlessly rising line that has the same slope as the phasor, and you can use that to drive sample playback. Stick a switch into the feedback loop to be able to reset the position as desired, but only allow that switch to interrupt the line of the player is currently crossfaded out. That gives you a very generalized way to make cuts without clicks.
Then it is all about how you decide when to make cuts (when to trigger the switch), and what offsets to use when you do (what value to put in the switch).
There's more refinements you can do to this, like waiting for a transient or zero crossing to align the crossfades better (which also requires lookahead for half the crossfade period), but getting a basic seamless jump with crossfading is the first step.
In my sample-slicing gen~ patch, I use a Tukey window to hide discontinuities when jumping between slices. At very wide settings, breakbeats keep their punchiness; it generally doesn't noticeably eat into the transients, it just ducks the click between the slices. I also have a pitch/speed lfo which causes a click when ramp-shaped, jumping between 1 and 0. For that I use the crossfade technique Graham mentions. I sample-and-hold the signal going to the audible player when the lfo reaches 1, let the other player that's running silently in the background make the transition, then crossfade over. There's also the switch-and-ramp/swanramp method. Philip Meyer has a fairly recent video about it and how to implement it in gen~. I tried it out to see if I could use it to suppress the lfo-clicks, but I couldn't get it to work, probably wrong scenario for for that technique. Worth looking into anyways. Many ways to generate clicks, many ways to deal with them.
If you don't have the GO book, you should pick it up if you are able.
Thank you both, and especially Graham for all you've contributed. I'm still working on this. I've tried the "swanramp" with different settings and I'd say it barely helps. I do indeed have the GO book, and have made a few attempts at reading it cover to cover while reviewing the patches. Learning Gen~ is a challenge for me for a few reasons. I'm used to relying pretty heavily on the help files in max. The Kadenze Max course was also helpful, and hopefully someday there will be a Gen~ course I can take somewhere. AI can help a bit but of course there is less Gen~ documentation to train it on than one could find for other languages. I'll get there.
Yeah for me the GO book has been more useful as a reference and for getting ideas, but I don't get much out of it just sitting down and reading it tbh. It seems to assume a certain level of competence which I don't generally have. I usually understand the book better once I've already kinda figured something out, then I can refer back to it and be like, 'oh ok, that's how/why that works.' Or not, as the case may be. The code snippets are super helpful. As long as I have a general idea of how something works, maybe I can't patch myself from scratch, but I can at least grap the example patch and incorporate it into what I'm doing. This video by Taylor Brook was key for me getting the core of my sample player working, especially the section on windowing. This is where I got the idea to use the Tukey window, definitely wouldn't have figured it out on my own.
Oh and with respect to your patch, like Graham said, it might be easier to use some sort of accumulator to drive playback rather than a phasor. I use a phasor in my patch to derive a clock for resets and other stuff, but use a counter operator for playback. So counter limit = sample length in samples/number of slices, then multiply by the slice number to move around within the sample. The slice size in samples also gives you the number you will need to drive the window function, should you decide to try that out.