Seeking Explanation for Signal Processing Patch!!!!!!!!!!!!!!!!!!!!!!!!

MINHYEOCK LEE's icon

MINHYEOCK LEE

5月 26 2024 | 1:27 午後

Could someone explain this patch? I'm particularly curious about the roles of mix, history, and - and how they interact with each other. How do they contribute to the overall signal processing in this patch?



Jean-Francois Charles's icon

Jean-Francois Charles

5月 26 2024 | 9:01 午後

Check the more simple versions of a gen filter in Help->Examples->Gen->gen~.filters.

The top left filter include [mix] and [history]. In gen, processing is sample by sample. [history] is 'the previous value of the sample'. It is y(n-1) in the equation at the top of this page: https://ccrma.stanford.edu/~jos/fp/One_Pole.html

If you need more about the theory of digital filters, this web site can help you:

For [mix], the Help file should be pretty clear.

Graham Wakefield's icon

Graham Wakefield

5月 27 2024 | 3:01 午後

These patches were taken from the GO book (https://cycling74.com/books/go), they are designed to be minimal percussive sounds.

The mix/history pair is a common idiom in gen~, it can be used as a basic filter, envelope generator, etc.

The filter chapter of that book goes into a fair bit of detail about how and why they work.

In summary:

mix is a linear crossfader. It crossfades between inputs 1 and 2 according to the control at input 3, which is between 0 and 1. You can also think of it as a weighted average, or a linear interpolation.

With mix 0.99 it just makes the crossfade a constant level of 0.99 (and so it removes the 3rd inlet), which means the output is 99% of the 2nd input, and 1% of the first input.

A history is just a single-sample delay, and it lets us make a feedback patch. All of the mix operators in this patch are crossfading between their input and a history feedback loop, i.e. their previous output. So it is a weighted average between the past and the present. Typically, as we crossfade closer to the feedback loop (the past), any very fast variations of the signal will not make it through as much and instead we get closer to a kind of long-term average of the signal. That's a low pass filter (it is a one pole IIR low pass filter). The one that uses a - operator is essentially removing this smoothed average from the input; which means it will leave only the rapid deviations behind; that's a high-pass filter. Hence the comments 'cheap filter'. The mix factor is the filter coefficient.

At extreme coefficients this filter can act as a control signal smoother -- if you pass gate (on/off) signals in, it will smooth their rise and fall and make an envelope shape. For many sounds we want a faster rise and slower fall, which we can do by simply changing the filter coefficient according to whether we are rising or falling. The patch above does this using a > 0 to detect rise and ? 1 0.00002 to set the rise and fall coefficients of the filter.

Definitely have a read through the filter chapter -- especially the first section up to where we talk about low pass gates, and maybe also the last section of the chapter about control signal smoothing/ramping.