Kodi Community Forum

Full Version: Delay single channel in analog 7.1 audio output?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi i have an interesting problem with my audio output I was recently gifted some older but high quality home theater gear that I am trying to shoehorn into my system and I have gone a long way in making it work i.e. it is configured for 7.1 and the correct channel does play through the correct speaker but the issue I am having is the audio on the center channel seems to have a delay in reference to the front l/r channels(or the other way around). It is really only noticeable whenever there is spoken dialog but it is bad enough that it makes any dialog impossible to understand. I know this is likely due to some processing that is being done on my receiver (that i cant turn off) and I guess i should explain my setup in greater detail as it is rather complex:

The front l/r speakers are wired three way through a Philips FR951 Prologic receiver.
The rear and side channels are driven by a Crown CTS 4200 4 channel amp.
The sub is an Infinity Tss-1100 with a built in amplifier.
For the center channel I am trying to use the speakers that are built into my DLP TV (Samsung hlt6176sx).

Each one of those devices is connected directly via analog to the integrated audio in my XBMC box and the box itself has an Asrock B75 Pro-M with Intel hd audio and a Realtek ALC892 Codec. As for the software im running a git build of XBMC (172b568) on Arch Linux kernel 3.8.6.

I have read about using LADSPA plugins on single channels in a 5.1 stream to add a low pass to a sub channel but i cant seem to wrap my brain around adapting that example to adding a delay to the center channel. Here is my asoundrc:

Code:
pcm.ladspa_delay {
    type ladspa
    slave.pcm "surround71";
    path "/usr/lib/ladspa";
    slave.channels 8
    plugins {
    0{            
       id 1098 # Identity (Audio) (1098/identity_audio)
           policy duplicate
           input.bindings.0 "Input";
           output.bindings.0 "Output";}
    1{
           label delay_5s
           input.bindings.4 "Input";
           output.bindings.4 "Output"
        input {
            controls [ 0.8 0.3 ]
        }        
    }
    }
}

I am also interested in maybe trying to get jackd working with xbmc so I could just use patchage and jack-rack to handle effect processing on each channel but if I can just get a delay on the center channel i'll be happy.

I hope thats enough info to go on. Please let me know if more is needed.

Thanks!
A.
I used to use XBMC 10.0 with channel delay configured in ALSA using the LADSPA plugin because I have no HT receiver in the audio path to add the necessary delay to the rear speaker signals. After upgrading to XBMC 12.2 that configuration no longer worked and rather than trying to debug the convoluted ALSA setup, I've patched the ALSA output code in XBMC.

This is just a quick and dirty fix, the proper solution would be adding this DSP function to the AudioEngine. That way channel delay would work not only with Linux/ALSA and it'd be possible to apply it to source channels that don't exist in the physical hardware (e.g. the center channel mapped to both front speakers in a 4.0 quad setup), and it'd also work when XBMC is encoding audio into AC3 etc. in software. I'm not familiar with the internals of AudioEngine, however, and figuring out how to interface with it would've taken much longer than creating this simple patch.

Channel delay is configured in the $HOME/.xbmc/alsa-channel-delay.conf file (there's no GUI) by providing a channel number and the delay in microseconds separated by whitespace, one channel per line (see the comment in the patch for an example). Channel delay is automatically disabled for passthrough audio. If the code detects any problem, it disables itself immediately and sends a warning to the XBMC log.

The patch can be donwloaded from here: http://pastebin.com/yvDPBZbm, the code is in the public domain. It works on my system but I haven't tested it extensively, any feedback is welcome.