[clug] Sound Preferences Hardware Output

Scott Ferguson scott.ferguson.clug at gmail.com
Sun Mar 4 20:36:31 MST 2012

On 05/03/12 12:50, Hal Ashburner wrote:
> Hey CLUG,
> Anyone know the magic I need to make ubu (debian with such nice polish it's
> worth wrecking the major comunity distro for the shiny) 11.10 keep my sound
> preferences between reboots?

um, maybe:-
sudo alsactl store


I've been running (and building and supporting) boxen with PA under
Debian since PA was first release - not had that problem. I have had
ALSA occasionally muted by application updates, and during the upgrade
from Lenny to Squeeze.

> My onboard usb sound card (Cmedia CM6501) basically only works if it's set
> to 7.1 output. (Front L&R speakers don't work at all - don't care much I
> can't be bothered to hack driver, the hardware has always been problematic,
> but basically workable). This means as it resets itself to stereo from 71.
> on each reboot I get no sound. As soon as I open sound preferences and set
> to 7.1 again it works like magic, I just want that setting to stick. (I
> turn this machine on without its monitor to listen to music, and Mrs Hal
> uses the machine to watch movies and dvds of tv series and the very, very,
> ultra-uber-cool Al-Jazeera plugin available on xbmc - which exacerbates
>  the annoyance)

So - you have PA managing your sound system, one of which is ALSA, and
you're using an ALSA mixer.... (it's unclear).

Suggest you:-
install and check you settings with paman

Let me know what your setting in paman are.

> Relevant stuff I've examined:
> in $HOME/.pulse/
> dc2a9c3aebe602c2197a290b00000007-default-sink
> dc2a9c3aebe602c2197a290b00000007-default-source

$ ls -l ~/.pulse

> (where aside, I give thanks for shell globbing and tab completion for that
> horror and wonder how hard it would have been to put the magic number after
> the human readable identifier rather than prepend all files with it - it's
> the little things that attract to you to contributing to a project ... )

To prevent DoSing by other users PA daemon like ESDs daemon was
susceptible to?

All runtime data is kept separate keyed on the individual machine's
unique identifier (this is typically the dbus machine-id
(/var/lib/dbus/machine-id or /etc/machine-id) but if that is not
present, we use the machines hostname) This is why all the files inside
~/.pulse have the weird prefix that is clearly an md5 hash.

> respectively contain
> alsa_output.usb-0d8c_PnP_Audio_Device-00-Device.analog-surround-71
> alsa_output.usb-0d8c_PnP_Audio_Device-00-Device.analog-surround-71.monitor
> this
> c2a9c3aebe602c2197a290b00000007-runtime -> /tmp/pulse-1aeL5jtfh2fq
> is a symlink to nothing...

I believe that's a symlink to "something"...

> ~pulse/
> has no .pulse/ directory

> ~mpd/.pulse
> has no *default-sink or *-default-source
> but the *-runtime simlink IS valid unlike in the logged in users' home dir.
> I can't find anything obvious in /etc/pulse/*
> syslog is full of pulseaudio screeching and grinding as it always is
> anytime pulse is a part of this (any?) system, none of this looks
> interesting to my problem
> sample
> Mar  5 11:16:40 lighthouse pulseaudio[1520]: [pulseaudio] x11wrap.c:
> XOpenDisplay() failed
> Mar  5 11:16:40 lighthouse pulseaudio[1520]: [pulseaudio] module.c: Failed
> to load module "module-x11-publish" (argument: "display=:0"):
> initialization failed.
> ---reboot
> Mar  5 11:37:35 lighthouse pulseaudio[1537]: [pulseaudio] reserve-wrap.c:
> Unable to contact D-Bus session bus:
> org.freedesktop.DBus.Error.NotSupported: Unable to autolaunch a dbus-daemon
> without a $DISPLAY for X11
> ...
> Mar  5 11:37:35 lighthouse pulseaudio[1537]: [pulseaudio] alsa-util.c:
> snd_pcm_hw_params_set_channels(1) failed: Invalid argument
> Mar  5 11:37:35 lighthouse pulseaudio[1537]: [pulseaudio] alsa-util.c:
> Failed to set hardware parameters on plug:hw:0: Invalid argument
> ...
> Mar  5 11:37:36 lighthouse pulseaudio[1534]: [pulseaudio] main.c: Daemon
> startup failed.
> ---reboot
> Mar  5 11:49:19 lighthouse pulseaudio[7742]: [alsa-sink] alsa-sink.c: ALSA
> woke us up to write new data to the device, but there was actually nothing
> to write!
> Mar  5 11:49:19 lighthouse pulseaudio[7742]: [alsa-sink] alsa-sink.c: Most
> likely this is a bug in the ALSA driver 'snd_usb_audio'. Please report this
> issue to
> the ALSA developers.
> Mar  5 11:49:19 lighthouse pulseaudio[7742]: [alsa-sink] alsa-sink.c: We
> were woken up with POLLOUT set -- however a subsequent snd_pcm_avail()
> returned 0 or another value < min_avail.
> sudo alsa force-reload
> seems to make sound work
> and deletes the contents of $HOME/.pulse other than the simlink, which is
> fixed and another ubuntu-runtime added pointing at the same target as
> {magicnumber}-runtime
> Anyone got a better idea than to just go with this? ie add something to
> sudoers such that sudo alsa force-reload is executed on boot via the users'
> crontab
> (Not entirely sure that will work unless a delay is built in to it to make
> sure pulse has done all its clobbering first - building in a delay is just
> eww).

The above are all alsa errors - is your ALSA up-to-date?

I'm guessing (as you don't provide much information) that GNOME is your
desktop environment...??
What, if any, sound packages have you installed? (eg, JACK, Ardour,
Rosegarden, etc)
What, if any changes, have you made to your sound system files?

> Via wikipedia:
> PulseAudio developer Lennart
> Poettering<http://en.wikipedia.org/wiki/Lennart_Poettering> described
> it as "the software that currently breaks your audio"

I believe he said that some years ago, and it was possibly,
(justifiably), aimed at Jeffrey Stedfast's audio ;-p

Keep digging and you'll find Lennart doesn't have nice things to say
about Ubuntu's implementation of PA - which I suspect is what you're

> BUT on the flipside
> Hands up who loves the feature where you (can) automatically discover computers
> on your network and play sound through the discovered machines soundcards
> and speakers? What about combining more than one sound card seamlessly and
> presenting the joined entity to the system?

Per-application volume controls.
An extensible plugin architecture with support for loadable modules.
Compatibility with many popular audio applications.
Support for multiple audio sources and sinks.
Low-latency operation and support for latency measurement.
A zero-copy memory architecture for processor resource efficiency.
Ability to discover other computers using PulseAudio on the local
network and play sound through their speakers directly.
Ability to change which output device an application plays sound through
while the application is playing sound (without the application needing
to support this, and indeed without even being aware that this happened).
A command-line interface with scripting capabilities.
A sound daemon with command line reconfiguration capabilities.
Built-in sample conversion and resampling capabilities.
The ability to combine multiple sound cards into one.
The ability to synchronize multiple playback streams (including across
networks, vms, through X etc).
Bluetooth audio devices with dynamic detection.
The ability to enable system wide equalization.
Support for most Operating Systems (and most many portable devices,
Nokia, Palm, and others).

A fuller list of capabilities.

> Are we paying for this kind
> generalisation or did we get it free?

You paid for Ubuntu? :-)
But seriously - "generalisation"?

> Is it possible that this kind of
> abstraction belongs somewhere else, like, perhaps not at all on the
> overwhelming majority of pulseaudio users' machines? 

I'm one of many happy PA users - though it's true we don't make as much
noise as the vocal conservatives.

> Those that do could,
> you know install something that opens a network socket and sends packets to
> the soundcard if they have that use?

Huh? I'm not sure I understand what you're trying to say there Hal...
Are you implying that the ability to treat a network device as a sound
source/sink *if* you choose, is forced on you by PA - then you
misunderstand "opt-in" (or Ubuntu is more broken than I'd first supposed).

> If I'm missing this, do please give me the heads up.

Where do I start?

> Godfrey Van Der Linden of OSX IOKit & IOAudio fame
> http://www.cse.unsw.edu.au/~cs9242/10/lectures/09-OSXAudio.pdf
> is sometimes less than completely complimentary about linux sound. I argue
> the toss with him (from a position of a certain amount of ignorance, what
> are friends for after all)  And now I'm looking at the above ... Yeah yeah,
> linux deals with every hardware known to man woman and beast where as OSX
> knows what's on board. Not quite true for audio though, given its use in
> recording studios and so on...

OSX get's used in which major recording studios?

Some refs:-

Check for S50alsa-utils:-
find /etc/rc* | grep alsa

Kind regards

More information about the linux mailing list