How to remove clicks when moving waveform~ selection?

the_man361's icon

Hello all,

I have a patch which uses waveform~ to play a part of a buffer~. I am doing the usual windowing of the buffer~'s output by multiplying groove~'s output by an envelope using the right output of groove~ to play a window by wave~. This provides me with click free playback at the edges of my selection in waveform~.

Max Patch
Copy patch and select New From Clipboard in Max.

However, if I move the selection left or right to such an extent where the selected area moves past the playhead, I get a click as the playhead relocates to inside the selection. I think I need to make the windowing start again when this happens, as it doesn't seem to be doing this.. I'm a bit stuck though, I'm sure there must be an easy way to do this! Could someone please suggest the best way to remove these clicks? Here's the part of my patch that handles the buffer and windowing if its relevant..

the_man361's icon

Thanks for the reply.. Ive had a look, I can kind of follow it, but im finding that this method seems to have a few problems, if im using the hand tool to zoom in the audio drops in and out because of the interrupting cutting in (probably because its sending the start and end points as bangs?), and if I move the selection and make sure the playhead stays inside the bounds of the selection while moving, the audio still drops in and out, which is kind of worse than if it only clicks when the selection moves away from the playhead. Is it not possible to only window when the playhead is outside of the selection area?

the_man361's icon

thanks for the advice raja, dont worry i dont expect you do do all that at all :) i was just wondering if theres an easy way and how it would be implemented. right, i shall have a look at that, im familiar with the if object, sounds like it could be a good method. thanks for the help :)

Paolo Pastorino's icon

Hey, did you resolve?