Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
HOWTO: >=skype-4.3 with alsa and minimal pulseaudio
View unanswered posts
View posts from last 24 hours

Goto page 1, 2, 3  Next  
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6747

PostPosted: Sat Aug 09, 2014 8:51 pm    Post subject: HOWTO: >=skype-4.3 with alsa and minimal pulseaudio Reply with quote

Edit: The whole posting is now somewhat obsolete: Just install skype[apulse], and you are done. (Be aware to compile apulse without -fltto.)

If you use >=apulse-0.1.4 you must use the most current >=skype-4.3.0.37-r5 ebuild, because only this provides a wrapper script.

If the default choice of apulse for your output (playback) or input (capture) device is false, put the following data into the ~/.asoundrc (in the home directory of your skype user):
Code:
pcm.!default {
   type asym
   playback.pcm {
      type plug
      slave.pcm "dmix:CARD=X,RATE=48000"
   }
   capture.pcm {
      type plug
      slave.pcm "hw:Y,0"
   }
}

Here, X and Y have to be replaced by the corresponding card number which you see by pressing F6 in "alsamixer". (The above ~/.asoundrc is essentially taken from this helpful thread)

Only if for some reason apulse does not work for you, you have to resort to the following solution.

Here are instruction how to make skype work with alsa, and pulseaudio being used only for skype but not for the rest of your system.

The following instructions are tested on amd64 and on x86 systems.

Of course, the first you have to do is to emerge pulseaudio. This brings already two problems:
  1. If you use amd64 and not the emul-linux-x86-* pacakges, you should enabe USE=abi_x86_32 for pulseaudio. Otherwise, skype will not recognize that pulseaudio is installed. This is a dependency bug which is already reported. (If you use the emul-linux-x86-* packages, it is perhaps not necessary to emerge pulseaudio - I have not tried this setting).
  2. It is absolutely necessary to use the alsa USE-flag in pulseaudio - I was not able to get any sound/micro without that USE-flag.
    Unfortunately, currently this brings a PDEPEND to media-plugins/alsa-plugins[pulseaudio] (until the corresponding bug is fixed).
    It is not necessary to install media-plugins/alsa-plugins, and if you do, you should remove /usr/share/alsa/alsa.conf.d/51-pulseaudio-probe.conf (since otherwise all programs will use pulseaudio for sound output).
With media-sound/pulseaudio-5.0-r2 (it might differ for future versions), I could disable all USE-flags, including the default-enabled ones like X, without losing any functionality concerning skype, with the following exceptions.
  • abi_x86_32: As mentioned above, this is mandatory (unless you use emul-linux-x86-* on an amd64 system)
  • abi_x86_64: This is of course only needed if ARCH=amd64. However, if ARCH=amd64 you have to use this unless you use a customn ebuild; probably only a few files obtained through this USE-flag are actually needed, but I did not research which ones.
  • alsa: As mentioned above, nothing seems to work without this.
  • caps(?): If you have sys-libs/libcap installed anyway, it is probably a good idea to activate this: It seems that pulseaudio is using this only to drop capabilities. If you do not have sys-libs/libcap installed, you can probably omit this, but you will receive some annoing warnings when running skype (the source code shows that these warnings have no other purpose than being annoying).
  • glib(?): I do not suppose that this is really needed, but puslseaudio-5.0-r2 does not compile without this - apparently, this is a bug in the building system, since pulseaudio tries to build the glib-based mainloop anyway (whose compilation fails without this flag).
  • udev: Despite the description claims that this is only needed to autodetect devices (which seems unnecessary if alsa is forced by the description below), I could not get anything to work without this flag.
When I write in the above or subsequent text, that something does not work, I did not only test this with the above minimal flag of USE-flags, but as well with all default flags (and some more like dbus and qt4) enabled.

In contrast to the skype documentation, it is not necessary to install media-sound/pavucontrol, but in error case this might show you conveniently whether pulseaudio can be used and which devices are available (this is how I found that without USE=alsa, no device is recognized). Once everything runs, you can uninstall pavucontrol with its severe dependencies again :D

Once pulseaudio is installed, you need to edit /etc/pulse/default.pa (for some reason, the automatic detection of hardware does not seem to work):
Essentially you have to insert two lines at the end:
/etc/pulse/default.pa wrote:
load-module module-alsa-sink
load-module module-alsa-source
Here, ...-sink is for the output device and ...-source is for the input device.
If you have a special configuration like "pcm.camrec" in your ~/.asoundrc which you want to use, you must specify this as an option, for instance in this example
/etc/pulse/default.pa wrote:
load-module module-alsa-sink
load-module module-alsa-source device=camrec

In theory, it should also be possible to use e.g. "device=hw:1,0" but this does not seem to work.
Whenever you make a change to /etc/pulse/default.pa you should erase the local configuration (with the user starting skype) with
Code:
rm -rf ~/.config/pulse
and restart skype. It seems not necessary to remove ~/.Skype for this purpose.

Error shooting: If everything works, skype should report under "Options / Sound Devices": "PulseAudio server (local)". If it reports instead "virtual" it means that either pulseaudio is not detected or that it could not be started due to a misconfiguration in /etc/pulse/default.pa (or in ~/.config/pulse); in the latter case, the information in the system logs might give a hint what is wrong.

Edits:
1. Added information about USE-flags, pavucontrol, and error shooting.
2. Added information about apulse
3. Added information about wrapper script with >=apulse-1.4
4. Added information that the latter is not needed with >=skype-4.3.0.37-r4[/bug]
5. Added reference to thread where the ~/.apulserc was recommended; remove wrapper script (since some is contained in the skype ebuild now).


Last edited by mv on Mon Dec 29, 2014 10:54 pm; edited 5 times in total
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Sun Aug 10, 2014 9:41 pm    Post subject: Reply with quote

Here's a patch to the pulseaudio ebuild so that re-merging alsa-plugins with USE=pulseaudio isn't necessary (it turns out it never was; the ebuild authors were just sloppy):
Code:
--- a/pulseaudio-5.0-r2.ebuild
+++ b/pulseaudio-5.0-r2.ebuild
@@ -88,8 +88,6 @@
    dev-util/intltool
    >=sys-devel/gettext-0.18.1
 "
-# This is a PDEPEND to avoid a circular dep
-PDEPEND="alsa? ( >=media-plugins/alsa-plugins-1.0.27-r1[pulseaudio] )"
 
 # alsa-utils dep is for the alsasound init.d script (see bug #155707)
 # bluez dep is for the bluetooth init.d script
Back to top
View user's profile Send private message
depontius
Advocate
Advocate


Joined: 05 May 2004
Posts: 3505

PostPosted: Mon Aug 11, 2014 1:16 am    Post subject: Reply with quote

Thanks for the information. I hadn't quite gotten around yet to telling my wife that we were going to lose Skype contact with our daughter in Maine. Really, I was about to give in and install pulseaudio on that one system, just for W.A.F. and Skype. This makes it much more palatable.

In the long run, I'd still like to find some way to build a pa-lookalike that simply passes things down to alsa and dmix, skipping any fancy pa features. Maybe if/when work lets up a bit...
_________________
.sigs waste space and bandwidth
Back to top
View user's profile Send private message
Budoka
l33t
l33t


Joined: 03 Jun 2012
Posts: 777
Location: Tokyo, Japan

PostPosted: Mon Aug 11, 2014 2:08 am    Post subject: Reply with quote

I just installed pulseaudio because I needed it for Skype. Pulled in all sorts of crap I didn't want. Samba, MySQL, etc.

I'll give this a shot but I am just curious why would I not want pulseaudio? What's the downside? Isn't it suppose to be better than ALSA?
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6747

PostPosted: Mon Aug 11, 2014 8:46 am    Post subject: Reply with quote

Budoka wrote:
I just installed pulseaudio because I needed it for Skype. Pulled in all sorts of crap I didn't want. Samba, MySQL, etc.

You should disable some useflags like gnome and gdbm (probably globally). This is really all optional.
Quote:
but I am just curious why would I not want pulseaudio? What's the downside? Isn't it suppose to be better than ALSA?

pulseaudio is a full-blown sound server like esd or phonon. The latter two are practically withdrawn, and there is a reason for it.
Sound servers sit in-between the application and the kernel drivers (by default usually alsa, nowadays), and their main purpose is to eat resources and cause all sort of problems. :wink:
Seriously, if you have a reason to use it (e.g. if you need sound over network, different volume levels for different applications, the ability to switch sound output while programs are running etc) then go ahead and use it. But if you have no such reason, it will just cost resources unnecessarily and cause a lot of headache to get run properly. There are also cases reported where using pulseaudio decreases the audio quality.
Back to top
View user's profile Send private message
Budoka
l33t
l33t


Joined: 03 Jun 2012
Posts: 777
Location: Tokyo, Japan

PostPosted: Tue Aug 12, 2014 4:11 am    Post subject: Reply with quote

mv wrote:
Budoka wrote:
I just installed pulseaudio because I needed it for Skype. Pulled in all sorts of crap I didn't want. Samba, MySQL, etc.

You should disable some useflags like gnome and gdbm (probably globally). This is really all optional.
Quote:
but I am just curious why would I not want pulseaudio? What's the downside? Isn't it suppose to be better than ALSA?

pulseaudio is a full-blown sound server like esd or phonon. The latter two are practically withdrawn, and there is a reason for it.
Sound servers sit in-between the application and the kernel drivers (by default usually alsa, nowadays), and their main purpose is to eat resources and cause all sort of problems. :wink:
Seriously, if you have a reason to use it (e.g. if you need sound over network, different volume levels for different applications, the ability to switch sound output while programs are running etc) then go ahead and use it. But if you have no such reason, it will just cost resources unnecessarily and cause a lot of headache to get run properly. There are also cases reported where using pulseaudio decreases the audio quality.

Thanks for the explanation. I'll probably just get rid of it now that you provided a method to get Skype to work with ALSA.
Back to top
View user's profile Send private message
dmpogo
Advocate
Advocate


Joined: 02 Sep 2004
Posts: 3264
Location: Canada

PostPosted: Tue Aug 12, 2014 10:51 pm    Post subject: Reply with quote

mv, what is this option abi_x86_32 ? I don't see such USE flag, how to enable it ?
Back to top
View user's profile Send private message
dmpogo
Advocate
Advocate


Joined: 02 Sep 2004
Posts: 3264
Location: Canada

PostPosted: Tue Aug 12, 2014 11:09 pm    Post subject: Reply with quote

Hm, following this Howto, I am getting in the log

Aug 12 16:43:33 wheeler pulseaudio[28786]: [pulseaudio] module.c: Failed to load
module "module-alsa-sink" (argument: ""): initialization failed.
Back to top
View user's profile Send private message
YuriyRusinov
Apprentice
Apprentice


Joined: 21 Jul 2004
Posts: 208
Location: Saint-Petersburg, Russia

PostPosted: Wed Aug 13, 2014 3:21 am    Post subject: Reply with quote

Hello !

I have some questions.
1. Is corrected ebuild on portage tree ?
2. USE="abi_x86_32" emerge -vp pulseaudio shows
Quote:

[ebuild R ] media-sound/pulseaudio-5.0-r2 USE="X alsa asyncns caps dbus gdbm glib ipv6 orc qt4 ssl tcpd webrtc-aec -avahi -bluetooth -doc -equalizer -gnome -gtk -jack -libsamplerate -lirc (-neon) (-oss) -realtime (-system-wide) -systemd {-test} -udev -xen" ABI_X86="(64) (-32) (-x32)" 0 kB

which way I have to set this flag ?
3. Sound in my skype with these flags is not work, which way I have to search my errors ?
_________________
Best regards,
Yuriy Rusinov.
Back to top
View user's profile Send private message
shazeal
Apprentice
Apprentice


Joined: 03 May 2006
Posts: 206
Location: New Zealand

PostPosted: Wed Aug 13, 2014 3:25 am    Post subject: Reply with quote

YuriyRusinov wrote:
Hello !

I have some questions.
1. Is corrected ebuild on portage tree ?
2. USE="abi_x86_32" emerge -vp pulseaudio shows
Quote:

[ebuild R ] media-sound/pulseaudio-5.0-r2 USE="X alsa asyncns caps dbus gdbm glib ipv6 orc qt4 ssl tcpd webrtc-aec -avahi -bluetooth -doc -equalizer -gnome -gtk -jack -libsamplerate -lirc (-neon) (-oss) -realtime (-system-wide) -systemd {-test} -udev -xen" ABI_X86="(64) (-32) (-x32)" 0 kB

which way I have to set this flag ?
3. Sound in my skype with these flags is not work, which way I have to search my errors ?


You need "-abi_x86_32" in /etc/portage/profile/use.mask
_________________
CFLAGS="-OmgWTFR1CE --fun-lol-loops --march=asmx86go"
Back to top
View user's profile Send private message
dmpogo
Advocate
Advocate


Joined: 02 Sep 2004
Posts: 3264
Location: Canada

PostPosted: Wed Aug 13, 2014 4:00 am    Post subject: Reply with quote

YuriyRusinov wrote:
Hello !

I have some questions.
1. Is corrected ebuild on portage tree ?
2. USE="abi_x86_32" emerge -vp pulseaudio shows
Quote:

[ebuild R ] media-sound/pulseaudio-5.0-r2 USE="X alsa asyncns caps dbus gdbm glib ipv6 orc qt4 ssl tcpd webrtc-aec -avahi -bluetooth -doc -equalizer -gnome -gtk -jack -libsamplerate -lirc (-neon) (-oss) -realtime (-system-wide) -systemd {-test} -udev -xen" ABI_X86="(64) (-32) (-x32)" 0 kB

which way I have to set this flag ?
3. Sound in my skype with these flags is not work, which way I have to search my errors ?



I found on my installation that I SHOULD NOT include two last lines in /etc/pulse/default for skype to work. However, I have emul libraries, so
did not set abi_x86_32 flag either
Back to top
View user's profile Send private message
YuriyRusinov
Apprentice
Apprentice


Joined: 21 Jul 2004
Posts: 208
Location: Saint-Petersburg, Russia

PostPosted: Wed Aug 13, 2014 10:27 am    Post subject: Reply with quote

And one's more question. Do I have to set abi_x86_32 use flag to emul-libs-* or onto skype and pulseaudio only ?
_________________
Best regards,
Yuriy Rusinov.
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6747

PostPosted: Wed Aug 13, 2014 10:55 am    Post subject: Reply with quote

dmpogo wrote:
Aug 12 16:43:33 wheeler pulseaudio[28786]: [pulseaudio] module.c: Failed to load
module "module-alsa-sink" (argument: ""): initialization failed.

This seems that for some reason pulseaudio cannot connect to your alsa driver. Maybe your default alsa card has not sound output, maybe there is a problem with the library versions. For instance, if you use pulseaudio from emul-x86-soundllibs, do you also have enabled USE=alsa for that package? Maybe these precompiled libraries are not compatible with your alsa version.
But of course, it might also have completely different reasons. I am not a pulseaudio expert, so I cannot help here. Maybe you can get pulseaudio to dump more information why the initialization failed.


Last edited by mv on Wed Aug 13, 2014 11:20 am; edited 1 time in total
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6747

PostPosted: Wed Aug 13, 2014 11:17 am    Post subject: Reply with quote

YuriyRusinov wrote:
And one's more question. Do I have to set abi_x86_32 use flag to emul-libs-* or onto skype and pulseaudio only ?

skype does not have this flag.

Concerning emul-* libs: This is not really related with skype; you should read somewhere else about ABI_X86=32; this is how gentoo is probably supporting 32-bit stuff in some future. Anyway, since the question arose here, I give a brief overview. (All related to this is still considered experimental; this is why the USE-flag is masked and you have to unmask it if you want to be an early tester of this stuff).

I have not tested, but if you set USE=-pulseaudio for emul-linux-x86-soundlibs (and reinstall that package), it will probably remove the pulseaudio binaries so that when you install pulseaudio[abi_x86_32] afterwards you will probably not get a collision.

Alternatively you can set abi_x86_32 on your emul-*. If you do so, this will force you a lot of packages to be installed with abi_x86_32, too. The disadvantage is that this requires testing versions of many of these packages (since earlier versions do not have the abi_x86_32 flag, yet).
The advantage is that the libraries are then taken from your packages (with your useflags) instead of using the precompiled stuff.

Yet a better alternative (this is what I have done): If your emul-* libs are needed only for skype, acroread, and wine, and if you do not have too many USE-flags in wine (e.g. just USE="X alsa custom-cflags gecko jpeg ncurses opengl png threads" works), you can get rid of the emul-* packages entirely (currently with the exception of emul-linux-x86-qtlibs): Just unmerge and mask all other emul-* packages. You still have to set abi_x86_32 on quite a lot of packages (and use some testing versions of some of these packages), but these are much less than if you want a "full" replacement for emul-*.
(It is just a question of time until you can also get rid of emul-linux-x86-qtlibs in the same way; AFAIK, if you use the qt-overlay you already can).

Or, of course, you wait, until all this abi_x86_32 stuff is considered stable and the above is perhaps happening automatically. However, do not expect this to happen very soon.
Back to top
View user's profile Send private message
dmpogo
Advocate
Advocate


Joined: 02 Sep 2004
Posts: 3264
Location: Canada

PostPosted: Wed Aug 13, 2014 7:18 pm    Post subject: Reply with quote

mv wrote:
dmpogo wrote:
Aug 12 16:43:33 wheeler pulseaudio[28786]: [pulseaudio] module.c: Failed to load
module "module-alsa-sink" (argument: ""): initialization failed.

This seems that for some reason pulseaudio cannot connect to your alsa driver. Maybe your default alsa card has not sound output, maybe there is a problem with the library versions. For instance, if you use pulseaudio from emul-x86-soundllibs, do you also have enabled USE=alsa for that package? Maybe these precompiled libraries are not compatible with your alsa version.
But of course, it might also have completely different reasons. I am not a pulseaudio expert, so I cannot help here. Maybe you can get pulseaudio to dump more information why the initialization failed.



Currently I have two setups. On my laptop I have followed your HOWTO without adding module load at the end of default.pa, and everything is working fine.
I have not tried adding explicit load module_alsa_sink.

On my desktop, which I tried first, explicit load module_alsa_sink falis as I described, and pulseaudio is not launched. If I eliminate explicit sink/source lines, as on
desktop, pulseaudio is launched, Skype shows pulseaudio(local) as the source, but there is no sound.
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6747

PostPosted: Thu Aug 14, 2014 12:52 pm    Post subject: Reply with quote

dmpogo wrote:
If I eliminate explicit sink/source lines, as on
desktop, pulseaudio is launched, Skype shows pulseaudio(local) as the source, but there is no sound.

I have made the same experience: pulseaudio should autodetect devices, but it doesn't (even if compiled with more USE-flags). If you install pavucontrol, it will show you probably that you have only virtual devices available for pulseaudio.

You must find out why the module-alsa-sink cannot be initialized...
Back to top
View user's profile Send private message
apiaio
Guru
Guru


Joined: 04 Dec 2008
Posts: 406

PostPosted: Fri Aug 15, 2014 12:05 pm    Post subject: Reply with quote

I followed this tutorial and can hear the sound with skype, but after pulseaudio is started , the front mic is on the zero level. I can set the mic using alsamixer, but restart pulseaudio causes that the level is on the zero again.
Back to top
View user's profile Send private message
YuriyRusinov
Apprentice
Apprentice


Joined: 21 Jul 2004
Posts: 208
Location: Saint-Petersburg, Russia

PostPosted: Mon Aug 18, 2014 7:13 am    Post subject: Reply with quote

Thank you, problem was solved.
_________________
Best regards,
Yuriy Rusinov.
Back to top
View user's profile Send private message
Perfect Gentleman
Veteran
Veteran


Joined: 18 May 2014
Posts: 1245

PostPosted: Wed Sep 10, 2014 10:37 am    Post subject: Reply with quote

i think it's better to uncomment those strings and delete "device=xxx" in sink-string.
Back to top
View user's profile Send private message
v_andal
Guru
Guru


Joined: 26 Aug 2008
Posts: 541
Location: Germany

PostPosted: Thu Sep 11, 2014 7:18 am    Post subject: Reply with quote

How about consolekit? If I'm not mistaken, pulseaudio needs consolekit to work properly.
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6747

PostPosted: Thu Sep 11, 2014 9:25 am    Post subject: Reply with quote

v_andal wrote:
How about consolekit? If I'm not mistaken, pulseaudio needs consolekit to work properly.

I don't know. I use slim without any special configuration about consolekit/logind, and most packages are compiled with USE="systemd -consolekit -pam -policykit". If slim does not do anything magically, I doubt that I get a logind token, but I never checked carefully. Of course, I have neither pam nor the policykit madness installed - it might be that you get problems when you use one of these without a logind token.
Back to top
View user's profile Send private message
v_andal
Guru
Guru


Joined: 26 Aug 2008
Posts: 541
Location: Germany

PostPosted: Thu Sep 11, 2014 12:13 pm    Post subject: Reply with quote

Could be. I have pam installed, but no consolekit. When I've tried to install pulse it didn't want to start daemon.

On 2 other computers I have xfce and that requires consolekit. So, there I didn't do anything special. Just allowed pulse for skype in package.use and did installation. That pulled in pulseaudio. Started skype and everything worked. No other application beside skype knows about pulseaudio. On my computer at work I've removed skype completely because pulseaudio refused to work there :)
Back to top
View user's profile Send private message
franzf
Advocate
Advocate


Joined: 29 Mar 2005
Posts: 4565

PostPosted: Wed Sep 17, 2014 8:45 am    Post subject: Reply with quote

mv wrote:
pulseaudio is a full-blown sound server like esd or phonon.

Probably you mix up phonon with aRTS. While aRTS is a soundserver phonon is not. It's just a library that wraps different audio libs/frameworks, like gstreamer and vlc. Its main purpose is to give the developer an API he's used to from Qt (SIGNAL/SLOT, Properties, naming conventions, ...), and to give the user the possibility to use the backend he likes most/works best for his hardware. As a wrapper it requires some slight overhead, but it really should not matter that much.
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6747

PostPosted: Wed Sep 17, 2014 9:09 am    Post subject: Reply with quote

franzf wrote:
As a wrapper it requires some slight overhead, but it really should not matter that much.

It is certainly not as bad as pulseaudio but as unnecessary: eating resources and possibly causing additional trouble by introducing yet another point of failure.
Back to top
View user's profile Send private message
larophel
n00b
n00b


Joined: 19 Mar 2005
Posts: 54

PostPosted: Mon Sep 29, 2014 3:38 pm    Post subject: Reply with quote

Thank you for this guide.
On my system, it seems Pulseaudio is still messing with non-Skype applications. For example, if I try to listen to a word on dictionary.com, the sound now comes from the device specified by pavucontrol instead of the speakers as before.
Further, I used to be able to toggle mute of the speakers using "amixer set Master toggle". Now, I have to toggle both "Master" and "Headphone". Also, playing sound via HDMI using "mplayer -ao alsa:device=hw=1.7" does not work well after installing pulseaudio.

Is there any way I can restrict Pulseaudio to only run for Skype, or at least only for my USB headset?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Goto page 1, 2, 3  Next
Page 1 of 3

 
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