Skip to content

Bilateral FIR Filter Model

Available from BRT v2.5.0 Last update: 9 Jan 2026

Overview

The Bilateral FIR Filter Model (class BRTBilateralFilter::CFIRBilateralFilterModel, defined in FIRBilateralFilterModel.hpp) implements binaural filtering through frequency-domain convolution using finite impulse responses (FIR). Each ear is processed independently by convolving the input signal with a fixed impulse response defined in the frequency domain.

This approach enables applications such as headphone compensation, device equalization, or other forms of binaural transfer function processing.

Impulse responses are provided by the dedicated service module GeneralFIR, typically loaded from SOFA files.


Architecture

The internal block diagram of this class is as follows:

Bilateral SOS Filter Model Internal Block diagram

Bilateral SOS Filter Model Internal Block diagram.

Inheritance

  • CFIRBilateralFilterModel derives from CBilateralFilterModelBase, which itself inherits from BRTBase::CModelBase.
  • The model is integrated into the processing graph through the BRTBase::CBRTManager.

Internal components

The main internal elements of the model are:

  • BRTServices::CGeneralFIR : Service that stores and provides the impulse responses (IRs) in the frequency domain.
  • BRTFilters::CFIRFilter (Frequency-domain FIR filter processor): Performs FFT-based convolution independently for the left and right ears.
  • Common::CAudioMixer (base class): Mixes multiple incoming audio streams per ear before convolution is applied.

Configuration Options

The model allows confcan be enabled and disabled dynamically:

  • Enable/Disable Model : If disabled, audio samples pass through unchanged.
  • Gain (float): Extra gain to be applied to the model output
  • Impulse Responses to be used : The General FIR service module to be used for rendering. The system supports dynamic, hot-swapping of the service module being used.

Connections

Modules to which it supports connections:

- Listener models

Modules to which it connects:

- Listener

For C++ developers

For C++ developer
  • File: /include/BilateralFilterModels/FIRBilateralFilterModel.hpp
  • Class name: CFIRBilateralFilterModel
  • Inheritance: CBilateralFilterModelBase
  • Namespace: BRTBilateralFilter
  • Classes that instance:
    • BRTFilters::CFIRFilter

Class inheritance diagram

FIR Bilateral Filter Model Internal diagram

FIR Bilateral Filter Model Internal diagram.


How to instantiate

brtManager.BeginSetup();
std::shared_ptr<BRTBilateralFilter::CFIRBilateralFilterModel> binauralFilter = brtManager.CreateBinauralFilter<BRTBilateralFilter::CFIRBilateralFilterModel>(_binauralFilterID);
brtManager.EndSetup();
if (binauralFilter == nullptr) {
    // ERROR
}

How to connect

Connect it to a listener.
std::shared_ptr<BRTBase::CListener> listener = brtManager.GetListener(_listenerID);
if (listener != nullptr) {
    brtManager.BeginSetup();
    bool control = listener->ConnectBinauralFilter(_binauralFilterID);
    brtManager.EndSetup();
}
Connect an listener model to it.
std::shared_ptr<BRTBilateralFilter::CBilateralFilterModelBase> binauralFilter = brtManager.GetBinauralFilter<BRTBilateralFilter::CBilateralFilterModelBase>(_binauralFilterD);
if (binauralFilter != nullptr) {
    brtManager.BeginSetup();
    bool control = binauralFilter->ConnectListenerModel(_listenerModelID);
    brtManager.EndSetup();
}

Public methods

void EnableModel() 
void DisableModel() 
bool IsModelEnabled() 

void SetGain(float _gain)
float GetGain()

bool SetFIRTable(std::shared_ptr<BRTServices::CGeneralFIR> _firTable)
std::shared_ptr<BRTServices::CGeneralFIR> GetFIRTable() const 
void RemoveFIRTable()

bool ConnectListenerModel(const std::string & _listenerModelID, Common::T_ear _ear = Common::T_ear::BOTH)
bool ConnectListenerModel(std::shared_ptr<BRTListenerModel::CListenerModelBase> _listenerModel, Common::T_ear _ear = Common::T_ear::BOTH)

bool DisconnectListenerModel(const std::string & _listenerModelID, Common::T_ear _ear = Common::T_ear::BOTH)
bool DisconnectListenerModel(std::shared_ptr<BRTListenerModel::CListenerModelBase> _listenerModel, Common::T_ear _ear = Common::T_ear::BOTH)

T_BilateralFilterType GeBilateralFilterType() const 

bool IsConnectedToListener()
bool IsConnectedToListenerModel()
void ConnectionToListenerEstablished(const std::string & _listenerID) 

std::vector<std::string> GetInputs() { return inputConnections; }
std::vector<std::string> GetOutputs() { return outputConnections; }