User:Andy Crowd/sandbox/PulseAudio - premade configuration files

From ArchWiki

Sound applications

GStreamer backend end: phonon-qt4, phonon-qt5, phonon-qt4-gstreamer, phonon-qt4-gstreamer
Advanced sound mixer PulseAudio: pavucontrol.
Tray soundmixer for PulseAudio: pasystray-gitAUR, man page - for hotkeys

Hardware list

Web-camera and microphone

Bus 003 Device 005: ID 046d:082b Logitech, Inc.

Audio sound card

04:01.0 Multimedia audio controller: C-Media Electronics Inc CMI8738/CMI8768 PCI Audio (rev 10)

In OpenBox environment

Sound mixer: Dockapps wmmixerAUR, alsamixer.appAUR.

The system.pa file is without any changes

default.pa

default.pa
.nofail
.fail
load-module module-device-restore
load-module module-stream-restore
load-module module-card-restore
load-module module-augment-properties
load-module module-switch-on-port-available
 
load-module module-alsa-source source_name=input device=hw:2
#load-module module-alsa-sink sink_name=alsa_output.pci-0000_04_01.0.analog-stereo
load-module module-oss device=/dev/dsp sink_name=alsa_output.pci-0000_04_01.0.analog-stereo mmap=1

.ifexists module-esound-protocol-unix.so
load-module module-esound-protocol-unix
.endif

load-module module-native-protocol-unix
load-module module-default-device-restore
load-module module-rescue-streams
load-module module-always-sink
load-module module-intended-roles
#load-module module-suspend-on-idle
.ifexists module-console-kit.so
load-module module-console-kit
.endif
.ifexists module-systemd-login.so
load-module module-systemd-login
.endif
load-module module-position-event-sounds
load-module module-role-cork
load-module module-filter-heuristics
load-module module-filter-apply

Added and replaced ALSA output with OSS

load-module module-oss device=/dev/dsp sink_name=alsa_output.pci-0000_04_01.0.analog-stereo mmap=1
Note:
  • Sound works normally in VMware even if snd_pcm_oss, snd_mixer_oss, snd_seq_oss modules are loaded. And no problems with FlashPlayer. The wmmixer works also good with OSS (alsa-oss) and ALSA, mixers are working on same channes, can mute and unmute each other.
  • It is better to install alsa-oss and load oss modules for output instead of alsa modules for output because with alsa modules loaded for output the exit-idle-time = -1 in the daemon.conf ignored and the daemon going idle and has very hard to came back, only the pavucontrol can bring it back fast and keep until closed or an application playing sound or a volume meter is running.
  • The load-module module-suspend-on-idle line in the default.pa file makes that pulseaudio never unloads modules or going idle if uncommented.

daemon.conf

daemon.conf
daemonize = no
fail = yes
high-priority = yes
nice-level = -11
realtime-scheduling = yes
realtime-priority = 5
allow-module-loading = yes
allow-exit = yes
use-pid-file = yes
system-instance = no
local-server-type = user
cpu-limit = no
enable-shm = yes
flat-volumes = yes
lock-memory = no
exit-idle-time = -1
scache-idle-time = 20
dl-search-path = /usr/lib/pulse-5.0/modules
default-script-file = /etc/pulse/default.pa
load-default-script-file = yes
log-target = auto
log-level = notice
resample-method = auto
enable-remixing = yes
enable-lfe-remixing = no
default-sample-format = s16le
default-sample-rate = 44100
alternate-sample-rate = 48000
default-sample-channels = 2
default-channel-map = front-left,front-right
default-fragments = 4
default-fragment-size-msec = 25
enable-deferred-volume = yes
deferred-volume-safety-margin-usec = 8000
deferred-volume-extra-delay-usec = 0
shm-size-bytes = 0
log-meta = no
log-time = no
log-backtrace = 0
rlimit-fsize = -1
rlimit-data = -1
rlimit-stack = -1
rlimit-core = -1
rlimit-rss = -1
rlimit-as = -1
rlimit-nproc = -1
rlimit-nofile = 256
rlimit-memlock = -1
rlimit-locks = -1
rlimit-sigpending = -1
rlimit-msgqueue = -1
rlimit-nice = 31
rlimit-rtprio = 9
rlimit-rttime = 1000000
Note: The exit-idle-time = -1 option working only if OSS is used load-module module-oss device=/dev/dsp sink_name=alsa_output.pci-0000_04_01.0.analog-stereo mmap=1 instead of the #load-module module-alsa-sink sink_name=alsa_output.pci-0000_04_01.0.analog-stereo in the 'default.pa file.

system.pa

.ifexists module-udev-detect.so
load-module module-udev-detect
.else
load-module module-detect
.endif
.ifexists module-esound-protocol-unix.so
load-module module-esound-protocol-unix
.endif
load-module module-native-protocol-unix
load-module module-stream-restore
load-module module-device-restore
load-module module-default-device-restore
load-module module-rescue-streams
load-module module-always-sink
load-module module-suspend-on-idle
load-module module-position-event-sounds

Fix OSS module load on boot

Fix in case if those configurations will not load modules:

/etc/modprobe.d/snd_pcm_oss.conf
snd_pcm_oss

and

/etc/modprobe.d/snd_pcm_oss.conf
install snd_pcm_oss modprobe -i snd_pcm_oss

modprobe as service - author of solution

custom - my custom version of solution for a better service start up in Arch Linux

Service configuration for systemd

/etc/systemd/system/rc-local.service
[Unit]
Description=/etc/rc.local Compatibility
ConditionPathExists=/usr/bin/snd-rc.local

[Service]
Type=forking
ExecStart=/usr/bin/snd-rc.local start
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99

[Install]
WantedBy=basic.target

modprobe loading module

/usr/bin/snd-rc.local
#!/bin/bash
modprobe snd_pcm_oss

In KDE

Sound mixer widget: kdeplasma-applets-veromix-gitAUR

Other application re-direct to pulse

libao Changed default_driver=alsa to use pulseaudio

/etc/libao.conf
default_driver=pulse
dev=default

mplayer

/etc/mplayer/mplayer.conf
ao=pulse

See also

PulseAudio modules - Documentation

man pages - better description about files, commands and more