SOFA Database¶
Pyroomacoustics contains a small database of SOFA files that have been tested
and can be used for simultions.
The database can be loaded using the function
SOFADatabase.
# load and display the list of available SOFA files and their content
from pyroomacoustics.datasets import SOFADatabase
db = SOFADatabase()
db.list()
The database contains the following files.
Three files from the DIRPAT database collected by Manuel Brandner, Matthias Frank, and Daniel Rudrich University of Music and Performing Arts, Graz.
AKG_c480_c414_CUBE.sofacontaining the directive responses of a microphone with 4 different patterns.EM32_Directivity.sofathat contains the directional response of the Eigenmike em32 microphone array.LSPs_HATS_GuitarCabinets_Akustikmessplatz.sofathat contains 12 source directivities. This file is dynamically downloaded upon its first use.The files are public domain (CC0), but if you use them in your research, please cite the following paper.
M. Brandner, M. Frank, and D. Rudrich, "DirPat—Database and Viewer of 2D/3D Directivity Patterns of Sound Sources and Receivers," in Audio Engineering Society Convention 144, Paper 425, 2018.
Two head-related transfer functions of the MIT KEMAR dummy head with normal and large pinna. The data was collected by Bill Gardner and Keith Martin from MIT and is free to use provided the authors are cited. See the full license for more details.
- class pyroomacoustics.datasets.sofa.SOFADatabase(download=True)¶
A small database of SOFA files containing source/microphone directional impulse responses
The database object is a dictionary-like object where the keys are the names of the SOFA files and the values are objects with the following attributes:
db = SOFADatabase() # type of device: 'sources' or 'microphones' db["Soundfield_ST450_CUBE"].type # list of the labels of the sources/microphones db["Soundfield_ST450_CUBE"].contains
- Parameters:
download (bool, optional) – If set to True, the SOFA files are downloaded if they are not already present in the default folder
- property db_info_path¶
The path to the JSON file containing the SOFA files information
- list()¶
Print a list of the available SOFA files and the labels of the different devices they contain
- property root¶
The path to the folder containing the SOFA files
- class pyroomacoustics.datasets.sofa.SOFAFileInfo(path: Path, supported: bool = True, type: str = 'unknown', url: str = 'unknown', homepage: str = 'unknown', license: str = 'unknown', contains: List[str] = None)¶
A class to store information about a SOFA file
- Parameters:
path (Path) – The path to the SOFA file
supported (bool) – Whether the SOFA file is supported by Pyroom Acoustics
type (str) – The type of device (e.g., ‘sources’ or ‘microphones’)
url (str) – The URL where the SOFA file can be downloaded
homepage (str) – The URL of the SOFA file homepage
license (str) – The license of the SOFA file
contains (List[str]) – The labels of the sources/microphones contained in the SOFA file, or``None`` if the information is not available
- pyroomacoustics.datasets.sofa.download_sofa_files(path=None, overwrite=False, verbose=False, no_fail=False)¶
Download the SOFA files containing source/receiver impulse responses
- Parameters:
path (str or Path, optional) – A path to a directory where the files will be downloaded
overwrite (bool, optional) – If set to True, forces the download even if the files already exist
verbose (bool) – Print some information about the download status (default False)
- Returns:
files – The list of path to the files downloaded
- Return type:
list of Path
- pyroomacoustics.datasets.sofa.get_sofa_db()¶
A helper function to quickly load the SOFA database