Hello!
Background of my issue: I have a somewhat old TV which only supports 16 Bit and 20 Bit PCM audi input.
ELD of TV
LibreELEC:~ # cat /proc/asound/card0/eld\#2.0
monitor_present 1
eld_valid 1
monitor_name PHILIPS FTV
connection_type HDMI
eld_version [0x2] CEA-861D or below
edid_version [0x3] CEA-861-B, C or D
manufacture_id 0xc41
product_id 0x0
port_id 0x0
support_hdcp 0
support_ai 1
audio_sync_delay 0
speakers [0x1] FL/FR
sad_count 2
sad0_coding_type [0x1] LPCM
sad0_channels 2
sad0_rates [0xe0] 32000 44100 48000
sad0_bits [0x60000] 16 20
sad1_coding_type [0x2] AC-3
sad1_channels 6
sad1_rates [0xe0] 32000 44100 48000
sad1_max_bitrate 640000
Display More
Unfortunately something is going wrong somewhere and I do not get any audio from my TV in stock configuration. I assume there is a problem with the 20 Bit PCM format for my TV. By default, audio is passed to ALSA in 32 Bit format.
default hw_params
After some tries, i figured out that audio is playing fine from TV if passed as 16 Bit PCM format.
audio working hw_params
Now I am searching for any solution to convert the audi coming from Kodi to 16 Bit PCM format before passed to TV over HDMI. (Any solution welcome)
My approach was to convert die audio stream in the ALSA layer by a plug, so i configured ~/.config/asound.conf as follows (based on the description from alsa-project.org)
pcm_slave.sl3 {
pcm "hw:0,3"
format S16_LE
channels 2
rate 48000
}
pcm.complex_convert {
type plug
slave sl3
}
pcm.!default {
type plug
slave.pcm "complex_convert"
}
Display More
This works as expected at the ALSA layer and now a can play e.g. 24 Bit audio passed to ALSA default device by aplay and hear the sound from my TV.
aplay 24 Bit audio
LibreELEC:~ # aplay -v sample05.wav
Playing WAVE 'sample05.wav' : Signed 24 bit Little Endian in 3bytes, Rate 48000 Hz, Mono
Plug PCM: Route conversion PCM (sformat=S16_LE)
Transformation table:
0 <- 0
1 <- 0
Its setup is:
stream : PLAYBACK
access : RW_INTERLEAVED
format : S24_3LE
subformat : STD
channels : 1
rate : 48000
exact rate : 48000 (48000/1)
msbits : 24
buffer_size : 24000
period_size : 6000
period_time : 125000
tstamp_mode : NONE
tstamp_type : MONOTONIC
period_step : 1
avail_min : 6000
period_event : 0
start_threshold : 24000
stop_threshold : 24000
silence_threshold: 0
silence_size : 0
boundary : 6755399441055744000
Slave: Hardware PCM card 0 'HDA Intel PCH' device 3 subdevice 0
Its setup is:
stream : PLAYBACK
access : MMAP_INTERLEAVED
format : S16_LE
subformat : STD
channels : 2
rate : 48000
exact rate : 48000 (48000/1)
msbits : 16
buffer_size : 24000
period_size : 6000
period_time : 125000
tstamp_mode : NONE
tstamp_type : MONOTONIC
period_step : 1
avail_min : 6000
period_event : 0
start_threshold : 24000
stop_threshold : 24000
silence_threshold: 0
silence_size : 0
boundary : 6755399441055744000
appl_ptr : 0
hw_ptr :
Display More
But in Kodi, the default ALSA device is not updated (still shows analog output and no audio on TV) and the HDMI selection as audio output still uses the 32 Bit format for ALSA. Also, my complex_convert alias (from asound.conf) is not showing as ALSA sink in the Kodi audi selection list.
Is it possible to use the complex_convert ALSA alias as audio sink for Kodi?
Other approach: Kodi selects audio sample format as AE_FMT_S32NE, is there a way to force it to AE_FMT_S16LE?
Any ideas how I can solve my issue?