Imagine being able to pinpoint the exact direction of a sound with just your headphones on. This is the magic of 3D hearing, a skill our brain learns to interpret the direction of a sound based on various clues such as inter-ear timing differences, inter-ear volume differences, frequency envelopes, and reflections. It’s a fascinating psychological trick that our brain performs, and with Hajo’s headphone enhancer product, this trick can be manipulated to create an immersive audio experience.
Hajo’s headphone enhancer product simulates these sound attributes, tricking your brain into believing that the sound is coming from a specific direction. This technology can make it possible to experience 5.1 surround sound or even full 3D audio over regular headphones. The process involves three key parts: coding, mathematics, and acoustics. In the coding phase, the OS X audio stream is modified in real-time. This requires creating a sound card kernel driver, which is easier in practice than it sounds.
The driver copies the output samples that OS X wants to play through your sound card into a temporary buffer. This buffer is then copied into a sample buffer that your app can access through the OS X audio system. The mathematics part involves the use of FIR (Finite Impulse Response) filtering. FIR filters are a set of coefficients that are applied to every sample in the incoming audio stream. These filters can simulate delay, volume changes, frequency envelopes, and reflections, creating a more immersive audio experience. The acoustics part involves designing FIR filters for surround sound simulation on headphones with bass boost.
This involves creating a basic FIR filter that sounds somewhat muzzled while being limited in time. The off-ear channel is made to sound more muzzled because the direct sound signal that reaches the right ear from a left speaker has probably passed through the listener’s head and/or been reflected around in the room. To enhance the bass, a lowpass filter is applied to the LFE (Low Frequency Effects) channel. The FIR filters are then combined with the bass boost equalizer by convolving the impulse responses. The final step involves the application of the FIR filter to the input signal.
This is done through a process called blocked FFT convolution. The audio chunk is FFT-transformed, multiplied with the FFT-transformation-result of the FIR filter coefficients, and then the inverse FFT transformation is applied to the audio chunk. In conclusion, the creation of a surround sound simulation app for OS X involves a blend of technical, acoustical, and mathematical approaches. It requires a bit of trial and error to guess volume, delay, frequency, and reflection settings that “sound natural”, but the end result is an immersive audio experience that can be enjoyed with just a pair of headphones. hajo.me