Spherical FIR Table
Overview
SphericalFIRTable is a Service Module that stores collections of Finite Impulse Response (FIR) filters organized in spherical coordinates.
It is designed to manage spatially indexed filter datasets such as HRTFs, BRIRs, and directional source responses.
Each filter entry is associated with a direction and distance relative to the listener, defined by azimuth, elevation, and distance. The module provides a structured container that enables Processing Models to efficiently retrieve spatial impulse responses during binaural rendering.
In addition to storing FIR data, the module supports temporal windowing of impulse responses, allowing the beginning or end of the IR to be modified. This capability is particularly useful for adapting datasets to different rendering strategies.
Within the BRT ecosystem, SphericalFIRTable acts as a central repository for spatial FIR datasets shared across rendering algorithms.
Role in the Architecture
In the BRT architecture, SphericalFIRTable serves as a data provider for Processing Models. Rendering algorithms query the table to retrieve FIR filters corresponding to the current spatial configuration of sources and listeners. The module itself does not read external files. Instead, Readers import datasets from formats such as SOFA or other measurement formats and populate the table structure.
This separation ensures that data loading, storage, and signal processing remain independent components, improving modularity and extensibility.
Data Organization
The data structure is organized hierarchically to support multiple measurement contexts and spatial resolutions.
At the highest level, FIR datasets are grouped by a reference position in 3D space. Each reference position typically corresponds to a measurement location of the sound source or listener, which is particularly useful for BRIR datasets where impulse responses are measured at different positions in a room.
Within each reference position, the data is further divided into distance buckets, each representing a sphere of measurements at a specific radial distance. This structure allows datasets such as HRTFs measured at multiple radii to coexist in the same table. During rendering, the system selects the distance sphere closest to the requested source distance.
Inside each distance bucket, FIR filters are organized by azimuth and elevation. A KD-tree spatial index is used to perform efficient nearest-neighbour searches, allowing the system to retrieve the closest available measurement direction when an exact match is not present.
The stored impulse responses can also be temporally windowed. Samples at the beginning of the IR may be replaced with zeros to delay the response, while the tail of the impulse response can be truncated to reduce its duration. This allows the dataset to be adapted to different rendering requirements without modifying the original measurements.
This hierarchical structure enables flexible storage of datasets with arbitrary spatial sampling distributions, without requiring a regular directional grid.
Internal FIR Representation
Before being stored in the module, the HRIRs are transformed into a representation optimized for real-time convolution. Each HRIR is partitioned into fragments matching the input buffer size in order to support Uniformly Partitioned Overlap-Save (UPOLS) convolution. An FFT is then applied to every partition and the resulting spectra are stored in memory by the Service Module. As a result, the binaural rendering stage performs convolution directly in the frequency domain, significantly improving computational efficiency.
Data hierarchy
graph LR
A[Reference Position] --> B[Distance Sphere]
B --> C[Direction: Azimuth / Elevation]
C --> D[Partitioned FR of the left ear]
C --> E[Partitioned FR of the right ear]
Supported Data Types
SphericalFIRTable can store several types of spatial FIR datasets, including:
- HRTFs (Head-Related Transfer Functions) — impulse responses describing the filtering effect of the listener’s anatomy for different directions.
- BRIRs (Binaural Room Impulse Responses) — spatial impulse responses that include head-related filtering and room acoustics.
- Source Directivity Data — directional radiation patterns of sound sources represented as FIR filters.
- Generic Spatial FIR Filters — any FIR dataset indexed or not by spatial direction.
All datasets are represented as impulse responses associated with spherical coordinates and optionally multiple distances or reference positions.
Typical Use Cases
A common use case is binaural rendering of virtual sound sources, where the Processing Model queries the table using the source direction relative to the listener. The system retrieves the closest available FIR measurement and applies it during convolution.
For multi-distance HRTF datasets, the renderer selects the sphere whose radius best matches the current source distance. This enables more accurate rendering when datasets include near-field measurements.
For room acoustics datasets such as BRIRs, the system selects the reference position closest to the current source position in the environment. In these cases, the impulse responses can also be windowed or truncated to remove unwanted portions of the response, enabling efficient implementation of hybrid rendering approaches that combine early reflections and late reverberation models.
Related Service Modules
SphericalInterpolatedFIRTable
Spherical Interpolated FIR Table extends the functionality of SphericalFIRTable by performing interpolation between measurement directions. This allows Processing Models to obtain FIR filters for arbitrary directions even when the dataset is sparsely sampled. In contrast, SphericalFIRTable performs nearest-neighbour retrieval and always returns the closest available measurement.
SphericalSOSTable
SphericalSOSTable stores spatially organized IIR filters represented as second-order sections (SOS) instead of FIR impulse responses. While both modules use spherical indexing, SphericalFIRTable is intended for impulse-response-based datasets, whereas SphericalSOSTable stores parametric filter representations.
Configuration Options
This service allows you to configure the following parameters:
- Enable/Disable Woodworth ITD: Toggles the application of the Woodworth ITD formula for HRTF processing.
- Set/Get Head Radius: Configures or retrieves the radius of the listener's head model.
- Set parameters for the windowing IR process: Defined the windowing paremeters.
Summary
SphericalFIRTable is a core Service Module that stores spatially organized FIR filter datasets used by binaural rendering algorithms.
Its hierarchical structure supports multiple reference positions, multiple measurement distances, and arbitrary directional sampling. Efficient spatial queries are implemented through nearest-neighbour searches using KD-tree structures.
This design allows BRT to manage complex spatial datasets such as multi-distance HRTFs and room-based BRIR measurements in a flexible and scalable way.
For C++ developer
For C++ developer
- File: /include/ServiceModules/SphericalFIRTable.hpp
- Class name: CSphericalFIRTable
- Inheritance: CServicesBase
- Namespace: BRTServices
Class inheritance diagram
classDiagram
direction TB
class CServicesBase
<<interface>> CServicesBase
class CSphericalFIRTable
class CSphericalInterpolatedFIRTable
class CSphericalSOSTable
class CAmbisonicBIR
CServicesBase <|-- CSphericalFIRTable
CServicesBase <|-- CSphericalInterpolatedFIRTable
CServicesBase <|-- CSphericalSOSTable
CServicesBase <|-- CAmbisonicBIR
How to instantiate and load
// Assuming SOFA_FILEPATH contains the SOFA filename including the path
std::shared_ptr<BRTServices::CSphericalFIRTable> hrtf = std::make_shared<BRTServices::CSphericalFIRTable>();
bool hrtfSofaLoaded = LoadSofaFile(SOFA_FILEPATH, hrtf);
if (!hrtfSofaLoaded) {
// ERROR
}
How to connect it to a listener
// Assuming that the ID of this listener is contained in _listenerID and
// that the HRTF is already lsuccessfuly loaded into hrtf.
std::shared_ptr<BRTBase::CListener> listener = brtManager->GetListener(listenerID);
listener->SetHRTF(hrtf);
Public Methods of CSphericalFIRTable
| Category | Method | Description |
|---|---|---|
| Constructor | CSphericalFIRTable() |
Creates an empty spherical FIR table service. |
| ITD Customization | EnableWoodworthITD() |
Enables Woodworth ITD model for interaural delay estimation. |
DisableWoodworthITD() |
Disables the Woodworth ITD model. | |
IsWoodworthITDEnabled() const |
Returns whether the Woodworth ITD model is currently enabled. | |
| FIR Partition Info | GetNumberOfSubfiltersFR() const |
Returns the number of frequency-domain FIR partitions. |
GetSubfilterLengthFR() const |
Returns the length of each partitioned FIR subfilter. | |
| Cranial Geometry | SetHeadRadius(float) |
Sets the head radius used for spatial calculations. |
GetHeadRadius() const |
Returns the current head radius. | |
RestoreHeadRadius() |
Restores the default head radius value. | |
SetEarPosition(T_ear, CVector3) |
Sets the local position of the specified ear. | |
GetEarLocalPosition(T_ear) const |
Returns the local position of the specified ear. | |
SetCranialGeometryAsDefault() |
Resets cranial geometry parameters to default values. | |
| Measurement Metadata | GetDistanceOfMeasurement(...) |
Returns the distance associated with the closest measurement for the given spatial parameters. |
| IR Windowing | SetWindowingParameters(...) |
Configures fade-in and fade-out window parameters applied to impulse responses. |
GetWindowingParameters(...) |
Returns the current impulse response windowing parameters. | |
| FIR Table Setup | BeginSetup(...) |
Initializes the table configuration before inserting impulse responses. |
AddIR(...) |
Adds a new impulse response measurement to the table. | |
EndSetup() |
Finalizes the table structure after all impulse responses have been added. | |
| FIR Retrieval | GetFR_SpatiallyOriented(...) |
Returns the frequency-domain FIR partitions for one ear at a given spatial direction. |
GetFR_SpatiallyOriented_2Ears(...) |
Returns the frequency-domain FIR partitions for both ears. | |
GetFR_2Ears() |
Returns the current FIR partitions for both ears without spatial query. | |
| Delay Retrieval | GetFR_Delay(...) |
Returns the interaural delays associated with the selected FIR responses. |
| Metadata | GetReferencePositions() const |
Returns the list of reference positions used in the FIR table. |