PulseAudio

From ProAudioOverlay

(Difference between revisions)
Jump to: navigation, search
Line 1: Line 1:
-
对于红彤[http://www.100woman.cn 美容整形]也许大家还不太相信它的神奇,看看韩国好多整过形的美女演员出演的电视剧,整形前是多么地
 
-
 
-
难看,整形后判若两人,大家看到的都是他们[http://www.100woman.cn 整形]后的美丽容颜,那在中国的整形美容行业发展的怎么样呢?我们
 
-
 
-
现在来设想下,如果要是把网络红人“芙蓉姐姐”整形成香港明星李嘉欣,那么结果会怎么样呢?她们两个不同风格的人能整形出来什么效果
 
-
 
-
?芙蓉能整出李嘉欣的形象气质出来吗?
 
-
美容整形在国外一直是很热门的产业,许多面部有缺陷的女孩子经过整形以后能成为耀眼的明星。一些
 
-
 
-
[http://www.100woman.cn/zxxm/rfsx/c01.htm 胸部整形]过女星也能跟美国的艳星乔丹相媲美,演艺事业也蒸蒸日上,导演也亲睐她们,经常
 
-
 
-
给她们抛来橄榄枝。[http://www.100woman.cn/zxmr/10.htm 处女膜修复]手术,还你一个做纯洁女人的机会,
 
-
 
-
[http://www.100woman.cn/zxmr/01.htm 双眼皮手术] 手术,能给那些单眼皮女生一次跨越的机会,一下子跻身双眼皮行列,男生们好象比较
 
-
 
-
流行单眼皮,像Rain!割个双眼皮,轻松;做个双眼皮,方便;[http://www.100woman.cn 光子脱毛],快捷;
 
-
 
-
[http://www.100woman.cn/zxxm/qcyx.htm 清除腋臭],简单;去整形美容医院,给自己一次完美的机会,去雅靓看看,能给你一个意外的惊喜
 
-
 
-
 
-
[http://www.100woman.cn/zxmr/10.htm 处女膜修复]
 
-
[http://www.100woman.cn/zxmr/01.htm 双眼皮手术]
 
-
[http://www.100woman.cn/news/zxmr/20051226155422.htm 光子嫩肤]
 
-
[http://www.100woman.cn/zxxm/qcyx.htm 清除腋臭]
 
-
[http://www.100woman.cn/zxxm/rfsx/c01.htm 胸部整形]
 
This Howto is a translation, a debugging and an adaptation for gento of some parts of the [http://www.linuxmao.org/tikiwiki/tiki-index.php?page=PulseAudio&highlight=pulseaudio PulseAudio] article on the '''Linux MAO''' website. Changes and additional informations from several discussions on #pulseaudio on irc.freenode.org are incorporated.
This Howto is a translation, a debugging and an adaptation for gento of some parts of the [http://www.linuxmao.org/tikiwiki/tiki-index.php?page=PulseAudio&highlight=pulseaudio PulseAudio] article on the '''Linux MAO''' website. Changes and additional informations from several discussions on #pulseaudio on irc.freenode.org are incorporated.

Revision as of 16:18, 1 June 2008

This Howto is a translation, a debugging and an adaptation for gento of some parts of the PulseAudio article on the Linux MAO website. Changes and additional informations from several discussions on #pulseaudio on irc.freenode.org are incorporated.

Contents

Introduction

PulseAudio is a next generation networked sound server. It is running between the applications (or the multimedia frameworks) and the sound driver (ALSA, OSS, or other). He allows an easiness of use with "on the fly" connection capability.

As example, you can send some sounds to the headset output and other sounds to the speaker output.

I will focus on PulseAudio capability to serve like a bridge between professional audio applications using JACK and the audio applications using another sound server like ALSA.

PulseAudio use a sink / source terminology. A sink is a PulseAudio output plugin module and a source is a PulseAudio input module. As example, we can make a chain with the ALSA pulse plugin, module-jack-sink, module-jack-source and the ALSA pulse plugin. This setting will do the following:

ALSA application -> ALSA pulse plugin -> PulseAudio -> JACK -> PulseAudio -> ALSA pulse plugin -> ALSA application.

PulseAudio will take care of all the format and sampling rate conversion. It use high quality conversion algorithms, the price to pay is a somewhat huge processor load.

Requirements

PulseAdio is in portage and emerge will install all the needed dependencies as needed.

PulseAudio use a lot of processor power, so I guess that a high-end box is needed in order to get a stable and low latency setup (if possible, see below).

Installation

Just follow DAW Digital Audio Workstation: PulseAudio.

Configuration

We will setup a 2 channels bridge from alsa output and jack input.

Miscellaneous Setting

PulseAudio come with 3 pulse related groups: pulse-access is for the case when the daemon runs system-wide, so we don't need to be in this group; pulse-rt is for the case when pulseaudio is suid root and you want to use realtime-scheduling. We will remove this suid root permission later, so we don't need to be in this group either.

The pulse group is the group of the user pulse, which run the daemon in system-wide mode. We don't need to belong to that group either.

You must just to be sure that you are into the audio group and that this group have realtime privilege as explained into Realtime (RT) Kernel

JACK

Nothing to do. It's cool! Just run it as usual.

In practice, PulseAudio processor load will be huge, so try to increase jack latency or to use the same sample rate that jackd with your ALSA application (see below the troubleshooting section).

ALSA

You must have the following in your ~/.asoundrc :

pcm.!default {
   type pulse
}
## Not mandatory
ctl!default {
   type pulse
}

PulseAudio

Create the 2 following files:

#~/.pulse/daemon.conf
realtime-scheduling = yes

PulseAudio use a high quality resampling algorithm, so it is no need to specify a default sample rate in ~/.pulse/daemon.conf. However, it is possible to specify which algorithm to use. To get a list of those algorithm:

pulseaudio --dump-resample-methods

In order to get the highest quality, use one of the following: speex-float-10 or src-sinc-best-quality, but be warned that those eat enormous amount of cpu. For that, add something like the following line into ~/.pulse/daemon.conf:

resample-method = speex-float-10

The default is speex-float-3.

# ~/.pulse/default.pa
load-module module-jack-sink channels=2 channel_map=front-left,front-right
#load-module module-jack-source channels=2 channel_map=front-left,front-right
load-module module-native-protocol-unix
## The following is not mandatory
load-module module-volume-restore
load-module module-default-device-restore
load-module module-rescue-streams
.nofail
.ifexists /usr/lib/pulse-0.9/modules//module-x11-publish.so
load-module module-x11-publish
.endif
## The following can conflict with this config.
#.ifexists /usr/lib/pulse-0.9/modules//module-gconf.so
#load-module module-gconf
#.endif
set-default-sink jack_out
set-default-source jack_in

In order to add a bridge between jack output and alsa input, comment out the module-jack-source line in ~/.pulse/default.pa.

Usage and test

Start qjackctl as usual. Be sure that jackd is running.

Start pulseaudio:

pulseaudio

You will get a stereo "PulseAudio JACK Sink" into the Readable Clients of qjackctl's audio connection window (and a "PulseAudio Jack Source" if you commented out the related line in the config).

Let's test it:

aplay "some file.wav"

or

alsaplayer

PulseAudio related programs

If you want to use padevchooser, avahi must be started. As root, run:

/etc/init.d/avahi-daemon start

If you want to start it at boot time:

rc-update add avahi-daemon default

Now, you can start padevchooser (as user):

padevchooser

This will add a systray icon from which you can control PulseAudio, see informations about the running process, and launch the other PulseAudio programs.

Be aware that padevchooser use its own configuration files. That implies that changes made in the configuration can conflict with the settings in ~/.pulse/*. If you get some stability problems, the first thing to do is to stop or kill the audio applications, quit padevchooser, quit pulseaudio, stop and restart jackd, start pulseaudio and start the audio applications (but don't start padevchooser).

Other applications and PulseAudio

For now, just take a look at Perfect Setup.

Troubleshooting

This setting work very well for me.

In case of problem, please keep things simple and be sure that padevchooser is not running. If it is the case, stop it, stop and restart pulse audio. In some cases, it can be necessary to stop jack and restart alsasound ('/etc/init.d/alsasound restart'). Be careful during testing, the whole system can freeze.

If the problem remain, increase jack latency again and again until it disappear.

I was able to get PulseAudio to be 100% stable only with a 42.7 msec jack latency (1024 frames, 48 kHz, 2 periods). That on a P4 @ 2.4 gHz and an Audigy (16 channels setup in jack).

Some ALSA applications can use a defined sample rate instead of the default 44.1 kHz. Example:

alsaplayer -F 48000

This will use a lot less processor power as to let pulseaudio do the resampling, but the best way to go in case of stability problem is to increase jack latency or to choose a less CPU hungry resampling method in pulseaudio.

Links

Greetings

tanuk on #pulseaudio on irc.freenode.org

To Do

  • Add an example with multi-channel configuration.
  • Add an example with client-server configuration.
  • Add examples from different hardware with their performances.

Use the discussion page for any comments or suggestion.

Personal tools