automate/020_ladspa.sh

93 lines
2.5 KiB
Bash

# https://www.runeaudio.com/forum/crossfeed-playback-for-more-realistic-headphone-audio-t2878.html#p9950
sudo apt-get install bs2b-ladspa
# This is what I add to /etc/mpd.conf
cat <<EOF | sudo tee -a /etc/mpd.conf >/dev/null
audio_output {
type "alsa"
name "ALSA default"
device "hw:0,0"
dsd_usb "yes"
}
#
audio_output {
type "alsa"
name "ALSA crossfeed"
device "crossfeed"
dsd_usb "yes"
}
EOF
# And this is the /etc/asound.conf
cat <<EOF | sudo tee -a /etc/asound.conf >/dev/null
pcm.!default "crossfeed"
ctl.!default "crossfeed"
pcm.soundcard { type hw; card 0; device 0; }
pcm.plugSoundcard { type plug; slave.pcm "soundcard"; }
pcm.bs2b {
type ladspa
slave.pcm "plugSoundcard"
path "/usr/lib/ladspa" #path under arch linux will be an other ?
playback_plugins [ {
label bs2b
input {
controls [650 9.5]
}
} ]
}
pcm.crossfeed { type plug; slave.pcm "bs2b"; }
ctl.crossfeed { type hw; card 0; }
EOF
# parameters in "controls [x x]" can be changed.
# Here are some configurations of HZ and dB for Crossfeed:
# source: http://bs2b.sourceforge.net/
# These results shows a three versions with different sets of cut-off frequency
# and crossfeed level:
# 1) 700 Hz, 4.5 dB - default.
# This setting is closest to the virtual speaker placement with azimuth 30
# degrees and the removal of about 3 meters, while listening by headphones.
# 2) 700 Hz, 6 dB - most popular.
# This setting is close to the parameters of a Chu Moy's [3] crossfeeder.
# 3) 650 Hz, 9.5 dB - making the smallest changes in the original signal
# only for relaxing listening by headphones.
# This setting is close to the parameters of a crossfeeder implemented in Jan Meier's [4] CORDA amplifiers.
# Change of output is possible with:
# mpc disable 1
# mpc enable 2
# output of "aplay -L"
# null
# Discard all samples (playback) or generate zero samples (capture)
# plugSoundcard
# bs2b
# crossfeed
# sysdefault:CARD=sndrpihifiberry
# snd_rpi_hifiberry_dac,
# Default Audio Device
# dmix:CARD=sndrpihifiberry,DEV=0
# snd_rpi_hifiberry_dac,
# Direct sample mixing device
# dsnoop:CARD=sndrpihifiberry,DEV=0
# snd_rpi_hifiberry_dac,
# Direct sample snooping device
# hw:CARD=sndrpihifiberry,DEV=0
# snd_rpi_hifiberry_dac,
# Direct hardware device without any conversions
# plughw:CARD=sndrpihifiberry,DEV=0
# snd_rpi_hifiberry_dac,
# Hardware device with all software conversions
# Interesting is "top":
# crossfeed disabled 12%
# crossfeed enabled 19%