SOFA Matlab/Octave API
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 7 commits ahead, 4 commits behind sofacoustics:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

SOFA - Spatially Oriented Format for Acoustics

SOFA is a file format for reading, saving, and describing spatially oriented data of acoustic systems.

Examples of data we consider are head-related transfer functions (HRTFs), binaural room impulse responses (BRIRs), multichannel measurements such as done with microphone arrays, or directionality data of loudspeakers.

The format specifications are the major issue, but we also aim in providing APIs for reading and writing the data in SOFA.

For more information on the format specifications and available data have a look at


Current versions of SOFA can be found on its old home.

At the moment we are working on a new release which will be shortly available on this site.


Matlab/Octave API

In order to use SOFA with Matlab or Octave you have to add its API_MO folder to your paths. After that you can play around with your acoustic measurements as shown by the following example which uses a head-related transfer function measurement.

% Start SOFA
% Load your impulse response into a struct
hrtf = SOFAload('path/to_your/HRTF.sofa'));
% Display some information about the impulse response
% Plot a figure with the measurement setup
% Have a look at the size of the data
% Get information about the measurement setup
hrtf.ListenerPosition       % position of dummy head
hrtf.SourcePosition         % position of loudspeaker
% Head orientation of the dummy head + coordinate system and units
% Calculate the source position from a listener point of view
apparentSourceVector = SOFAcalculateAPV(hrtf);
% Listen to the HRTF with azimuth of -90°
apparentSourceVector(91, 1)
SOFAplotGeometry(hrtf, 91);
soundInput = audioread('fancy_audio_file.wav');
soundOutput = [conv(squeeze(hrtf.Data.IR(91, 1, :)), soundInput) ...
               conv(squeeze(hrtf.Data.IR(91, 2, :)), soundInput)];
sound(soundOutput, hrtf.Data.SamplingRate);