GStreamer Stereo LADSPA Plugin home page

Background

Windows 7 has built-in DSP capabilities in its audio stack. I'm working to provide something similar to Linux. Typical effects are dynamic range compression (for listening to music in a noisy environment) and headphone filtering (for providing virtual room echoes and thus making audio meant for real room playback more palatable in headphones).

I have designed a simple headphone filter, which I'm proposing as an addition to the Linux desktop. It is based on adding processed version of the audio meant for the other ear to the signal reaching the other ear. The algorithm is similar, but not identical, to the one implemented in bs2b.

The effect is presented as a stereo LADSPA plugin (meaning it exposes 2 input and 2 output ports).

How is the algorithm different from bs2b's?

Bs2b is a digital realization of an analog circuit which applies a low-pass filter to produce interaural level difference and interaural phase difference (time delay) simultaneously, and then adds the audio data thus processed between the channels. The brain uses the time delay to estimate location for low frequency information (less than 1 kHz, approximately) and the level difference for high frequency information.

Because this process tends to boost correlated signals, a highboost filter is added to compensate. The bs2b process is therefore simply out_l = highboost(in_l) + lowpass(in_r) for the left channel.

My version did away with the highboost filter by estimating a center channel based on typical equal power mix ratio of 1.0 for audio for left channel and 0.7 for center channel. Therefore it is possible to reduce the strength of the localization filter for mono music and boost it for surround music by simply estimating the center channel as (left + right) * 0.2. (A dynamically adjusted coefficient could be used to estimate the presence of centered audio more precisely.)

The process I ended up with is simply: out_l = in_l + lowpass(in_r - center). In addition to this, I added some reverb to move the sounds a bit further away from the head. (Tuning the reverb is still not done.)

Sounds good, how do I try it out?

  1. Download and build the LADSPA plugin. Copy the hpfilter.so to /usr/lib/ladspa when done.
  2. Use the gstreamer snippet to launch the audio processing. (gstladspa plugin is in the "bad" package.)

It's also possible to use ecasound to apply the filter to an arbitrary wav file, by doing something like ecasound -i in.wav -o out.wav -el:hp.

Result

Artist Track Original Processed Comment
Dream Theater The Mirror Original Processed Noisy metal.
I Monster The Blue Wrath Original Processed Mono.
Illumination Black Sun Original Processed Some panning effects.
Metallica Eye of the Beholder Original Processed Flanging becomes apparent.
Pain of Salvation Iter Impius Original Processed Panned sounds become palatable.
Roger Waters Amused to Death Original Processed QSound.
Shpongle My Head Feels Like a Frisbee Original Processed Noisy techno.
Leonard Cohen Waiting for the Miracle Original Processed Mono vocals, stereo drums.
UFO Waltz (le Serpent Rouge) Original Processed Strong stereo separation.

Contact

alankila@bel.fi