expand

Reference > comb

Wave
Spectrum

    

comb(g1, m1, g2, m2) creates a comb filter. m1 and m2 must be positive integers, and g1 and g2 should be between -1 and 1.

Filter equation
output[i] = input[i] + g1 * input[i - m1] - g2 * output[i - m2]

In synthesine, filters are functions with methods for applying and setting the filter, and an internal memory that keeps track of the state of the filter. The technical term for the kind of object is a closure. Every time you create a filter, the state is erased, so it’s a good idea to define your filters only once, in the setup function.

You can find the code for comb in the synthesine library.