[share] Autotimed 'Raised-Cosine' On/Off Signal-Switch (in gen~)
Hello, i made a thing which is at the heart of all my years of 'click-pop' removal explorations on these forums, and the understanding of which was most solidified when i coded the 1st version of the karma~ object for Rodrigo Constanzo.
It is a simple 'raised-cosine' ramp for the smoothest, yet catch-all fade-in/fade-out click-pop removal, i've ever found. Now i've rebuilt it in gen~... perhaps not the most efficient mechanism of its kind, feel free to iterate and post your version here, but it is working well for me for every single place i need it.
This is just a demonstration patch, utilizing it in weird ways not originally intended(using it this way demonstrates how the raised-cosine fade is related to lopass filtering, especially in sound), while still demonstrating the sample-rate reactivity and quickness of it, hope it can be useful, or at least entertaining:
thanks to share !
i made that at time, named cosdel with same idea to smooth ramps, but for delay, like doppler effect. Seems to have the same logic, but for values over 1. I dydn't test for short datas, to avoid clicks.
nb: contribution of many off the maxlist... -thanks all-, in times to make like line~ in gen~, not so easy..., , and the ease package.
have a nice day all :-)
mz
This is so good, Thank You @Mizu!
About the question "how to make a line~ in gen~", there's two ways I generally recommend.
This is "go.line.ms" from the Generating Sound & Organizing Time book, which, like line~, ramps to a target over a fixed duration in ms:

A very similar method is to use a slew limiter, which ramps with a maximum steepness, and when your target is always either 0 and 1 this is almost equivalent (the difference is in how it responds when you interrupt it mid-ramp). Here's "go.slewlimit.ms", which has the same interface:

Both of these can be adapted to the raised-cosine on/off switch by setting the line targets to 0 and 1, and passing the resulting line through a raised-cosine unit shaper. (E.g. `0.5*(1-cos(pi*in))`)
The "raised cosine" has a lot of interesting properties actually -- the wikipedia page has nice pictures, but the explanations only really help if you happen to know what "vestigial symmetry", "minimal intersymbol interference", "havercosines" and so on mean... https://en.wikipedia.org/wiki/Raised-cosine_filter. One of the odd ones is that windowing FM with a raised cosine can create an entirely asymmetric spectrum, with sidebands only above or only below the fundamental -- that's also in the GO book (FM chapter).
Thanks guys for all this useful information. This week I eliminated clicks with just the pi sin function. Which seems to work very well for reading random information in wave.

that's also in the GO book
Thank You, Graham. read it once already, but i keep trying to figure things out on my own first, hoping math will become so intuitive:
Neo[Raja]: What are you trying to tell me? That I can dodge bullets?
Morpheus[Graham Wakefield]: No, [Raja], I'm trying to tell you that when you're ready, you won't have to.
I will read GO a second time now.