I managed to get an almost perfect setup of pulseaudio and skype.
For those of you who might be thinking "oh god not another.." stop wasting your time reading this, and go do something fun, it's make you feel better and maybe less cranky
Although I am still missing a couple of minor details, things more or less work fine for me, so I thought I might help someone by sharing the details.
Please, see if this configuration works for you and/or comment on what you think might be a better setup.
This is what I've got:
- Music/Movies/Youtube/other_general_default_audio uses pulseaudio directly or pulseaudio via alsa and goes to a receiver via spdif and ultimately a set of decently large speakers.
- Skype uses the same big speakers hooked up to a receiver via alsa's pulse plugin for ringing.
- Skype uses an analog headset plugged into soundcard's analog output and analog microphone input for conversations (output via alsa's pulse).
- Pulseaudio mixer can be used to move the skype conversation between large speakers and headset, mimicing the "speaker-phone" button functionality.
- AC3/DTS passthrough works with pasuspender wrappers, for movie surround sound, but makes Skype and some other audio temporarily unusable.
This is what I'm working on:
- microphone sharing .. I thought about setting either an alsa dsnoop device to share recording between pulseaudio and skype or just make skype use pulse_microphone device).
- while watching hd video (using passthrough), I'd really like if an incoming skype call could pause video (or save position/stop) and ring (I'm not sure whether this might be feasible via skype API, I need to look into that).
- enhance the "speaker-phone" functionality so that I could take the call either on my eeepc or on my desktop, but when I take the call on my eeepc, I should be able to transfer the audio via network to my desktop speakers
- reducing the number of error and useless information messages everywhere by fixing the problems that are the reason for those occuring
Tests
I have tested the latest current configuration on 2 machines so far, my main desktop and a friends weak laptop, with varying results.
- Main Desktop: Desktop, Core i7 920 (8 cores), Ubuntu 9.04 Jaunty amd64, works fine, a few cracks while playing loading sound sometimes, due to pulseaudio loading at the same time.
- Weak Laptop: Laptop, Celeron M 1.6GHz (1 core), Ubuntu 9.04 Jaunty x86, skype was crashing and hanging with 100% cpu usage until I guessed the right "model" parameter that I needed to pass to snd-hda-intel.
- eeePc: Weak Netbook, 630 MHz Celeron, used to work fine with an old ubuntu 8.04, and an old config, a while ago, I remember it used quite a lot of cpu, but it probably has a couple of weeks of linux+pulseaudio skypetime on it, needs reinstall ... I'll post results later.
Versions
I used skype from medibuntu repositories, and all the latest universe, multiverse, proposed, backports, and security packages as of 2009-07-22
In case you don't use Ubuntu those versions are
skype 2.0.0.72-0medibuntu4kernel version I'm using is
pulseaudio 1:0.9.14-0ubuntu20.2
alsa-base 1.0.18.dfsg-1ubuntu8
alsa-utils 1.0.18-1ubuntu11
Linux hostname 2.6.28-14-generic #46-Ubuntu SMP Wed Jul 8 07:41:18 UTC 2009 x86_64 GNU/Linux
but they might contain distribution specific patches, and I wouldn't know much about those at this time, if you test on another distro, please let me know which package versions you used.
When testing, please make sure to killall pulseaudio, restart skype, check alsamixer and pulseaudio mixer settings (volume, mute, default device) regularly.
Config Files
These are probably distribution specific, and highly dependant on the setup, some of it is related to work-in-progress, things I still need to set-up.
In case you only have or only want to use a single output, like, for example, on a laptop with just the built-in speakers and a plain 3.5mm headset plug, these configuration files should still work for you, but they might work better (have fewer warning/notice/error messages) if you remove the digital and passtrough/hd related stuff.
/etc/pulse/default.pa
CODE
#!/usr/bin/pulseaudio -nF
load-module module-device-restore
load-module module-stream-restore
load-module module-default-device-restore
load-module module-rescue-streams
load-module module-alsa-sink device=analog_out sink_name=analog
load-module module-alsa-sink device=iec958 sink_name=digital
#load-module module-alsa-source device=microphone source_name=microphone
load-module module-null-sink
load-module module-native-protocol-unix
load-module module-device-restore
load-module module-stream-restore
load-module module-default-device-restore
load-module module-rescue-streams
load-module module-alsa-sink device=analog_out sink_name=analog
load-module module-alsa-sink device=iec958 sink_name=digital
#load-module module-alsa-source device=microphone source_name=microphone
load-module module-null-sink
load-module module-native-protocol-unix
~/.asoundrc
CODE
##
# Use pulseaudio and it's defaults by default
pcm.!default {
type pulse
}
ctl.!default {
type pulse
}
##
# pulseaudio targets
pcm.pulse {
type pulse
}
ctl.pulse {
type pulse
}
pcm.pulse_digital {
type pulse
device "digital"
}
pcm.pulse_analog {
type pulse
device "analog"
}
##
# digital and analog hardware targets
pcm.digital_out {
type softvol
slave.pcm "digital_coax"
control {
name "Master"
card 0
}
}
ctl.digital_out {
type hw
card 0
}
pcm.digital_coax {
type plug
slave.pcm "iec958"
}
pcm.analog_out {
type hw
card 0
device 0
}
ctl.analog_out {
type hw
card 0
}
##
# Inputs
pcm.pulse_microphone {
type pulse
device "microphone"
}
ctl.pulse_microphone {
type pulse
device "microphone"
}
pcm.microphone {
type hw
card 0
}
ctl.microphone {
type hw
card 0
}
# Use pulseaudio and it's defaults by default
pcm.!default {
type pulse
}
ctl.!default {
type pulse
}
##
# pulseaudio targets
pcm.pulse {
type pulse
}
ctl.pulse {
type pulse
}
pcm.pulse_digital {
type pulse
device "digital"
}
pcm.pulse_analog {
type pulse
device "analog"
}
##
# digital and analog hardware targets
pcm.digital_out {
type softvol
slave.pcm "digital_coax"
control {
name "Master"
card 0
}
}
ctl.digital_out {
type hw
card 0
}
pcm.digital_coax {
type plug
slave.pcm "iec958"
}
pcm.analog_out {
type hw
card 0
device 0
}
ctl.analog_out {
type hw
card 0
}
##
# Inputs
pcm.pulse_microphone {
type pulse
device "microphone"
}
ctl.pulse_microphone {
type pulse
device "microphone"
}
pcm.microphone {
type hw
card 0
}
ctl.microphone {
type hw
card 0
}
/etc/pulse/daemon.conf
CODE
high-priority = yes
nice-level = -11
realtime-scheduling = yes
realtime-priority = 5
; Enable if you have cycles to waste;)
; resample-method = src-sinc-best-quality
rlimit-rtprio = 9
default-fragments = 8
default-fragment-size-msec = 5
nice-level = -11
realtime-scheduling = yes
realtime-priority = 5
; Enable if you have cycles to waste;)
; resample-method = src-sinc-best-quality
rlimit-rtprio = 9
default-fragments = 8
default-fragment-size-msec = 5
/etc/security/limits.conf (note: you probably need to logout/login for this to take effect)
CODE
@pulse-rt hard rtprio 15
@pulse-rt soft rtprio 10
@pulse-rt soft rtprio 10
pulse-rt and pulse-access groups, I made myself a member of those by executing the following and logging out, and the logging back in:
CODE
user@host:~$ sudo gpasswd -a `whoami` pulse-rt
user@host:~$ sudo gpasswd -a `whoami` pulse-access
user@host:~$ sudo gpasswd -a `whoami` pulse-access
Skype audio options
Click to view attachment
mplayer.hd is a wrapper script I use to watch HD movies with surround sound, it also has options related to hardware decoding via my nvidia graphics adapter.
CODE
#!/bin/bash
##
# Use: mplayer.hd myveryveryhdmovie.mkv #and all the other mplayer options
pasuspender -- mplayer \
-fs \
-subcp utf8 \
-ac hwdts,hwac3, -ao alsa:device=spdif \
-vc ffh264vdpau,ffhvc1vdpau, -vo vdpau \
"$@"
##
# Use: mplayer.hd myveryveryhdmovie.mkv #and all the other mplayer options
pasuspender -- mplayer \
-fs \
-subcp utf8 \
-ac hwdts,hwac3, -ao alsa:device=spdif \
-vc ffh264vdpau,ffhvc1vdpau, -vo vdpau \
"$@"
Sorry about the blog like long post, I don't maintain a blog, and this seemed like an appropriate place for information of this nature, even though it has the least to do with skype, it has a lot to do with how to make it coexist on linux.
Looking forward to hearing your experiences and ideas, happy Skypeing.