AudibleT 0.0.1
A real-time A/B/X audio testing tool for subjective assessment of various audio parameters, compatible for general purpose computer as well as embedded systems.
|
High-shelf and low-shelf filter for audio processing. More...
#include <ShelfFilter.h>
Public Member Functions | |
ShelfFilter (double sample_rate, double cutoff_frequency, double gain_db, FilterType type) | |
Constructor. | |
std::vector< float > | process_buffer (std::vector< float > &inputBuffer) override |
Processes a buffer of input samples through the filter. This is experimental and not used. | |
float | process_sample (float sample) override |
Override of process_sample for ShelfFilter class. | |
const std::vector< double > & | get_A () const |
Get the A coefficients. | |
const std::vector< double > & | get_B () const |
Get the B coefficients. | |
![]() | |
virtual | ~BaseFilter () |
Destructor. | |
virtual std::vector< float > | process_buffer (std::vector< float > &inputBuffer)=0 |
Pure virtual function to process a buffer of input samples. | |
virtual float | process_sample (float sample)=0 |
Process a single sample through the filter. | |
High-shelf and low-shelf filter for audio processing.
This class implements a high-shelf and low-shelf filter based on the BaseFilter interface. It is used in audio processing to attenuate or boost frequencies above or below a certain cutoff frequency.
ShelfFilter::ShelfFilter | ( | double | sample_rate, |
double | cutoff_frequency, | ||
double | gain_db, | ||
FilterType | type | ||
) |
Constructor.
Initializes the filter with a sample rate, cutoff frequency, gain in decibels, and type of filter.
sample_rate | The sample rate of the audio data in Hz |
cutoff_frequency | The cutoff frequency of the filter in Hz |
gain_db | The gain or attenuation above/below the cutoff frequency, in decibels |
type | The type of filter: HighShelf or LowShelf |
const std::vector< double > & ShelfFilter::get_A | ( | ) | const |
Get the A coefficients.
Returns the current A (denominator) coefficients of the filter.
const std::vector< double > & ShelfFilter::get_B | ( | ) | const |
Get the B coefficients.
Returns the current B (numerator) coefficients of the filter.
|
overridevirtual |
Processes a buffer of input samples through the filter. This is experimental and not used.
This method takes a vector of floating point samples as input, processes each sample through the filter, and returns a new vector containing the filtered samples.
This method is meant to be used when it's more efficient to process a whole buffer of samples at once, rather than calling process_sample() on each individual sample. Experimental and currently not utilized.
inputBuffer | A vector of input samples to be processed by the filter. |
Implements BaseFilter.
|
overridevirtual |
Override of process_sample for ShelfFilter class.
This function is a specific implementation of process_sample for the ShelfFilter. It processes a single audio sample through the shelf filter, and provides the resulting output.
sample | The sample to be processed. This is a floating point value representing the audio sample. |
Implements BaseFilter.