ALSA configuration

I’ve ask AI: split stereo channels at 80 Hz in ALSA so that the front channels play frequencies from 80 Hz and up and the rear channels play frequencies 80 Hz and below (creating a 4.0 configuration) and output audio over HDMI and get answer modify /etc/asound.conf, whitch not exits. Where I would like configure next lines:

High-pass filter (80 Hz and up) for front channels

pcm.highpass80 {
type ladspa
slave.pcm “hw:0,0” # Replace with your HDMI device if necessary
path “/usr/lib/ladspa”
plugins [
{
label “highpass_1”
input {
controls [80]
}
}
]
}

Low-pass filter (80 Hz and below) for rear channels

pcm.lowpass80 {
type ladspa
slave.pcm “hw:0,0” # Replace with your HDMI device if necessary
path “/usr/lib/ladspa”
plugins [
{
label “lowpass_1”
input {
controls [80]
}
}
]
}

Define 4.0 virtual device

pcm.split4ch {
type plug
slave.pcm {
type multi
slaves.a.pcm “highpass80”
slaves.b.pcm “lowpass80”
slaves.a.channels 2
slaves.b.channels 2
bindings.0.slave a
bindings.0.channel 0
bindings.1.slave a
bindings.1.channel 1
bindings.2.slave b
bindings.2.channel 0
bindings.3.slave b
bindings.3.channel 1
}
}

Default to use split4ch configuration

pcm.!default {
type plug
slave.pcm “split4ch”
}

@Vidas59:

Alternatively, the ArchWiki page: <Advanced Linux Sound Architecture>

And, the ALSA man pages –

> apropos alsa

I didn’t get it with ALSA.

Then I converted stereo wav’s to 5.1.

AUDIO=“5.1.flac”
TMP=“/home/vidas/tmp/”

MAKE_MULTI () { # INP OUT
SUB=“80”; BOOST=“20”; CUT=“30”; DB=“+6”
sox “$1” -c 1 -r 44100 -b 16 "$TMP"0.wav lowpass -2 $SUB remix 1
sox "$TMP"0.wav "$TMP"BL.wav highpass “$CUT” equalizer “$BOOST” 1q “$DB”
sox “$1” -c 1 -r 44100 -b 16 "$TMP"0.wav lowpass -2 $SUB remix 2
sox "$TMP"0.wav "$TMP"BR.wav highpass “$CUT” equalizer “$BOOST” 1q “$DB”
sox -M "$TMP"BL.wav "$TMP"BR.wav -c 1 -r 44100 -b 16 "$TMP"LFE.wav remix -m 1v0.5 2v0.5

sox “$1” -c 1 -r 44100 -b 16 "$TMP"L.wav highpass -2 $SUB remix 1
sox “$1” -c 1 -r 44100 -b 16 "$TMP"R.wav highpass -2 $SUB remix 2
sox -M "$TMP"L.wav "$TMP"R.wav -c 1 -r 44100 -b 16 "$TMP"CE.wav remix -m 1v0.5 2v0.5

case “${AUDIO:0:1}” in
5) sox -M "$TMP"L.wav "$TMP"R.wav "$TMP"CE.wav "$TMP"LFE.wav "$TMP"BL.wav "$TMP"BR.wav “${TMP}5.1.wav”
;;
*) echo “Parameter AUDIO not valid: $AUDIO”; exit ####################################
;;
esac

case “${2: -4}” in
flac) txt=“${2##/}“; txt=”${txt%.}”

bad support echo “$2”; flac -f -s --best --channel-map=none --tag=“TITLE=${txt##-}" --tag="ARTIST=${txt%%-}” “$TMP${AUDIO:0:3}.wav” -o “$2”

    option=""
    if [ "${AUDIO:0:3}" = "5.1" ]; then
      option=" -metadata:s:a WAVEFORMATEXTENSIBLE_CHANNEL_MASK=0x0000003F "
    fi
    ffmpeg -y -hide_banner -i "$TMP${AUDIO:0:3}.wav" -c:a flac -sample_fmt s16 -channel_layout "${AUDIO:0:3}" $option -metadata title="${txt##*-}" -metadata artist="${txt%%-*}" "$2"
    ;;

*) echo “Parameter AUDIO not valid: $AUDIO”; exit #################################
;;
esac
}

The receiver played flac’s from USB as stereo. Only the HDMI computer-receiver worked:
mpv --audio-channels=5.1 --ao=alsa --audio-device=alsa/hw:0,3 *.flac

I configured 2 files for this:

/etc/pulse/daemon.conf
enable-remixing = no
remixing-use-all-sink-channels = no
default-sample-channels = 6
default-channel-map = front-left,front-right,front-center,lfe,rear-left,rear-right

/etc/pulse/default.pa
load-module module-udev-detect channels=6

I don’t know how optimal it is, but the receiver plays 5.1. My player Midnight commander. F2 menu on flac plays all or selected…