Official PyTorch implementation of the paper:
Exploring Frequency-Domain Feature Modeling for HRTF Magnitude Upsampling
This repository investigates different frequency-domain modeling strategies (MLP, Conv1D, Dilated Conv, Conformer, etc.) for sparse-to-dense HRTF magnitude upsampling on the SONICOM dataset.
We use the SONICOM HRTF dataset (200 subjects, 793 directions).
You can batch-download .sofa files using:
python tools/download_sonicom.pyThis will download files:
raw/P0001.sofa
...
raw/P0200.sofa
python tools/preprocess_sonicom.pyThis will generate:
data/sonicom.npz
The saved file contains:
H_log: (200, 793, 2, 106)
- 200 subjects
- 793 directions
- 2 ears
- 106 frequency bins
- Log-magnitude in dB
data/sonicom.npz
You can skip the raw download and preprocessing steps.
Training is controlled by a YAML configuration file.
Edit:
configs/default.yaml
Set the number of sparse measurements:
data:
n_measurements: 3 # choose from {3, 5, 19, 100}python src/train.py --config configs/default.yamlTraining will:
- Load SONICOM dataset
- Split subjects into train/test
- Train model
- Save best model to:
runs/sonicom_<variant>_<date>/best_model.pt
After training, evaluate using:
python src/eval.py \
--config configs/default.yaml \
--ckpt runs/<run_name>/best_model.ptEvaluation reports:
- LSD (Log Spectral Distortion) on unseen directions
- Broadband ILD MAE
Example output:
Evaluation Results
==============================
Sparse measurements : 3
Train LSD (unseen) : 4.12 dB
Test LSD (unseen) : 4.85 dB
Train ILD MAE : 1.24 dB
Test ILD MAE : 1.37 dB
==============================
Set model variant in YAML:
model:
variant: conformer # options:
# mlp
# conv
# dilated_b2
# conformer
# conformer_wo_convAll variants share the same architecture except for the frequency modeling block.
Tested with:
Python 3.10
PyTorch 2.6.0
Install dependencies:
pip install -r requirements.txtFor CUDA 12.4:
conda install pytorch=2.6.0 pytorch-cuda=12.4 -c pytorch -c nvidiaIf you use this code, please cite:
@article{chen2026exploring,
title={Exploring Frequency-Domain Feature Modeling for HRTF Magnitude Upsampling},
author={Chen, Xingyu and Bi, Hanwen and Ma, Fei and Zhao, Sipei and Cheng, Eva and Burnett, Ian S},
journal={arXiv preprint arXiv:2602.11670},
year={2026}
}