mNaturalComb
A lowpass-feedback IIR comb filter
Description
An IIR comb filter with a one-pole lowpass filter in the feedback loop. Useful for physical modeling for emulating the high-frequency loss typical of real-world recirculating delay systems. Length can be changed and interpolation is available.
Template Parameters
template<class T = int32_t, meap_interpolation INTERP = mINTERP_NONE>T: data type used in delay line
INTERP: kind of interpolation used when indexing non-integer sample indices
Class Methods
Constructor
mFeedbackComb(uint32_t max_delay_length, float delay_length, float feedback = 0.5, float damping = 0.5)max_delay_length: Constructor will allocate a delay buffer with this many samples. Cannot be changed. This is the maximum length of delay that this line can handle.
delay_length: Actual delay length between writing and reading samples. Can be changed
feedback: Feedback amount from output to input of delay line. (0 to 1.0)
damping: Affects cutoff frequency of lowpass filter in feedback loop. 0 corresponds to a high cutoff frequency (a small amount of filtering) and 1 corresponds to a low cutoff frequency (a large amount of filtering) (0 to 1.0)
void setDelay(float delay_samples)Sets length of delay used in comb filter. Must be less than max_delay_samples
void setFeedback(float feedback)Sets feedback from output to input of delay line within comb filter. (0 to 1.0)
void setDamping(float damping)Sets cutoff frequency of lowpass filter in feedback loop. 0 corresponds to a high cutoff frequency (a small amount of filtering) and 1 corresponds to a high cutoff frequency ( a large amount of filtering) (0 to 1.0)
T next(T in_sample)Retrieves a sample from comb filter and writes another sample into it.
Example