The 3D Tune-In Toolkit: A C++ library for binaural spatialisation, andhearing loss / hearing aids emulation
Arcadio REYES-LECUONA1(1) , María CUEVAS-RODRÍGUEZ(1) , Daniel GONZÁLEZ-TOLEDO(1) , Carlos GARRE(1) ,Ernesto DE-LA-RUBIA-CUESTAS(1) , Luis MOLINA-TANCO(1) , Ángel RODRÍGUEZ-RIVERO(1) , Lorenzo PICINALI(2)(1) University of Malaga, Spain(2) Imperial College London, United Kingdom

Abstract
This contribution presents the 3D Tune-In (3DTI) Toolkit, an open source C++ library for binaural spatialisation
which includes hearing loss and hearing aid emulators. Binaural spatialisation is performed through convolution
with user-imported Head Related Transfer Functions (HRTFs) and Binaural Room Impulse Responses (BRIRs),including additional functionalities such as near- and far-field source simulation, customisation of Interaural
Time Differences (ITDs), and Ambisonic-based binaural reverberation. Hearing loss is simulated through gammatone filters and multiband expanders/compressors, including advanced non-linear features such as frequency
smearing and temporal distortion. A generalised hearing aid simulator is also included, with functionalities suchas dynamic equalisation, calibration from user-inputted audiograms, and directional processing.
Keywords: Binaural, Rendering, Hearing Aid, Hearing Loss1INTRODUCTION

The 3D Tune-In (3DTI) project (http://www.3d-tune-in.eu/), concluded in April 2019, aimed at supporting
hearing aid users through 3D sound and visual technologies, and gamification techniques. One of the main
outcomes of the project was the 3DTI Toolkit [3], a custom, open-source, multiplatform C++ library for binaural
spatialisation and emulation of hearing loss (HL) and hearing aids (HA), which was created in order to addressa challenging set of requirements regarding real-time performance and portability.

2THE 3DTI TOOLKIT STRUCTURE AND FEATURESThe Toolkit is presented as a set of modules grouped into three main components: binaural spatialiser, HL/HAsimulation, and shared modules for signal processing, buffer management and geometrical calculations. The distribution includes a collection of resources ready to be used by the Toolkit, including anechoic sample sounds,
a selection of Head Related Transfer Functions (HRTFs) from the LISTEN database [6], and some original Binaural Room Impulse Responses (BRIRs). Finally, a set of modules to manage those resources is also included.
2.1 Binaural spatialiser
The structure of the spatialiser is arranged so that the anechoic path and the reverberation are processed separately. The anechoic path is spatialised by direct convolution with Head Related Impulse Response (HRIR)
corresponding to the direction from where each sound source is coming. This HRIR is computed throughbarycentric interpolation among the nearest neighbours within the HRTF. The HRIRs need to have been processed in advance in order to remove the Interaural Time Differences (ITDs), and minimise comb filtering
effects during the interpolation. The signal resulting from the convolution is then processed by a near-field
simulator, which modifies the Interaural Level Differences (ILDs) according to a spherical head model, in order to account for the additional shadowing effect of the head when the sound source is located at distances
closer than the one where the HRTF was measured. Finally, the ITD is simulated through a simple delay in thecontralateral ear, allowing users to customise the rendering according to their own head circumference.

2217

The Toolkit implements binaural reverberation through a virtual-loudspeaker approach based on low-order Ambisonic encoding, and the convolution of individual loudspeaker signals with BRIRs. Reverberation is therefore
generated for all sources at the same time, but keeping certain location-dependent characteristics. This approach,
together with the use of uniformly partitioned convolution in the frequency domain, allows the Toolkit to simulate large reverberating scenes, with virtually unlimited number of sources, maintaining high spatial accuracy
for the direct anechoic path (spatialised using direct-HRIR convolution, as mentioned earlier).
2.2 HA/HL simulator
Optionally, after the spatialisation process, HA and HL simulators can be activated. The HA simulator is basedon a dynamic equaliser, which can be configured using the Fig6 formula [4], and allows for the simulationof directional microphones. The HL simulator is implemented with three cascaded processes: a multiband
expander, a frequency smearing algorithm which can use a custom model as well as the Moore-Baer one [2],and a temporal distortion algorithm, which introduce a fully customisable jitter [5].
2.3 Resources manager
These modules are provided to facilitate the loading of files containing the HRTF, BRIR and IIR filters used forthe near field compensation. HRTFs and BRIRs can be stored in SOFA files [1]. The HRTFs are assumed tobe in the form of a set of synchronised (i.e. no ITD) impulse responses, storing the ITD data in the Delay fieldprovided by the SOFA format. The BRIRs are assumed to be in the form of a set of impulse responses withthe direct path removed. In addition to SOFA, a custom 3dti format can be used to store HRTF and BRIR, as
well as the IIR filter coefficients look-up tables used for near field compensation.

3FINAL REMARKSThe 3D Tune-In Toolkit is an open source library which is available in a public repository at https://github.
com/3DTune-In/3dti_AudioToolkit. Several other releases of the 3DTI Toolkit are also available, includinga Test Application, with a GUI, OSC remote control capabilities and installers for MacOS, Windows and Linux;
a VST plugin for MacOS and Windows; and a Javascript wrapper for web-based binaural spatialisation1 . A
complete technical description of its spatialisation features has been recently published in [3]. A second paper
is currently in preparation to describe the implementation of the hearing loss emulation.

ACKNOWLEDGEMENTS
The 3D Tune-In project has received funding from the European Union’s Horizon 2020 research and innovation
programme under grant agreement No 644051.

REFERENCES[1] Audio Engineering Society. AES standard for file exchange - Spatial acoustic data file format Users. Technical report, Audio Engineering Society Inc., New York, New York, USA, 2015.
[2] T. Baer and B. C. J. Moore. Effects of spectral smearing on the intelligibility of sentences in the presenceof interfering speech. The Journal of the Acoustical Society of America, 95(4):2277–2280, apr 1994.
[3] M. Cuevas-Rodríguez, L. Picinali, D. González-Toledo, C. Garre, E. de la Rubia-Cuestas, L. Molina-Tanco,and A. Reyes-Lecuona. 3D Tune-In Toolkit: An open-source library for real-time binaural spatialisation.
PLOS ONE, 14(3):e0211899, mar 2019.
[4] M. C. Killion and S. Fikret-Pasa. The 3 Types of Sensorineural Hearing Loss: Loudness and Intelligibility
Considerations. The Hearing Journal, 46(11):31–36, 1993.
[5] M. K. Pichora-Fuller, B. A. Schneider, E. MacDonald, H. E. Pass, and S. Brown. Temporal jitter disrupts
speech intelligibility: A simulation of auditory aging. Hearing Research, 223(1-2):114–121, 2007.
[6] O. Warusfel. Listen hrtf database. online, IRCAM and AK, Available: http://recherche. ircam. fr/equipes/salles/listen/index. html, 2003.
1 https://github.com/3DTune-In/3dti_AudioToolkit/releases

2218