A simple Head-Related Transfer Function demo made in Kotlin that allows you to hear sounds with direction and elevation just using stereo headphones.
- Frequency scaling based on the following variables: frequency, which ear, azimuth, and elevation.
- Distance-based attenuation following the inverse square law.
- Interaural time differences to simulate the speed of sound.
- Maximum of 1024 sample latency (about 22ms excluding any OS delays).
- Can process frequencies of up to 22050 Hz.
- SOFA file support for HRTF decoding.
- Wave and MP3 file support for audio testing.
- Download this JAR (from the latest release) and run the following command in the folder it's in:
java -jar HRTF.jar
- Select a SOFA file (see this repo's test-resources/HRTF folder or this database for examples).
- Select an audio file (see this repo's test-resources folder for examples).
- Press Run Demo and listen with headphones!
- NetCDF Java for decoding the SOFA files.
- Badlogic Audio Analysis for the Fast Fourier Transform implementation in Java.