Configuring Sound on Linux/Pulse Audio/Troubleshooting

This document entails issues you might encounter with PulseAudio.

Verbose error capturing

edit

Wanto to figure out what PulseAudio is doing? Try the following.

 $ pulseaudio -v --log-target=stderr

Errors and solutions

edit

Wrong Sample Freq

edit

Symptom

edit

If you have the sample frequence set wrong you might encounter an error like this when you startup PulseAudio

$ pulseaudio
W: alsa-util.c: Device HDMI doesn't support 44800 Hz, changed to 48000 Hz.

Solution

edit

Explicitly set the rate for the PulseAudio module in /etc/pulse/default.pa.

load-module module-alsa-sink device=HDMI rate=48000

Sound Stops Working

edit

Symptom

edit

You suddenly have no sound afer you wake up your computer or when you plug headphones, but alsamixer show that sound is enabled and volume can be hight.

Solution

edit

Check pacmd command if your sound is not mute:

$ pacmd
Welcome to PulseAudio! Use "help" for usage information.
>>> list-sinks
2 sink(s) available.
    index: 0
	name: <alsa_output.pci-0000_01_05.1.hdmi-stereo>
	driver: <module-alsa-card.c>
	flags: HARDWARE DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
	state: SUSPENDED
	suspend cause: IDLE 
	priority: 9050
	volume: 0: 100% 1: 100%
	        0: 0,00 dB 1: 0,00 dB
	        balance 0,00
	base volume: 100%
	             0,00 dB
	volume steps: 65537
	muted: no

     ...

  * index: 1
	name: <alsa_output.pci-0000_00_14.2.analog-stereo>
	driver: <module-alsa-card.c>
	flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
	state: RUNNING
	suspend cause: 
	priority: 9959
	volume: 0: 100% 1: 100%
	        0: 0,00 dB 1: 0,00 dB
	        balance 0,00
	base volume:  63%
	             -12,00 dB
	volume steps: 65537
	muted: yes

Second sink is mute so we need to unmute it

>>> set-sink-mute 1 false

Additionaly restarting pulseaudio may be needed

$ sudo /etc/init.d/pulseaudio restart

NOTE: If you play video using flash in Browser (like YouTube) you can enable sound but when you exit from pacmd the sound stop and when you try to enter pacmd again to show that pulseaudio is not running in the session, in this case refreshing the page with the video solve the issue.