libmysofa-0.6/ 0000775 0000000 0000000 00000000000 13131134101 0013330 5 ustar 00root root 0000000 0000000 libmysofa-0.6/.appveyor.yml 0000664 0000000 0000000 00000000647 13131134101 0016005 0 ustar 00root root 0000000 0000000 version: 1.0.{build}
configuration: Release
platform: x64
install:
- cmd: >-
cp "%APPVEYOR_BUILD_FOLDER%\src\hrtf\mysofa_export.h.in" "%APPVEYOR_BUILD_FOLDER%\src\hrtf\mysofa_export.h"
cp "%APPVEYOR_BUILD_FOLDER%\windows/config.h.sln" "%APPVEYOR_BUILD_FOLDER%\src\config.h"
nuget:
account_feed: true
project_feed: true
build:
project: windows/libmysofa.sln
verbosity: normal
artifacts:
- path: windows\bin
libmysofa-0.6/.cproject 0000664 0000000 0000000 00000013173 13131134101 0015147 0 ustar 00root root 0000000 0000000
CMAKE_BUILD_TOOL
CMAKE_BUILD_TOOL_IGN_ERR
all
false
true
true
CMAKE_BUILD_TOOL
all
true
true
true
libmysofa-0.6/.gitignore 0000664 0000000 0000000 00000003303 13131134101 0015317 0 ustar 00root root 0000000 0000000 ### Eclipse
#.project
#.cproject
bin/
.settings/
### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion
*.iml
## Directory-based project format:
.idea/
# if you remove the above rule, at least ignore the following:
# User-specific stuff:
# .idea/workspace.xml
# .idea/tasks.xml
# .idea/dictionaries
# Sensitive or high-churn files:
# .idea/dataSources.ids
# .idea/dataSources.xml
# .idea/sqlDataSources.xml
# .idea/dynamic.xml
# .idea/uiDesigner.xml
# Gradle:
# .idea/gradle.xml
# .idea/libraries
# Mongo Explorer plugin:
# .idea/mongoSettings.xml
## File-based project format:
*.ipr
*.iws
## Plugin-specific files:
# IntelliJ
/out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
### Linux template
*~
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
### C template
# Object files
*.o
*.ko
*.obj
*.elf
# Precompiled Headers
*.gch
*.pch
# Libraries
# *.lib
*.a
*.la
*.lo
# Shared objects (inc. Windows DLLs)
# *.dll
*.so
*.so.*
*.dylib
# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex
# Debug files
*.dSYM/
### C++ template
# Compiled Object files
*.slo
*.lo
*.o
*.obj
# Precompiled Headers
*.gch
*.pch
# Compiled Dynamic libraries
*.so
*.dylib
# *.dll
# Fortran module files
*.mod
# Compiled Static libraries
*.lai
*.la
*.a
# *.lib
# Executables
*.exe
*.out
*.app
### Vim template
[._]*.s[a-w][a-z]
[._]s[a-w][a-z]
*.un~
Session.vim
.netrwhist
*~
# Build
build/
src/hrtf/mysofa_export.h
src/config.h
libmysofa-0.6/.project 0000664 0000000 0000000 00000001372 13131134101 0015002 0 ustar 00root root 0000000 0000000
libmysofa
org.eclipse.cdt.managedbuilder.core.genmakebuilder
org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
full,incremental,
org.eclipse.cdt.core.cnature
org.eclipse.cdt.core.ccnature
org.eclipse.cdt.managedbuilder.core.managedBuildNature
org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
libmysofa-0.6/.travis.yml 0000664 0000000 0000000 00000003311 13131134101 0015437 0 ustar 00root root 0000000 0000000 matrix:
include:
- os: linux
dist: trusty
sudo: required
- os: osx
osx_image: xcode7.3
language: c
before_install:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get -qq update ; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install -y libcunit1-dev ; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then echo -n | openssl s_client -connect scan.coverity.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca- ; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install cunit ; fi
before_script:
- mkdir -p build
- cd build
- cmake -DCMAKE_BUILD_TYPE=Debug ..
script:
- pwd
- make all test
env:
global:
- secure: "4/u+9HdF0FZsQrZ50J+65MtmjdE3iNH1f0p4iY1zapihg03qVJ5S7hNDG1Suhvmk4YJ+WRxR1rimMlErL8Du72r4AfPoxmqnpuBSJJfLn3zYPTSx/jKSdRRKA9sWwaV+Fl+yIKvIn0eLmXBjY7KHtZufvNGEY7vV7rQoDPxiDhj5lDKz91wobMLA3Tw8YcpnvpyNgEkcIkBso6xKyTk/wJMhkZ9OmZFfv1FYHs373pluXH02NIpQqwIeLwG4hXzkkGHfuJvl/iVt72hBXQM02A9woNbst3pm0mg+CPJJpyhCd6Rk4zS/IW/1/Uh2JM/T0Lt/F0Nm0RhN8BCh6/YzETmYIak4lgR2DE/XvW7ban/5JGP7zgol0rFKIszEvieCTuHvqteY/h+xVMUDsmICFCDHBHVgJUgVAMN2aaRAthQ0/LWkYcuiRdZZvzzXpggPOHnPnB1TBPH0l1SNXnutv2TGP5z6P1WoZWv/YHD/CpQD4NB+jIw8vP5PDIrG5o9YMAwX1G5rVrxyowSFzx1PwNr+lDKPsysGKzlzpsev5wxd5lcwRGq9AtcBkAU2Lueq+9DMXRsSNLNkpzcblD6z8beuA81l64Qy/NNAUwNloauJXoeXm8pJmN3/KQB25RK2/7ej2SwCF0RwcWhPtso6rML1uEdB/aXJ4CvWjdc95hI="
addons:
coverity_scan:
project:
name: "hoene/libmysofa"
description: "Build submitted via Travis CI"
notification_email: christian.hoene@symonics.com
build_command: make all
branch_pattern: coverity
libmysofa-0.6/CMakeLists.txt 0000664 0000000 0000000 00000003764 13131134101 0016102 0 ustar 00root root 0000000 0000000 cmake_minimum_required (VERSION 2.8)
project (libmysofa)
INCLUDE(CheckCCompilerFlag)
include(GenerateExportHeader)
option(BUILD_TESTS "Build test programs" ON)
option(BUILD_SHARED_LIBS "Build shared library" ON)
SET(CPACK_PACKAGE_DESCRIPTION "SOFA file reader for better HRTFs")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "This library reads AES SOFA files and normalizes them")
SET(CPACK_PACKAGE_VENDOR "Symonics GmbH")
SET(CPACK_PACKAGE_CONTACT "umlaeute@debian.org")
SET(CPACK_GENERATOR "DEB")
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "IOhannes m zmölnig")
SET(CPACK_PACKAGE_VERSION_MAJOR "0")
SET(CPACK_PACKAGE_VERSION_MINOR "5")
SET(CPACK_PACKAGE_VERSION_PATCH "1")
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "zlib1g")
CHECK_C_COMPILER_FLAG(-Wall C_HAS_WALL)
IF(C_HAS_WALL)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
ENDIF(C_HAS_WALL)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG")
install(FILES share/default.sofa DESTINATION share/libmysofa)
install(FILES share/MIT_KEMAR_normal_pinna.sofa DESTINATION share/libmysofa)
if(BUILD_TESTS)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
include(FindCUnit)
include_directories(${CUNIT_INCLUDE_DIRS})
find_package(CUnit REQUIRED cunit)
enable_testing()
add_test(CIPIC_subject_003_hrir_final ../tests/compare.sh ../tests/CIPIC_subject_003_hrir_final)
add_test(FHK_HRIR_L2354.sofa ../tests/compare.sh ../tests/FHK_HRIR_L2354)
add_test(LISTEN_1002_IRC_1002_C_HRIR.sofa ../tests/compare.sh ../tests/LISTEN_1002_IRC_1002_C_HRIR)
add_test(MIT_KEMAR_large_pinna.sofa ../tests/compare.sh ../tests/MIT_KEMAR_large_pinna)
add_test(Pulse ../tests/compare.sh ../tests/Pulse)
add_test(Tester ../tests/compare.sh ../tests/tester)
add_test(TU-Berlin_QU_KEMAR_anechoic_radius_0.5_1_2_3_m.sofa ../tests/compare.sh ../tests/TU-Berlin_QU_KEMAR_anechoic_radius_0.5_1_2_3_m)
add_test(TU-Berlin_QU_KEMAR_anechoic_radius_0.5m.sofa ../tests/compare.sh ../tests/TU-Berlin_QU_KEMAR_anechoic_radius_0.5m)
endif(BUILD_TESTS)
add_subdirectory(src)
INCLUDE(CPack)
libmysofa-0.6/LICENSE 0000664 0000000 0000000 00000002655 13131134101 0014345 0 ustar 00root root 0000000 0000000 Copyright (c) 2016-2017, Symonics GmbH, Christian Hoene
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
(1) Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
(2) Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
(3)The name of the author may not be used to
endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
libmysofa-0.6/README.md 0000664 0000000 0000000 00000011134 13131134101 0014607 0 ustar 00root root 0000000 0000000 # libmysofa
## Introduction
This is a simple set of C functions to read AES SOFA files, if they contain HRTFs
stored according to the AES69-2015 standard [http://www.aes.org/publications/standards/search.cfm?docID=99].
## Badges
## Compile
Enter following commands
> cd build
> cmake -DCMAKE_BUILD_TYPE=Debug ..
> make all test
If you need an Debian package, call
> cd build && cpack
## Usage
Libmysofa has a few main function calls.
To read a SOFA file call
```
#include
int filter_length;
int err;
struct MYSOFA_EASY *hrtf;
hrtf = mysofa_open("file.sofa", 48000, &filter_length, &err);
if(hrtf==NULL)
return err;
```
To free the HRTF structure, call:
```
mysofa_close(hrtf);
```
If you need HRTF filter for a given coordinate, just call
```
short leftIR[filter_length];
short rightIR[filter_length];
int leftDelay; // unit is samples
int rightDelay; // unit is samples
mysofa_getfilter_short(hrtf, x, y, z, leftIR, rightIR, &leftDelay, &rightDelay);
```
and then delay the audio signal by leftDelay and rightDelay samples and do a FIR filtering with leftIR and rightIR. Alternative, if you are using float values for the filtering, call
```
float leftIR[filter_length]; // [-1. till 1]
float rightIR[filter_length];
float leftDelay; // unit is sec.
float rightDelay; // unit is sec.
mysofa_getfilter_float(hrtf, x, y, z, leftIR, rightIR, &leftDelay, &rightDelay);
```
If you have spherical coordinates but you need Cartesian coordinates, call
```
void mysofa_s2c(float values[3])
```
which phi (azimuth measure counterwise from the X axis), theta (elevation measured up from the x-y plane), and r (distance between listener and source) as parameters in the float array and x,y,z as response in the same array. Similar, call
```
void mysofa_c2s(float values[3])
```
The coordinate system is defined in the SOFA specification and is the same as in the SOFA file. Typically, the x axis vector (1 0 0) is the listening direction. The y axis (0 1 0) is the left side of the listener and z (0 0 1) is upwards.
Sometimes, you want to use multiple SOFA filters or if you have to open a SOFA file multiple times, you may use
```
hrtf1 = mysofa_open_cached("file.sofa", 48000, &filter_length, &err);
hrtf2 = mysofa_open_cached("file.sofa", 48000, &filter_length, &err);
hrtf3 = mysofa_open_cached("file.sofa", 8000, &filter_length, &err);
hrtf3 = mysofa_open_cached("file2.sofa", 8000, &filter_length, &err);
mysofa_close_cached(hrtf1);
mysofa_close_cached(hrtf2);
mysofa_close_cached(hrtf3);
mysofa_close_cached(hrtf4);
...
mysofa_cache_release_all();
```
Then, all HRTFs having the same filename and sampling rate are stored only once in memory.
If your program is using several threads, you must use appropriate synchronisation mechanisms so only a single thread can access the library at a given time.
## OS support
Libmysofa compiles for Linux operating systems, OSX and Windows. By default, each commit is compiled with Travis CI under Ubuntu 14.04 and OSX 7.3 and with AppVeyor for Windows Visual Studio 2015 on a x64 system. In addition, FFmpeg is compiling libmysofa with MinGW under Windows using their own build system.
## References
* Christian Hoene and Piotr Majdak, "HDF5 under the SOFA – A 3D audio case in HDF5 on embedded and mobile devices", HDF Blog, https://www.hdfgroup.org/2017/04/hdf5-under-the-sofa-hdf5-on-embedded-and-mobile-devices/, April 26, 2017.
* Christian Hoene, Isabel C. Patiño Mejía, Alexandru Cacerovschi, "MySofa: Design Your Personal HRTF", Audio Engineering Society
Convention Paper 9764, Presented at the 142nd Convention, May 2017, Berlin, Germany, http://www.aes.org/e-lib/browse.cfm?elib=18640
## Disclaimer
The SOFA files are from https://www.sofaconventions.org/, Piotr Majdak . The K-D tree algorithm is by John Tsiombikas . The resampler is by Jean-Marc Valin. The remaining source code is by Christian Hoene , Symonics GmbH, and available under BSD-3-Clause license. This work has been funded by German Federal Ministry of Education and Research, funding code 01IS14027A.
libmysofa-0.6/build/ 0000775 0000000 0000000 00000000000 13131134101 0014427 5 ustar 00root root 0000000 0000000 libmysofa-0.6/build/.empty 0000664 0000000 0000000 00000000000 13131134101 0015554 0 ustar 00root root 0000000 0000000 libmysofa-0.6/build/project.json 0000664 0000000 0000000 00000000245 13131134101 0016771 0 ustar 00root root 0000000 0000000 {
"dependencies": {
"zlib": "1.2.8.8",
},
"frameworks": {
".NETFramework,Version=v4.0": { }
},
"runtimes": { "win-x64": { } }
}
libmysofa-0.6/cmake/ 0000775 0000000 0000000 00000000000 13131134101 0014410 5 ustar 00root root 0000000 0000000 libmysofa-0.6/cmake/FindCUnit.cmake 0000664 0000000 0000000 00000002470 13131134101 0017240 0 ustar 00root root 0000000 0000000 # - Try to find cunit
# Once done this will define
# CUNIT_FOUND - System has cunit
# CUNIT_INCLUDE_DIRS - The cunit include directories
# CUNIT_LIBRARIES - The libraries needed to use cunit
find_package(PkgConfig QUIET)
pkg_check_modules(PC_CUNIT QUIET cunit)
find_path(CUNIT_INCLUDE_DIR
NAMES CUnit/CUnit.h
HINTS ${PC_CUNIT_INCLUDE_DIRS} C:/projects/cunit/include
)
find_library(CUNIT_LIBRARY
NAMES cunit
HINTS ${PC_CUNIT_LIBRARY_DIRS} C:/projects/cunit/lib/Release-x64
)
if(CUNIT_INCLUDE_DIR)
set(_version_regex "^#define[ \t]+CU_VERSION[ \t]+\"([^\"]+)\".*")
file(STRINGS "${CUNIT_INCLUDE_DIR}/CUnit/CUnit.h"
CUNIT_VERSION REGEX "${_version_regex}")
string(REGEX REPLACE "${_version_regex}" "\\1"
CUNIT_VERSION "${CUNIT_VERSION}")
unset(_version_regex)
endif()
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set CUNIT_FOUND to TRUE
# if all listed variables are TRUE and the requested version matches.
find_package_handle_standard_args(CUnit REQUIRED_VARS
CUNIT_LIBRARY CUNIT_INCLUDE_DIR
VERSION_VAR CUNIT_VERSION)
if(CUNIT_FOUND)
set(CUNIT_LIBRARIES ${CUNIT_LIBRARY})
set(CUNIT_INCLUDE_DIRS ${CUNIT_INCLUDE_DIR})
endif()
mark_as_advanced(CUNIT_INCLUDE_DIR CUNIT_LIBRARY)
libmysofa-0.6/params.json 0000664 0000000 0000000 00000000257 13131134101 0015512 0 ustar 00root root 0000000 0000000 {
"name": "libmysofa",
"tagline": "C functions for reading HRTFs",
"body": "",
"note": "Don't delete this file! It's used internally to help with page regeneration."
} libmysofa-0.6/share/ 0000775 0000000 0000000 00000000000 13131134101 0014432 5 ustar 00root root 0000000 0000000 libmysofa-0.6/share/MIT_KEMAR_normal_pinna.sofa 0000664 0000000 0000000 00004474342 13131134101 0021433 0 ustar 00root root 0000000 0000000 HDF
x 0 BOHDR-+S+S+S+S" [
@ xGvFRHP % ( 9 YBTHD d(p 0nBTHD
d(p
v\FSHD % P x ( p RIBTLF [ - r | % 22| : &