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.
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ShelfFilter Class Reference

High-shelf and low-shelf filter for audio processing. More...

#include <ShelfFilter.h>

Inheritance diagram for ShelfFilter:
Inheritance graph
[legend]
Collaboration diagram for ShelfFilter:
Collaboration graph
[legend]

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.
 
- Public Member Functions inherited from BaseFilter
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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ShelfFilter()

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.

Parameters
sample_rateThe sample rate of the audio data in Hz
cutoff_frequencyThe cutoff frequency of the filter in Hz
gain_dbThe gain or attenuation above/below the cutoff frequency, in decibels
typeThe type of filter: HighShelf or LowShelf

Member Function Documentation

◆ get_A()

const std::vector< double > & ShelfFilter::get_A ( ) const

Get the A coefficients.

Returns the current A (denominator) coefficients of the filter.

Returns
The A coefficients

◆ get_B()

const std::vector< double > & ShelfFilter::get_B ( ) const

Get the B coefficients.

Returns the current B (numerator) coefficients of the filter.

Returns
The B coefficients

◆ process_buffer()

std::vector< float > ShelfFilter::process_buffer ( std::vector< float > &  inputBuffer)
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.

Parameters
inputBufferA vector of input samples to be processed by the filter.
Returns
A vector of output samples that have been processed by the filter.

Implements BaseFilter.

◆ process_sample()

float ShelfFilter::process_sample ( float  sample)
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.

Parameters
sampleThe sample to be processed. This is a floating point value representing the audio sample.
Returns
The processed sample. The processing applies the specific shelf filter calculations to the input sample.

Implements BaseFilter.


The documentation for this class was generated from the following files: