]> code.delx.au - pulseaudio/blob - doc/FAQ.html.in
update README for 0.9.0
[pulseaudio] / doc / FAQ.html.in
1 <?xml version="1.0" encoding="iso-8859-1"?> <!-- -*-html-helper-*- -->
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
4 <head>
5 <title>polypaudio: FAQ</title>
6 <link rel="stylesheet" type="text/css" href="style.css" />
7 </head>
8
9 <body>
10
11
12 <h1>Frequently Asked Questions</h1>
13
14 <ol>
15 <li><p><b>How does Polypaudio compare with ESOUND/aRts/NAS?</b></p>
16
17 <p>Polypaudio is sound daemon similar to ESOUND and NAS, but much more
18 powerful. aRts is a realtime-synthesizer-cum-sound-server, i.e. it
19 does much more than Polypaudio. However, I believe that Polypaudio
20 does what it does much better than any other free sound server.</p>
21 </li>
22
23 <li><p><b>What about ESOUND compatibility?</b></p>
24 <p>Polypaudio is a drop in replacement for ESOUND. That means: you can
25 load a esound compatibility module which implements an ESOUND
26 compatible protocol which allows you to use most of the classic ESOUND
27 compatible programs (including the command line programs like
28 <tt>esdcat</tt>).</p>
29 </li>
30
31 <li><p><b>Is Polypaudio a GNOME program?</b></p>
32 <p>No, Polypaudio has no dependency on GNOME/GTK/GLIB. All it requires
33 is a UNIX-like operating system and very few dependency
34 libraries. However, the accompanying GUI tools are writen with
35 gtkmm, i.e. require both GLIB and GTK.</p></li>
36
37 <li><p><b>Can I integrate Polypaudio in my GLIB/GTK/GNOME application?</b></p>
38 <p>Yes! Polypaudio comes with a GLIB main loop adapter. You can embed
39 both the client library and the daemon (!) into your GLIB based
40 application.</p></li>
41
42 <li><p><b>Can I integrate Polypaudio in my Qt/KDE application?</b></p>
43 <p>Yes! Polypaudio uses a main loop abstraction layer that allows you
44 to integrate Polypaudio in any program that supports main
45 loops. Unfortunately there is no adapter for Qt publicly available yet.</p></li>
46
47 <li><p><b>I want to write a new driver for Polypaudio, are there any docs?</b></p>
48 <p>Currently, only the client API is documented with doxygen. Read
49 the source and base your work on a simple module like
50 <tt>module-pipe-sink</tt>.</p></li>
51
52 <li><p><b>What about compatibility with NAS?</b></p>
53 <p>Is not available (yet?). It is doable, but noone has implemented it yet.</p></li>
54
55 <li><p><b>What about compatibility with aRts?</b></p>
56 <p>Is not available. Since aRts is as synthesizer application you'd have to
57 reimplement very much code for Polypaudio. It should be easy to
58 implement limited support for <tt>libartsc</tt> based
59 applications. Noone has done this yet. It is probably a better idea to
60 run <tt>arts</tt> on top of Polypaudio (through a polypaudio driver
61 for aRts, which nobody has written yet). Another solution would be to
62 embed Polypaudio in the aRts process.</p></li>
63
64 <li><p><b>I often hear noises when playing back with Polypaudio, what can I do?</b></p>
65 <p>There are to possible solutions: run polypaudio with argument
66 <tt>--high-priority=1</tt> and make yourself member of the group
67 <tt>realtime</tt>, or increase the fragment sizes of the audio
68 drivers. The former will allow Polypaudio to activate
69 <tt>SCHED_FIFO</tt> high priority scheduling (root rights are dropped
70 immediately after this). Keep in mind that this is a potential security hole!</p></li>
71
72 <li><p><b>The <tt>polypaudio</tt> executable is installed SUID root by default. Why this? Isn't this a potential security hole?</b></p>
73
74 <p>Polypaudio activates <tt>SCHED_FIFO</tt> scheduling if the user
75 passes <tt>--high-priority=1</tt>. This will only succeed when
76 executed as root, therefore the binary is marked SUID root by
77 default. Yes, this is a potential security hole. However, polypaudio
78 tries its best to minimize the security threat: immediately after
79 startup polypaudio drops all capabilities except
80 <tt>CAP_SYS_NICE</tt> (At least on systems that support it, like Linux; see <tt>man 7
81 capabilities</tt> for more information). If the calling user is not a
82 member of the group <tt>realtime</tt> (which is required to have a GID
83 < 1000), root rights are dropped immediately. This means, you can
84 install polypaudio SUID root, but only a subset of your users (the
85 members of the group <tt>realtime</tt>) may make use of realtime
86 scheduling. Keep in mind that these users might load their own binary
87 modules into the polypaudio daemon which may freeze the machine. The
88 daemon has a minimal protection against CPU hogging (the daemon is
89 killed after hogging more than 70% CPU for 5 seconds), but this may
90 be circumvented easily by evildoers.</p></li>
91
92 <li><p><b>I want to run polypaudio only when it is needed, how do I do this?</b></p>
93
94 <p>Set <tt>autospawn = yes</tt> in <tt>client.conf</tt>. That
95 configuration file may be found either in <tt>/etc/polypaudio/</tt> or
96 in <tt>~/.polypaudio/</tt>.</p></li>
97
98 <li><p><b>How do I list all polypaudio modules installed?</b></p>
99
100 <p><tt>polypaudio --dump-modules</tt></p>
101
102 <p>Add <tt>-v</tt> for terse usage instructions.</p>
103
104 <li><p><b>How do I use polypaudio over the network?</b></p>
105
106 <p>Just set <tt>$POLYP_SERVER</tt> to the host name of the polypaudio
107 server. For authentication you need the same auth cookies on all sides. For
108 that copy <tt>~./polypaudio-cookie</tt> to all clients that shall
109 be allowed to connect.</p>
110
111 <p>Alternatively the authorization cookies can be stored in the X11 server.</p></li>
112
113 <li><p><b>Is polypaudio capable of providing synchronized audio playback over the network for movie players like <tt>mplayer</tt>?</b></p>
114
115 <p>Yes! Unless your network is congested in some way (i.e. transfer latencies vary strongly) it works perfectly. Drop me an email for experimental patches for MPlayer.</p>
116
117 <li><p><b>What environment variables does polypaudio care about?</b></p>
118
119 <p>The client honors: <tt>POLYP_SINK</tt> (default sink to connect to), <tt>POLYP_SOURCE</tt> (default source to connect to), <tt>POLYP_SERVER</tt> (default server to connect to, like <tt>ESPEAKER</tt>), <tt>POLYP_BINARY</tt> (the binary to start when autospawning a daemon), <tt>POLYP_CLIENTCONFIG</tt> (path to the client configuration file).</p>
120
121 <p>The daemon honors: <tt>POLYP_SCRIPT</tt> (default CLI script file run after startup), <tt>POLYP_CONFIG</tt> (default daemon configuration file), <tt>POLYP_DLPATH</tt> (colon separated list of paths where to look for modules)</p></li>
122
123
124 <li><p><b>I saw that SIGUSR2 provokes loading of the module <tt>module-cli-protocol-unix</tt>. But how do I make use of that?</b></p>
125
126 <p>A brilliant guy named Lennart Poettering once wrote a nifty tool
127 for that purpose: <a
128 href="http://0pointer.de/lennart/projects/bidilink/">bidilink</a>. To
129 connect to a running polypaudio daemon try using the following commands:</p>
130
131 <pre>killall -USR2 polypaudio
132 bidilink unix-client:/tmp/polypaudio/cli</pre>
133
134 <p><i>BTW: Someone should package this great tool for Debian!</i></p>
135
136 <p><b>New:</b> There's now a tool <tt>pacmd</tt> that automates sending SIGUSR2 to the daemon and running a bidilink like tool for you.</p>
137 </li>
138
139 <li><p><b>How do the polypaudio libraries decide where to connect to?</b></p>
140 <p>The following rule applies:</p>
141 <ol>
142 <li>If the the application using the library specifies a server to connect to it is used. If the connection fails, the library fails too.</li>
143 <li>If the environment variable <tt>POLYP_SERVER</tt> is defined the library connects to that server. If the connection fails, the library fails too.</li>
144 <li>If <tt>$DISPLAY</tt> is set, the library tries to connect to that server and looks for the root window property <tt>POYLP_SERVER</tt> for the host to connect to. If <tt>POLYP_COOKIE</tt> is set it is used as authentication cookie.</li>
145 <li>If the client configuration file (<tt>~/.polypaudio/client.conf</tt> or <tt>/etc/polypaudio/client.conf</tt>) sets the server address, the library connects to that server. If the connection fails, the library fails too.</li>
146 <li>The library tries to connect to the default local UNIX socket for polypaudio servers. If the connection fails, it proceeds with the next item.</li>
147 <li>The library tries to connect to the default local TCP socket for polypaudio servers. If the connection fails, it proceeds with the next item.</li>
148 <li>If <tt>$DISPLAY</tt> is set, the library tries to connect to the default TCP port of that host. If the connection fails, it proceeds with the next item.</li>
149 <li>The connection fails.</li>
150 </ol>
151 </li>
152
153 <li><p><b>Why the heck does libpolyp link against libX11?</b></p>
154 <p>The Polypaudio client libraries look for some X11 root window
155 properties for the credentials of the Polypaudio server to access. You
156 may compile Polypaudio without X11 for disabling this feature.</p></li>
157
158 <li><p><b>How can I use Polypaudio as an RTP based N:N multicast
159 conferencing solution for the LAN?</b></p> <p>After loading all the
160 necessary audio drivers for recording and playback, just load the RTP
161 reciever and sender modules with default parameters:</p>
162
163 <pre>
164 load-module module-rtp-send
165 load-module module-rtp-recv
166 </pre>
167
168 <p>As long as the Polypaudio daemon runs, the microphone data will be
169 streamed to the network and the data from other hosts is played back
170 locally. Please note that this may cause quite a lot of traffic. Hence
171 consider passing <tt>rate=8000 format=ulaw channels=1</tt> to the
172 sender module to save bandwith while still maintaining good quality
173 for speech transmission.</p></li>
174
175 <li><p><b>What is this RTP/SDP/SAP thing all about?</b></p>
176
177 <p>RTP is the <i>Realtime Transfer Protocol</i>. It is a well-known
178 protocol for transferring audio and video data over IP. SDP is the <i>Session
179 Description Protocol</i> and can be used to describe RTP sessions. SAP
180 is the <i>Session Announcement Protocol</i> and can be used to
181 announce RTP sessions that are described with SDP. (Modern SIP based VoIP phones use RTP/SDP for their sessions, too)</p>
182
183 <p>All three protocols are defined in IETF RFCs (RFC3550, RFC3551,
184 RFC2327, RFC2327). They can be used in both multicast and unicast
185 fashions. Polypaudio exclusively uses multicast RTP/SDP/SAP containing audio data.</p>
186
187 <p>For more information about using these technologies with Polypaudio have a look on the <a href="modules.html#rtp">respective module's documentation</a>.
188
189 <li><p><b>How can I use Polypaudio to stream music from my main PC to my LAN with multiple PCs with speakers?</b></p>
190
191 <p>On the sender side create an RTP sink:</p>
192
193 <pre>
194 load-module module-null-sink sink_name=rtp
195 load-module module-rtp-send source=rtp_monitor
196 set-default-sink rtp
197 </pre>
198
199 <p>This will make <tt>rtp</tt> the default sink, i.e. all applications will write to this virtual RTP device by default.</p>
200
201 <p>On the client sides just load the reciever module:</p>
202 <pre>
203 load-module module-rtp-recv
204 </pre>
205
206 <p>Now you can play your favourite music on the sender side and all clients will output it simultaneously.</p>
207
208
209 <p>BTW: You can have more than one sender machine set up like this. The audio data will be mixed on the client side.</p></li>
210
211 <li><p><b>How can I use Polypaudio to share a single LINE-IN/MIC jack on the entire LAN?</b></p>
212
213 <p>On the sender side simply load the RTP sender module:</p>
214
215 <pre>
216 load-module module-rtp-send
217 </pre>
218
219 <p>On the reciever sides, create an RTP source:</p>
220
221 <pre>
222 load-module module-null-sink sink_name=rtp
223 load-module module-rtp-recv sink=rtp
224 set-default-source rtp_monitor
225 </pre>
226
227 <p>Now the audio data will be available from the default source <tt>rtp_monitor</tt>.</p></li>
228
229 <li><p><b>When sending multicast RTP traffic it is recieved on the entire LAN but not by the sender machine itself!</b></p>
230
231 <p>Pass <tt>loop=1</tt> to the sender module!</p></li>
232
233 <li><p><b>Can I have more than one multicast RTP group?</b></p>
234
235 <p>Yes! Simply use a new multicast group address. Use
236 the <tt>destination</tt>/<tt>sap_address</tt> arguments of the RTP
237 modules to select them. Choose your group addresses from the range
238 <tt>225.0.0.x</tt> to make sure the audio data never leaves the LAN.</p></li>
239
240
241 <li><p><b>Can I use Polypaudio to playback music on two sound cards simultaneously?</b></p>
242
243 <p>Yes! Use <a href="modules.html#module-combine"><tt>module-combine</tt></a> for that.</p>
244
245 <pre>
246 load-module module-oss-mmap device="/dev/dsp" sink_name=output0
247 load-module module-oss-mmap device="/dev/dsp1" sink_name=output1
248 load-module module-combine sink_name=combined master=output0 slaves=output1
249 set-sink-default combined
250 </pre>
251
252 <p>This will combine the two sinks <tt>output0</tt> and
253 <tt>output1</tt> into a new sink <tt>combined</tt>. Every sample
254 written to the latter will be forwarded to the former two. Polypaudio
255 will make sure to adjust the sample rate of the slave device in case
256 it deviates from the master device. You can have more than one slave
257 sink attached to the combined sink, and hence combine even three and
258 more sound cards.</p> </li>
259
260 <li><p><b>Can I use Polypaudio to combine two stereo soundcards into a virtual surround sound card?</b></p>
261
262 <p>Yes! You can use use <a href="modules.html#module-combine"><tt>module-combine</tt></a> for that.</p>
263
264 <pre>
265 load-module module-oss-mmap device="/dev/dsp" sink_name=output0 channel_map=left,right channels=2
266 load-module module-oss-mmap device="/dev/dsp1" sink_name=output1 channel_map=rear-left,rear-right channels=2
267 load-module module-combine sink_name=combined master=output0 slaves=output1 channel_map=left,right,rear-left,rear-right channels=4
268 </pre>
269
270 <p>This is mostly identical to the previous example. However, this
271 time we manually specify the channel mappings for the sinks to make
272 sure everything is routed correctly.</p>
273
274 <p>Please keep in mind that Polypaudio will constantly adjust the
275 sample rate to compensate for the deviating quartzes of the sound
276 devices. This is not perfect, however. Deviations in a range of
277 1/44100s (or 1/48000s depending on the sampling frequency) can not be
278 compensated. The human ear will decode these deviations as minor
279 movements (less than 1cm) of the positions of the sound sources
280 you hear. </p>
281
282 </li>
283
284
285
286 </ol>
287
288 <hr/>
289 <address class="grey">Lennart Poettering &lt;@PACKAGE_BUGREPORT@&gt;, April 2006</address>
290 <div class="grey"><i>$Id$</i></div>
291 </body> </html>