Skip to main content

FilterFactory

FilterFactory

Factory for creating filters with the new interface. More…

#include <FilterFactory.hpp>

Public Functions

Name
template <int Order>
std::unique_ptr< IFilter >
createButterworthLowpass(double cutoff_hz, double sampling_rate_hz, bool zero_phase =false)
Create a Butterworth lowpass filter.
template <int Order>
std::unique_ptr< IFilter >
createButterworthHighpass(double cutoff_hz, double sampling_rate_hz, bool zero_phase =false)
Create a Butterworth highpass filter.
template <int Order>
std::unique_ptr< IFilter >
createButterworthBandpass(double low_cutoff_hz, double high_cutoff_hz, double sampling_rate_hz, bool zero_phase =false)
Create a Butterworth bandpass filter.
template <int Order>
std::unique_ptr< IFilter >
createButterworthBandstop(double low_cutoff_hz, double high_cutoff_hz, double sampling_rate_hz, bool zero_phase =false)
Create a Butterworth bandstop filter.
template <int Order>
std::unique_ptr< IFilter >
createChebyshevILowpass(double cutoff_hz, double sampling_rate_hz, double ripple_db, bool zero_phase =false)
Create a Chebyshev I lowpass filter.
template <int Order>
std::unique_ptr< IFilter >
createChebyshevIHighpass(double cutoff_hz, double sampling_rate_hz, double ripple_db, bool zero_phase =false)
Create a Chebyshev I highpass filter.
template <int Order>
std::unique_ptr< IFilter >
createChebyshevIBandpass(double low_cutoff_hz, double high_cutoff_hz, double sampling_rate_hz, double ripple_db, bool zero_phase =false)
Create a Chebyshev I bandpass filter.
template <int Order>
std::unique_ptr< IFilter >
createChebyshevIBandstop(double low_cutoff_hz, double high_cutoff_hz, double sampling_rate_hz, double ripple_db, bool zero_phase =false)
Create a Chebyshev I bandstop filter.
template <int Order>
std::unique_ptr< IFilter >
createChebyshevIILowpass(double cutoff_hz, double sampling_rate_hz, double stopband_ripple_db, bool zero_phase =false)
Create a Chebyshev II lowpass filter.
template <int Order>
std::unique_ptr< IFilter >
createChebyshevIIHighpass(double cutoff_hz, double sampling_rate_hz, double stopband_ripple_db, bool zero_phase =false)
Create a Chebyshev II highpass filter.
template <int Order>
std::unique_ptr< IFilter >
createChebyshevIIBandpass(double low_cutoff_hz, double high_cutoff_hz, double sampling_rate_hz, double stopband_ripple_db, bool zero_phase =false)
Create a Chebyshev II bandpass filter.
template <int Order>
std::unique_ptr< IFilter >
createChebyshevIIBandstop(double low_cutoff_hz, double high_cutoff_hz, double sampling_rate_hz, double stopband_ripple_db, bool zero_phase =false)
Create a Chebyshev II bandstop filter.
std::unique_ptr< IFilter > createRBJLowpass(double cutoff_hz, double sampling_rate_hz, double q_factor =0.707, bool zero_phase =false)
Create an RBJ lowpass filter (always 2nd order).
std::unique_ptr< IFilter > createRBJHighpass(double cutoff_hz, double sampling_rate_hz, double q_factor =0.707, bool zero_phase =false)
Create an RBJ highpass filter (always 2nd order).
std::unique_ptr< IFilter > createRBJBandpass(double center_freq_hz, double sampling_rate_hz, double q_factor =1.0, bool zero_phase =false)
Create an RBJ bandpass filter (always 2nd order).
std::unique_ptr< IFilter > createRBJBandstop(double center_freq_hz, double sampling_rate_hz, double q_factor =10.0, bool zero_phase =false)
Create an RBJ bandstop/notch filter (always 2nd order).

Detailed Description

class FilterFactory;

Factory for creating filters with the new interface.

This factory provides a way to create filters from FilterOptions (for compatibility) or directly with specific parameters.

Public Functions Documentation

function createButterworthLowpass

template <int Order>
static inline std::unique_ptr< IFilter > createButterworthLowpass(
    double cutoff_hz,
    double sampling_rate_hz,
    bool zero_phase =false
)

Create a Butterworth lowpass filter.

Parameters:

  • cutoff_hz Cutoff frequency in Hz
  • sampling_rate_hz Sampling rate in Hz
  • zero_phase Whether to apply zero-phase filtering

Template Parameters:

  • Order Filter order (1-8)

Return: Unique pointer to the created filter

function createButterworthHighpass

template <int Order>
static inline std::unique_ptr< IFilter > createButterworthHighpass(
    double cutoff_hz,
    double sampling_rate_hz,
    bool zero_phase =false
)

Create a Butterworth highpass filter.

Parameters:

  • cutoff_hz Cutoff frequency in Hz
  • sampling_rate_hz Sampling rate in Hz
  • zero_phase Whether to apply zero-phase filtering

Template Parameters:

  • Order Filter order (1-8)

Return: Unique pointer to the created filter

function createButterworthBandpass

template <int Order>
static inline std::unique_ptr< IFilter > createButterworthBandpass(
    double low_cutoff_hz,
    double high_cutoff_hz,
    double sampling_rate_hz,
    bool zero_phase =false
)

Create a Butterworth bandpass filter.

Parameters:

  • low_cutoff_hz Low cutoff frequency in Hz
  • high_cutoff_hz High cutoff frequency in Hz
  • sampling_rate_hz Sampling rate in Hz
  • zero_phase Whether to apply zero-phase filtering

Template Parameters:

  • Order Filter order (1-8)

Return: Unique pointer to the created filter

function createButterworthBandstop

template <int Order>
static inline std::unique_ptr< IFilter > createButterworthBandstop(
    double low_cutoff_hz,
    double high_cutoff_hz,
    double sampling_rate_hz,
    bool zero_phase =false
)

Create a Butterworth bandstop filter.

Parameters:

  • low_cutoff_hz Low cutoff frequency in Hz
  • high_cutoff_hz High cutoff frequency in Hz
  • sampling_rate_hz Sampling rate in Hz
  • zero_phase Whether to apply zero-phase filtering

Template Parameters:

  • Order Filter order (1-8)

Return: Unique pointer to the created filter

function createChebyshevILowpass

template <int Order>
static inline std::unique_ptr< IFilter > createChebyshevILowpass(
    double cutoff_hz,
    double sampling_rate_hz,
    double ripple_db,
    bool zero_phase =false
)

Create a Chebyshev I lowpass filter.

Parameters:

  • cutoff_hz Cutoff frequency in Hz
  • sampling_rate_hz Sampling rate in Hz
  • ripple_db Passband ripple in dB
  • zero_phase Whether to apply zero-phase filtering

Template Parameters:

  • Order Filter order (1-8)

Return: Unique pointer to the created filter

function createChebyshevIHighpass

template <int Order>
static inline std::unique_ptr< IFilter > createChebyshevIHighpass(
    double cutoff_hz,
    double sampling_rate_hz,
    double ripple_db,
    bool zero_phase =false
)

Create a Chebyshev I highpass filter.

Parameters:

  • cutoff_hz Cutoff frequency in Hz
  • sampling_rate_hz Sampling rate in Hz
  • ripple_db Passband ripple in dB
  • zero_phase Whether to apply zero-phase filtering

Template Parameters:

  • Order Filter order (1-8)

Return: Unique pointer to the created filter

function createChebyshevIBandpass

template <int Order>
static inline std::unique_ptr< IFilter > createChebyshevIBandpass(
    double low_cutoff_hz,
    double high_cutoff_hz,
    double sampling_rate_hz,
    double ripple_db,
    bool zero_phase =false
)

Create a Chebyshev I bandpass filter.

Parameters:

  • low_cutoff_hz Low cutoff frequency in Hz
  • high_cutoff_hz High cutoff frequency in Hz
  • sampling_rate_hz Sampling rate in Hz
  • ripple_db Passband ripple in dB
  • zero_phase Whether to apply zero-phase filtering

Template Parameters:

  • Order Filter order (1-8)

Return: Unique pointer to the created filter

function createChebyshevIBandstop

template <int Order>
static inline std::unique_ptr< IFilter > createChebyshevIBandstop(
    double low_cutoff_hz,
    double high_cutoff_hz,
    double sampling_rate_hz,
    double ripple_db,
    bool zero_phase =false
)

Create a Chebyshev I bandstop filter.

Parameters:

  • low_cutoff_hz Low cutoff frequency in Hz
  • high_cutoff_hz High cutoff frequency in Hz
  • ripple_db Passband ripple in dB
  • zero_phase Whether to apply zero-phase filtering

Template Parameters:

  • Order Filter order (1-8)

Return: Unique pointer to the created filter

function createChebyshevIILowpass

template <int Order>
static inline std::unique_ptr< IFilter > createChebyshevIILowpass(
    double cutoff_hz,
    double sampling_rate_hz,
    double stopband_ripple_db,
    bool zero_phase =false
)

Create a Chebyshev II lowpass filter.

Parameters:

  • cutoff_hz Cutoff frequency in Hz
  • sampling_rate_hz Sampling rate in Hz
  • stopband_ripple_db Stopband ripple in dB
  • zero_phase Whether to apply zero-phase filtering

Template Parameters:

  • Order Filter order (1-8)

Return: Unique pointer to the created filter

function createChebyshevIIHighpass

template <int Order>
static inline std::unique_ptr< IFilter > createChebyshevIIHighpass(
    double cutoff_hz,
    double sampling_rate_hz,
    double stopband_ripple_db,
    bool zero_phase =false
)

Create a Chebyshev II highpass filter.

Parameters:

  • cutoff_hz Cutoff frequency in Hz
  • sampling_rate_hz Sampling rate in Hz
  • stopband_ripple_db Stopband ripple in dB
  • zero_phase Whether to apply zero-phase filtering

Template Parameters:

  • Order Filter order (1-8)

Return: Unique pointer to the created filter

function createChebyshevIIBandpass

template <int Order>
static inline std::unique_ptr< IFilter > createChebyshevIIBandpass(
    double low_cutoff_hz,
    double high_cutoff_hz,
    double sampling_rate_hz,
    double stopband_ripple_db,
    bool zero_phase =false
)

Create a Chebyshev II bandpass filter.

Parameters:

  • low_cutoff_hz Low cutoff frequency in Hz
  • high_cutoff_hz High cutoff frequency in Hz
  • sampling_rate_hz Sampling rate in Hz
  • stopband_ripple_db Stopband ripple in dB
  • zero_phase Whether to apply zero-phase filtering

Template Parameters:

  • Order Filter order (1-8)

Return: Unique pointer to the created filter

function createChebyshevIIBandstop

template <int Order>
static inline std::unique_ptr< IFilter > createChebyshevIIBandstop(
    double low_cutoff_hz,
    double high_cutoff_hz,
    double sampling_rate_hz,
    double stopband_ripple_db,
    bool zero_phase =false
)

Create a Chebyshev II bandstop filter.

Parameters:

  • low_cutoff_hz Low cutoff frequency in Hz
  • high_cutoff_hz High cutoff frequency in Hz
  • sampling_rate_hz Sampling rate in Hz
  • stopband_ripple_db Stopband ripple in dB
  • zero_phase Whether to apply zero-phase filtering

Template Parameters:

  • Order Filter order (1-8)

Return: Unique pointer to the created filter

function createRBJLowpass

static inline std::unique_ptr< IFilter > createRBJLowpass(
    double cutoff_hz,
    double sampling_rate_hz,
    double q_factor =0.707,
    bool zero_phase =false
)

Create an RBJ lowpass filter (always 2nd order).

Parameters:

  • cutoff_hz Cutoff frequency in Hz
  • sampling_rate_hz Sampling rate in Hz
  • q_factor Q factor for the filter
  • zero_phase Whether to apply zero-phase filtering

Return: Unique pointer to the created filter

function createRBJHighpass

static inline std::unique_ptr< IFilter > createRBJHighpass(
    double cutoff_hz,
    double sampling_rate_hz,
    double q_factor =0.707,
    bool zero_phase =false
)

Create an RBJ highpass filter (always 2nd order).

Parameters:

  • cutoff_hz Cutoff frequency in Hz
  • sampling_rate_hz Sampling rate in Hz
  • q_factor Q factor for the filter
  • zero_phase Whether to apply zero-phase filtering

Return: Unique pointer to the created filter

function createRBJBandpass

static inline std::unique_ptr< IFilter > createRBJBandpass(
    double center_freq_hz,
    double sampling_rate_hz,
    double q_factor =1.0,
    bool zero_phase =false
)

Create an RBJ bandpass filter (always 2nd order).

Parameters:

  • center_freq_hz Center frequency in Hz
  • sampling_rate_hz Sampling rate in Hz
  • q_factor Q factor for the filter
  • zero_phase Whether to apply zero-phase filtering

Return: Unique pointer to the created filter

function createRBJBandstop

static inline std::unique_ptr< IFilter > createRBJBandstop(
    double center_freq_hz,
    double sampling_rate_hz,
    double q_factor =10.0,
    bool zero_phase =false
)

Create an RBJ bandstop/notch filter (always 2nd order).

Parameters:

  • center_freq_hz Center frequency in Hz for notch filter
  • sampling_rate_hz Sampling rate in Hz
  • q_factor Q factor for notch filter
  • zero_phase Whether to apply zero-phase filtering

Return: Unique pointer to the created filter


Updated on 2026-11-13 at 20:25:40 +0000