Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] PulseAudio with ALSA sink and ALSA "pulse" plugin
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
c00l.wave
Apprentice
Apprentice


Joined: 24 Aug 2003
Posts: 245

PostPosted: Fri Feb 10, 2012 11:59 am    Post subject: [SOLVED] PulseAudio with ALSA sink and ALSA "pulse" Reply with quote

I know that many don't like PulseAudio but so far it has worked flawless on my system whereas ALSA has not (i had too many applications that kept locking devices exclusively now and then resulting in the wrong sound card being used and no mix being possible).

Until now, I let PulseAudio run on-demand (no daemon) with an ALSA sink:

Code:
load-module module-alsa-sink
load-module module-alsa-source device=hw:1,0
[...]
set-default-sink alsa_card.pci-0000_05_01.0
set-default-source alsa_card.pci-0000_00_1b.0


Since I wanted to get Timidity (which doesn't support PulseAudio) running with DOSBox, I finally tried to route ALSA audio to pulseaudio via the ALSA-plugin "pulse". Also, the different/uncontrollable volumes when mixing PulseAudio and ALSA, like running something in Adobe Flash (ALSA) while playing some MP3 (PulseAudio) drove me mad since I started using PulseAudio. I added the following lines to /etc/asound.conf and restarted /etc/init.d/alsasound:

Code:
pcm.!default {
        type pulse
}

ctl.!default {
        type pulse
}


That worked fine yesterday; any ALSA output showed up as a PulseAudio stream in pavucontrol and played nicely. Timidity didn't even show any lag (like it was reported by many users).

Today, after a nightly shutdown, KDE was slowed to a crawl and many applications didn't even open any more or appeared dead after launch. It took a few moments to realize that I may have routed ALSA and PulseAudio circular. When I removed the lines from /etc/asound.conf, restarted /etc/init.d/alsasound and killed all pulseaudio instances, the system instantly came back to live and started playing sound.

I don't understand this - I am just routing the "default" ALSA device to PulseAudio while PulseAudio should access a specific hardware device (I use two soundcards on my system)? What is causing a circular dependency nevertheless? Maybe I have a wrong understanding of what these config lines do but it looks fine to me.

Does anyone know how to solve this? (sending PulseAudio to OSS sink is not really an option)
_________________
nohup nice -n -20 cp /dev/urandom /dev/null &


Last edited by c00l.wave on Fri Feb 10, 2012 7:15 pm; edited 1 time in total
Back to top
View user's profile Send private message
c00l.wave
Apprentice
Apprentice


Joined: 24 Aug 2003
Posts: 245

PostPosted: Fri Feb 10, 2012 7:14 pm    Post subject: Reply with quote

As so often, I didn't spot the relevant detail:

Code:
load-module module-alsa-sink
load-module module-alsa-source device=hw:1,0


The first line indeed defines the default device as a sink. The second line is actually the input device (source). What I had in my config told PulseAudio do capture from card #1 but play on "default". The correct lines are now:

Code:
load-module module-alsa-sink device=hw:0,0
load-module module-alsa-source device=hw:1,0


(default playback on card #0, default capture on #1)

As a bonus, by changing the default device, I seem to have (again) managed to confuse KDE/Phonon and invalidated the existing application <=> device mappings, meaning that I will have to clear these or reset all application mappings manually. Anyway, what I wanted now works, problem solved. :)
_________________
nohup nice -n -20 cp /dev/urandom /dev/null &
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6474

PostPosted: Fri Feb 10, 2012 7:38 pm    Post subject: Reply with quote

You could try using JACK too; timidity supposedly supports that, and PulseAudio will connect through it automatically if it's running.
Back to top
View user's profile Send private message
katfish
Tux's lil' helper
Tux's lil' helper


Joined: 14 Nov 2011
Posts: 147

PostPosted: Sat Feb 11, 2012 10:36 pm    Post subject: Reply with quote

What can I do to find my snd card under PA?

Alsa works well. Just PA won't (Does it well under ubuntu). Are there any snd-relateted kernel modules i might missing?

Thx ;)
Back to top
View user's profile Send private message
c00l.wave
Apprentice
Apprentice


Joined: 24 Aug 2003
Posts: 245

PostPosted: Sun Feb 12, 2012 12:57 am    Post subject: Reply with quote

katfish wrote:
What can I do to find my snd card under PA?

I would guess that could be a problem with DBus - check that you compiled pulseaudio with dbus use-flag and check that there are no permission errors accessing DBus.

... and please open a new thread if that doesn't solve your problem because it's unlikely many people will find your question in a thread about a completely different issue that has already been marked as solved. ;)
_________________
nohup nice -n -20 cp /dev/urandom /dev/null &
Back to top
View user's profile Send private message
Leio
Developer
Developer


Joined: 27 Feb 2003
Posts: 487
Location: Estonia

PostPosted: Wed Feb 15, 2012 1:34 am    Post subject: Reply with quote

I didn't follow and think of the specific problem, but note that now since very recently with media-plugins/alsa-plugins-1.0.25-r1 it should not be necessary to have a alsa routing configuration of your own.
From the ChangeLog of that revision bump:

Code:
*alsa-plugins-1.0.25-r1 (12 Feb 2012)

  12 Feb 2012; Arun Raghavan
  +files/51-pulseaudio-probe.conf, +alsa-plugins-1.0.25-r1.ebuild,
  +files/pulse-default.conf:
  Add new configuration for autoprobing the presence of PulseAudio and setting
  up the pulse device as default if PA is present. This makes the previous
  pulse.conf and pulse-alsa.conf unnceessary. Also remove now-irrelevant
  alsa-jack blocker.


This should work better than the manual ones, as
1) it should work automatically - ALSA using programs will route through pulseaudio if pulseaudio daemon is running (e.g in GNOME3), and directly to ALSA if you are not using PA;
2) it should treat the default audio device setup better than many commonly used manual .asoundrc configuration snippets.
_________________
GNOME team lead; GStreamer; MIPS/ARM64
Back to top
View user's profile Send private message
PaulBredbury
Watchman
Watchman


Joined: 14 Jul 2005
Posts: 7310

PostPosted: Wed Feb 15, 2012 10:23 am    Post subject: Re: [SOLVED] PulseAudio with ALSA sink and ALSA "pulse& Reply with quote

c00l.wave wrote:
too many applications that kept locking devices exclusively

So fix 'em. No need for pulseaudio.

It's so sad that distros don't just set sane sound-related defaults in apps.
Back to top
View user's profile Send private message
Leio
Developer
Developer


Joined: 27 Feb 2003
Posts: 487
Location: Estonia

PostPosted: Wed Feb 15, 2012 2:37 pm    Post subject: Re: [SOLVED] PulseAudio with ALSA sink and ALSA "pulse& Reply with quote

PaulBredbury wrote:
c00l.wave wrote:
too many applications that kept locking devices exclusively

So fix 'em. No need for pulseaudio.

It's so sad that distros don't just set sane sound-related defaults in apps.


Perhaps there is no need for pulseaudio for the reason you cited from the original poster, but that does not mean there is no need for pulseaudio. Also, ALSA doesn't really do all that non-exclusive. It just has a very hacky dmix device that somewhat solves this. PulseAudio does such mixing a whole lot better. Additionally it supports dynamically sized audio buffers, so that stuff like music can be buffered many seconds ahead, so that the CPU can sleep and save power; it has per-application volume support, seamless support for external soundcard (USB headsets with their own sound chip), easy bluetooth support (USB headphones and headsets, including sending MP3 directly together with GStreamer if hardware decoding is supported in the bluetooth device), network transparency, much better handling of low-latency needs (much betters than with ALSA dmix or esound; but not quite JACK), audio stream profile support (e.g have music automatically paused when a "Call" profile stream starts from your VoIP program) and much much more. Much of its perceived problems going around coming from Ubuntu having integrated it way too early. Today my phone has it, for a very good reason.
But quite likely all this is the topic of a different thread :-D
_________________
GNOME team lead; GStreamer; MIPS/ARM64
Back to top
View user's profile Send private message
PaulBredbury
Watchman
Watchman


Joined: 14 Jul 2005
Posts: 7310

PostPosted: Wed Feb 15, 2012 8:31 pm    Post subject: Re: [SOLVED] PulseAudio with ALSA sink and ALSA "pulse& Reply with quote

Leio wrote:
It just has a very hacky dmix device that somewhat solves this. PulseAudio does such mixing a whole lot better.

How about just improving ALSA's dmix, so that it actually works, and have apps *default* to actually using it properly? Would it actually be better that what I publicize?

After all these years of seeing people have problems with ALSA (and get doubly confused when pulseaudio is thrown into the mix), the best assumption I can come up with is that there's a global conspiracy to make computer audio crap. I'll stop now, before this turns into a huge rant ;)

ALSA could do with a "Don't allow apps to monopolize me" option.
Back to top
View user's profile Send private message
Leio
Developer
Developer


Joined: 27 Feb 2003
Posts: 487
Location: Estonia

PostPosted: Wed Feb 15, 2012 9:37 pm    Post subject: Reply with quote

Sure, the grass could always be greener behind many fences. Meanwhile PulseAudio does that already, alongside some couple dozen more features :)
_________________
GNOME team lead; GStreamer; MIPS/ARM64
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum