|
Krotos Modules 3
|
#include <EarFilter.h>
Public Member Functions | |
| EarFilter () | |
| void | configure (float sampleRate) |
| std::vector< float > | processSignal (std::vector< float > &inputSignal) |
Private Member Functions | |
| std::vector< float > | getLowPassFilterCoefficients (float normalizedFrequency, float qualityFactor) |
| std::vector< float > | convertToHighPass (const std::vector< float > &lowPassCoefficients) |
| void | applyIIRFilter (const std::vector< float > &inputSignal, dsp::IIR::Filter< float > &filter, std::vector< float > &filteredSignal) |
| void | applyFIRFilter (const std::vector< float > &inputSignal, const std::vector< float > &coefficients, std::vector< float > &filteredSignal) |
| void | calculateTransferFunction (const std::vector< float > b, const std::vector< float > a, int numPoints) |
| std::vector< float > | elementWiseDivision (const std::vector< float > &vector1, const std::vector< float > &vector2) |
| std::vector< float > | fir2 (int N, std::vector< float > &freqResponse, const std::vector< float > &gain) |
| std::vector< float > | linspace (float start, float end, int numPoints) |
Private Attributes | |
| float | m_sampleRate {-1.0f} |
| const float | m_maxFreq {20000.0f} |
| float | m_hopSizeSec = 0.0058f |
| float | m_hopSizeSamples |
| float | m_fc = 680.0f |
| float | m_q = 0.65f |
| std::vector< float > | m_magResponse |
| std::vector< float > | m_normalisedFreqs |
| std::vector< float > | m_freqResponse |
| std::vector< float > | m_a |
| std::vector< float > | m_b |
| dsp::IIR::Filter< float > | m_filter |
| std::vector< float > | m_gain |
| int | N = 50 |
| std::vector< float > | m_firCoeffb |
| std::vector< float > | m_freqs |
| std::vector< float > | m_gains |
| krotos::EarFilter::EarFilter | ( | ) |
Constructor
|
private |
Filters the inputSignal using an FIR filter operation, one sample at a time. TODO:: optimise to handle whole block by using SIMD optimisation from JUCE.
| inputSignal | the input signal in vector form |
| coefficients | the FIR filter coefficients |
| filteredSignal | an empty vector initially, contains the filtered afterwards. TODO:: rewrite to operate directly on input |
|
private |
Filters the inputSignal using an IIR filter and filtering one sample at a time. TODO:: optimize to handle whole block by using SIMD optimisation from JUCE.
| inputSignal | the input signal in vector form |
| filter | the IIR filter object performing the filtering |
| filteredSignal | an empty vector initially, contains the filtered afterwards. TODO:: rewrite to operate directly on input |
|
private |
Calculates the transfer function of a filter with coefficients a,b at numPoints.(The equivalent of MATLABs freqz function)
| b | vector containing the numerator coefficients of the filter |
| a | vector containing the denominator coefficients of the filter |
| numPoints | the number of frequencies to calculate on |
| void krotos::EarFilter::configure | ( | float | sampleRate | ) |
Configures the filter
| rate | the audio sampling rate |
|
private |
Calculates the IIR highpass filter coefficients from the lowPass denominator coefficients
| lowPassCoefficients | the vector containing the lowPass Filter coefficients |
|
private |
Performs element wise division between two vectors
| vector1 | numerator |
| vector2 | denominator |
|
private |
FIR arbitrary shape filter design using the frequency sampling method. Designs an Nth order linear phase FIR digital filter, with the frequency response specified by vectors freqResponse and gain and returns the filter coefficients in length N+1 vector. (The equivalent of MATLABs fir2.)
| N | order of the filter |
| freqResponse | frequency response we want the FIR filter to have |
| gain | gain factor of each freq |
|
private |
Calculates the coefficients of an IIR Lowpass filter, with specific cutoff frequency, and quality factor.
| normalizedFrequency | cutoff in Hz normalized by division with sampleRate |
| qualityFactor | the filters quality factor |
|
inlineprivate |
Equivalent of MATLABs linspace.
| std::vector< float > krotos::EarFilter::processSignal | ( | std::vector< float > & | inputSignal | ) |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |