|
Krotos Modules 3
|
Filter an audio signal. More...
#include <Filter.h>
Public Types | |
| enum class | Mode { LPF12 , LPF24 , HPF12 , HPF24 , BPF12 , BPF24 } |
Public Member Functions | |
| Filter () | |
| ~Filter ()=default | |
| void | prepareToPlay (double sampleRate, int) |
| void | reset () noexcept |
| float | processSample (float inputValue, int channelToUse) noexcept |
| void | setMode (Mode newMode) noexcept |
| void | setCutoff (float newCutoff) noexcept |
| void | setResonance (float newResonance) noexcept |
| void | setDrive (float newDrive) noexcept |
Private Member Functions | |
| void | setSampleRate (float newValue) noexcept |
| void | setNumChannels (int newValue) |
Private Attributes | |
| std::vector< std::array< float, numStates > > | state |
| std::array< float, numStates > | A |
| float | cutoffFreqHz {1.0f} |
| float | cutoffFreqScaler |
| float | cutoffTransformValue |
| float | resonance {0.0f} |
| float | scaledResonanceValue |
| float | drive |
| float | drive2 |
| float | gain |
| float | gain2 |
| float | comp |
| dsp::LookupTableTransform< float > | saturationLUT {[](float x) { return std::tanh(x); }, -5.0f, 5.0f, 128} |
| Mode | mode {Mode::LPF12} |
| DryWet | m_mix |
| const int | NUM_CHANNELS_MAX {2} |
Static Private Attributes | |
| static constexpr size_t | numStates = 5 |
Filter an audio signal.
This class is a basic filter implementation derived from the juce::dsp::LadderFilter class. The code was copied from JUCE in order to remove the smoothers and provide better integration with the Kwidget system, which already handles parameter smoothing.
This class can also be used to add other types of filtering, such as the formant filter present in krotos_modules_2.
TODO: Add formant filtering capability.
|
strong |
|
inline |
Constructs a filter object. Call prepareToPlay() before using it!
|
default |
|
inline |
Call this function to prepare the filter for processing, or whenever the sample rate and block size change.
|
inlinenoexcept |
Process a single sample through a particular channel.
|
inlinenoexcept |
Resets the internal state variables of the filter.
|
inlinenoexcept |
Sets the cutoff frequency of the filter.
| newCutoff | cutoff frequency in Hz |
|
inlinenoexcept |
Sets the amount of saturation in the filter.
| newDrive | saturation amount; it can be any number greater than or equal to one. Higher values result in more distortion. |
|
inlinenoexcept |
Sets filter mode.
|
inlineprivate |
|
inlinenoexcept |
Sets the resonance of the filter.
| newResonance | a value between 0 and 1; higher values increase the resonance and can result in self oscillation! |
|
inlineprivatenoexcept |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
staticconstexprprivate |
|
private |
|
private |
|
private |
|
private |