Support loading sofa files in makehrtf

The makehrtf utility now requires libmysofa to build. This isn't necessay for
the OpenAL Soft library itself.
This commit is contained in:
Chris Robinson
2019-01-22 11:13:14 -08:00
parent b4a2532ffc
commit ecafa19bcf
4 changed files with 690 additions and 189 deletions
+12 -11
View File
@@ -1515,19 +1515,20 @@ IF(ALSOFT_UTILS)
TARGET_COMPILE_OPTIONS(openal-info PRIVATE ${C_FLAGS})
TARGET_LINK_LIBRARIES(openal-info PRIVATE ${LINKER_FLAGS} OpenAL)
SET(MAKEHRTF_SRCS utils/makehrtf.cpp)
IF(NOT HAVE_GETOPT)
SET(MAKEHRTF_SRCS ${MAKEHRTF_SRCS} utils/getopt.c utils/getopt.h)
ENDIF()
ADD_EXECUTABLE(makehrtf ${MAKEHRTF_SRCS})
TARGET_COMPILE_DEFINITIONS(makehrtf PRIVATE ${CPP_DEFS})
TARGET_COMPILE_OPTIONS(makehrtf PRIVATE ${C_FLAGS})
IF(HAVE_LIBM)
TARGET_LINK_LIBRARIES(makehrtf PRIVATE ${LINKER_FLAGS} m)
ENDIF()
find_package(MySOFA)
if(MYSOFA_FOUND)
set(MAKEHRTF_SRCS utils/makehrtf.cpp)
if(NOT HAVE_GETOPT)
set(MAKEHRTF_SRCS ${MAKEHRTF_SRCS} utils/getopt.c utils/getopt.h)
endif()
add_executable(makehrtf ${MAKEHRTF_SRCS})
target_compile_definitions(makehrtf PRIVATE ${CPP_DEFS})
target_include_directories(makehrtf PRIVATE ${MYSOFA_INCLUDE_DIRS})
target_compile_options(makehrtf PRIVATE ${C_FLAGS})
if(HAVE_LIBM)
target_link_libraries(makehrtf PRIVATE ${LINKER_FLAGS} ${MYSOFA_LIBRARIES} m)
endif()
set(SOFAINFO_SRCS utils/sofa-info.cpp)
add_executable(sofa-info ${SOFAINFO_SRCS})
target_compile_definitions(sofa-info PRIVATE ${CPP_DEFS})
+51
View File
@@ -0,0 +1,51 @@
# This is a makehrtf HRIR definition file. It is used to define the layout
# and source data to be processed into an OpenAL Soft compatible HRTF.
#
# This definition is used to transform the SOFA packaged KEMAR HRIRs
# originally provided by Bill Gardner <billg@media.mit.edu> and Keith Martin
# <kdm@media.mit.edu> of MIT Media Laboratory.
#
# The SOFA conversion is available from:
#
# http://sofacoustics.org/data/database/mit/
#
# The original data is available from:
#
# http://sound.media.mit.edu/resources/KEMAR.html
#
# It is copyrighted 1994 by MIT Media Laboratory, and provided free of charge
# with no restrictions on use so long as the authors (above) are cited.
# Sampling rate of the HRIR data (in hertz).
rate = 44100
# The SOFA file is stereo, but the original data was mono. Channels are just
# mirrored by azimuth; so save some memory by allowing OpenAL Soft to mirror
# them at run time.
type = mono
points = 512
radius = 0.09
# The MIT set has only one field with a distance of 1.4m.
distance = 1.4
# The MIT set varies the number of azimuths for each elevation to maintain
# an average distance between them.
azimuths = 1, 12, 24, 36, 45, 56, 60, 72, 72, 72, 72, 72, 60, 56, 45, 36, 24, 12, 1
# Normally the dataset would be composed manually by listing all necessary
# 'sofa' sources with the appropriate radius, elevation, azimuth (counter-
# clockwise for SOFA files) and receiver arguments:
#
# [ 5, 0 ] = sofa (1.4, -40.0, 0.0 : 0) : "./mit_kemar_normal_pinna.sofa"
# [ 5, 1 ] = sofa (1.4, -40.0, 353.6 : 0) : "./mit_kemar_normal_pinna.sofa"
# [ 5, 2 ] = sofa (1.4, -40.0, 347.1 : 0) : "./mit_kemar_normal_pinna.sofa"
# [ 5, 3 ] = sofa (1.4, -40.0, 340.7 : 0) : "./mit_kemar_normal_pinna.sofa"
# ...
#
# If HRIR composition isn't necessary, it's easier to just use the following:
[ * ] = sofa : "./mit_kemar_normal_pinna.sofa" mono
+48
View File
@@ -0,0 +1,48 @@
# This is a makehrtf HRIR definition file. It is used to define the layout
# and source data to be processed into an OpenAL Soft compatible HRTF.
#
# This definition is used to transform the near-field KEMAR HRIRs provided by
# Bosun Xie <phbsxie@scut.edu.cn> of the South China University of
# Technology, Guangzhou, China; and converted from SCUT to SOFA format by
# Piotr Majdak <piotr@majdak.com> of the Acoustics Research Institute,
# Austrian Academy of Sciences.
#
# A copy of the data (SCUT_KEMAR_radius_all.sofa) is available from:
#
# http://sofacoustics.org/data/database/scut/SCUT_KEMAR_radius_all.sofa
#
# It is provided under the Creative Commons CC 3.0 BY-SA-NC license:
#
# https://creativecommons.org/licenses/by-nc-sa/3.0/
rate = 44100
# While the SOFA file is stereo, doubling the size of the data set will cause
# the utility to exhaust its address space if compiled 32-bit. Since the
# dummy head is symmetric, the same results (ignoring variations caused by
# measurement error) can be obtained using mono channel processing.
type = mono
points = 512
radius = 0.09
# This data set has 10 fields ranging from 0.2m to 1m. The layout was
# obtained using the sofa-info utility.
distance = 0.2, 0.25, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0
azimuths = 1, 24, 36, 72, 72, 72, 72, 72, 72, 72, 36, 24, 1;
1, 24, 36, 72, 72, 72, 72, 72, 72, 72, 36, 24, 1;
1, 24, 36, 72, 72, 72, 72, 72, 72, 72, 36, 24, 1;
1, 24, 36, 72, 72, 72, 72, 72, 72, 72, 36, 24, 1;
1, 24, 36, 72, 72, 72, 72, 72, 72, 72, 36, 24, 1;
1, 24, 36, 72, 72, 72, 72, 72, 72, 72, 36, 24, 1;
1, 24, 36, 72, 72, 72, 72, 72, 72, 72, 36, 24, 1;
1, 24, 36, 72, 72, 72, 72, 72, 72, 72, 36, 24, 1;
1, 24, 36, 72, 72, 72, 72, 72, 72, 72, 36, 24, 1;
1, 24, 36, 72, 72, 72, 72, 72, 72, 72, 36, 24, 1
# Given the above compatible layout, we can automatically process the entire
# data set.
[ * ] = sofa : "./SCUT_KEMAR_radius_all.sofa" mono
+579 -178
View File
File diff suppressed because it is too large Load Diff