Module crit.filters
Filters.
Small module that implements low-pass and high-pass filters. Useful in animation for smoothing out a signal (low-pass) or for focusing on fast changes in the signal (high-pass).
Usage example: examples/filters/filters.script
Functions
LowPassFilter (previous_output, input, dt) | A low pass filter function returned by ???. |
high_pass (cutoff_frequency) | Create a high pass filter. |
HighPassFilter (previous_output, delta_input, dt) | A high pass filter function returned by high_pass. |
Functions
- LowPassFilter (previous_output, input, dt)
-
A low pass filter function returned by ???.
Parameters:
- previous_output number The last output, as returned by the previous call to this function.
- input number The value of the input signal sample that is to be filtered.
- dt number Time elapsed (in seconds) since the last call to this function.
Returns:
-
number
The current output of the filter.
- high_pass (cutoff_frequency)
-
Create a high pass filter.
High-pass filters remove low frequencies from a signal, leaving out only the high frequencies. This is useful for situations where you need to track abrupt momentary changes.
Parameters:
- cutoff_frequency number The cut-off frequency (in Hz) of the filter.
Returns:
-
HighPassFilter
The new filter function.
- HighPassFilter (previous_output, delta_input, dt)
-
A high pass filter function returned by high_pass.
Parameters:
- previous_output number The last output, as returned by the previous call to this function.
- delta_input number The relative change of the input signal sample value since the last call to this function.
- dt number Time elapsed (in seconds) since the last call to this function.
Returns:
-
number
The current output of the filter.