~ubuntu-branches/ubuntu/precise/puredata/precise

« back to all changes in this revision

Viewing changes to doc/1.manual/x3.htm

  • Committer: Bazaar Package Importer
  • Author(s): Paul Brossier
  • Date: 2009-12-22 21:29:31 UTC
  • mfrom: (1.2.6 upstream) (4.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091222212931-nhwkzapjwsmjao1l
Tags: 0.42.5-3
* debian/control:
  - add community site to homepage field
  - improve long description
  - remove Replaces and Conflicts fields
  - add Suggests on pd-csound, pd-pdp, pd-zexy, pd-aubio
* debian/rules: add per-arch configuration flags
* debian/patches/02_kfreebsd.diff:
  - also define pd_tilde_dllextent on FreeBSD
  - fix typo (really closing #414414 this time)
  - also add hurd glue
* debian/patches/04_hurd.diff:
  - add hurd glue and s_midi_dummy.c

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
 
2
 
 
3
<HTML>
 
4
  <HEAD>
 
5
         <TITLE>Pd Documentation 3</TITLE>
 
6
    <meta http-equiv="Content-Type" content="text/html">
 
7
         <link rel="stylesheet" type="text/css" href="pdmanual.css" media="screen">
 
8
  </HEAD>
 
9
 
 
10
 
 
11
<BODY>
 
12
 
 
13
<H2>Pd Documentation chapter 3: Getting Pd to run</H2>
 
14
 
 
15
<P>
 
16
<A href="index.htm#s3"> back to table of contents </A>
 
17
<BR><BR>
 
18
</P>
 
19
 
 
20
<P>Pd runs under Microsoft Windows, Linux, and MacOS (10.2 or later).   How to
 
21
get Pd up and running depends on your operating system, but the overall strategy
 
22
is the same. You must first get and install it, and then untangle whatever
 
23
problems arise in handling audio and MIDI input and output, and finally get Pd
 
24
to meet its real-time obligations reliably.
 
25
 
 
26
<P>  Installation instructions are platform-specfic; the following four
 
27
sections
 
28
will describe what to do for various operating systems you might have.
 
29
In case of trouble also consult the Pd mailing list archive on
 
30
    <A href="http://iem.kug.ac.at/mailinglists/pd-list/">
 
31
    http://iem.kug.ac.at/mailinglists/pd-list/</A>
 
32
, which often has late-breaking news about configuration problems and solutions.
 
33
The rest of this section describes how to get audio and MIDI to work.
 
34
 
 
35
<H3> <A name=s1.0> 3.1. Audio and MIDI </A> </H3>
 
36
 
 
37
<P>
 
38
To test audio and MIDI, start Pd and select "test Audio and MIDI" from the
 
39
"Media" menu.  You should see a window like this:
 
40
 
 
41
<CENTER><P>
 
42
    <IMG src="fig11.1.png" ALT="test tone patch">
 
43
</P></CENTER>
 
44
 
 
45
<P> First, try to get Pd to play a sine wave over your speakers.  The "TEST
 
46
TONE" control at top left turns this on and off.  Normally, all the output
 
47
channels are turned on so that when you turn the tone on (to a soft -40 dB or a
 
48
louder -20 dB) you should get output on the first six of your output channels.
 
49
(If you have fewer than six output channnels open, the extra
 
50
channels aren't played; and if you have more, this particular patch won't
 
51
use them.)
 
52
 
 
53
<P> If there's anything wrong, the most likely outcome is that you will hear
 
54
nothing at all.  This could be for any of at least three reasons:  Pd might
 
55
have failed to open the audio device; the audio card's output volume might
 
56
be set to zero; or your audio system might not be set to amplify the computer
 
57
output.
 
58
 
 
59
<P> The number boxes labeled "AUDIO INPUT" show the levels of incoming
 
60
audio, in dB, with 100 being maximum.  (Incoming signals may clip at
 
61
RMS levels below 100; for instance, a sinusoid clips at about 97 dB.)
 
62
Any DC present in the input (such as you get with cheap audio hardware)
 
63
will show up as level unless you turn on the "input hipass" toggle
 
64
at right; then the DC component is filtered out before metering.
 
65
 
 
66
<P>  To test the quality of audio input and output, turn on "monitor" 
 
67
(also at right) which causes the inputs to be played to the outputs at
 
68
unit gain.  You should hear a faithful, non-distored copy of whatever is
 
69
sent through the patch.
 
70
 
 
71
<P> It is easy to get two copies of Pd running by accident; on most machines
 
72
only one at a time may be inputting and outputting sound.  (Some copy of Pd
 
73
might have audio or MIDI devices open and prevent the copy you're trying to use
 
74
from getting access to them.)  Having extra
 
75
copies of Pd around will also eat CPU cycles uselessly.
 
76
 
 
77
<P>
 
78
You may be interested in getting only audio output or audio input, or
 
79
you may need both to run simultaneously.  By default, Pd will try to run
 
80
both, but if you don't need either input or output, you may find that Pd
 
81
runs more reliably, or at least more efficiently, with the unused direction
 
82
turned off.  This may be specified in Pd's command line flags or using the
 
83
"audio settings" dialog panel.
 
84
 
 
85
<P>
 
86
Depending on your application you will have a more or less stringent latency
 
87
requirement.   Ideally, when any input (audio, MIDI, keyboard, network) is
 
88
available, the outputs (in particular the audio output) should react instantly.
 
89
In real life, it is necessary to buffer the audio inputs and outputs, trying
 
90
always to keep some number of milliseconds ahead of real time to prepare for the
 
91
inevitable occasions where the CPU runs off to service some different task
 
92
from Pd.  How small this latency can be chosen depends on your OS and your
 
93
audio driver.
 
94
 
 
95
<P> TIP: If Pd starts up but you get distortion or glitches in the audio
 
96
output, this  could be either because the "audio I/O buffer" isn't big enough,
 
97
or else because the CPU load of the patch you're running is too great for the
 
98
machine you have, or else because the ADC and DAC are out of sync or even at
 
99
different sample rates.  To test for the first possibility, try increasing the
 
100
audio latency in the command line or the "audio settings" dialog (but see also
 
101
under your OS below.)  For the second, start up your favorite performance
 
102
monitor program; and for the third, try starting Pd up with ADCs disabled.
 
103
 
 
104
<P> In addition to the "test audio and MIDI" patch, the "Media" menu 
 
105
contains items for controlling audio and MIDI settings.  The first two
 
106
items, "Audio on" and "Audio off", open or close the audio devices and
 
107
start or stop Pd's audio computation. 
 
108
 
 
109
<P> If there is a choice of
 
110
audio API to make, the Media menu will display them.  (On Linux, they are
 
111
OSS, ALSA, and Portaudio; on Windows, you get MMIO and ASIO).  More information
 
112
about the APIs appears in the sections below.
 
113
 
 
114
<P> Next is the "Audio settings..." menu item, which opens a dialog like this:
 
115
 
 
116
<CENTER><P>
 
117
    <IMG src="fig11.2.png" ALT="audio settings dialog">
 
118
</P></CENTER>
 
119
 
 
120
The exact choices you get depend on the operating system and API.  The sample
 
121
rate controls both audio output and input.  The audio throughput delay is
 
122
the nominal amount of time, in milliseconds, that a sound coming into the
 
123
audio input will be delayed if it is copied through Pd straight to the
 
124
output.  Naturally you would like this to be as small as possible, but,
 
125
depending on OS, API, and even the specific choice of audio hardware, there
 
126
will be a limit to how small you can make this.  You can typically get
 
127
10 msec on linux (and lower still if you use special tricks), 30 msec on Mac
 
128
OSX, and 60 msec on Windows (but note that there might be ways that a 
 
129
patient Windows user can reduce this).
 
130
 
 
131
<P> Next you get a choice of input and output device.  If you want to open
 
132
more than one, hit "use multiple devices" and you'll be allowed up to 4
 
133
in and 4 out.  Each audio device is 2 channels by default, but you may
 
134
specify more if your hardware supports it.
 
135
 
 
136
Other parameters may be tweaked using the command line; see under
 
137
<A href=#s4> preferences and startup options </A>.
 
138
 
 
139
<H6> MIDI </H6>
 
140
 
 
141
<A> The "channel message" midi objects in Pd
 
142
such as notein or pgmout will take channels 1-16 to mean the first open MIDI
 
143
port, 17-32 the second one, and so on.  The midiin, sysexin, midiout objects
 
144
give you a separate inlet to specify which of the open MIDI port numbers
 
145
you want.
 
146
 
 
147
<P> System exclusive MIDI message input and output are theoretically supported
 
148
but does not work uniformly across all operating systems..
 
149
 
 
150
<H3> <A name=s1.1> 3.2. Installing Pd in Microsoft Windows </A> </H3>
 
151
 
 
152
<P> Pd should work under any version of Windows since 95.  You can download as
 
153
a self-extracting archive (a ".exe" file). Run this and select a destination
 
154
directory when prompted, such as "\pd" or "Program Files\pd".
 
155
 
 
156
<P> If for example you put Pd in "C:Program Files\pd", the executable program
 
157
will be "C:Program Files\pd\bin\pd".   You can simply adjust your path to
 
158
include C:\pd\bin and then invoke "pd" in a command prompt window. You can also
 
159
make a shortcut to the executable program (left-click on it and drag to the
 
160
desktop, for example.)
 
161
 
 
162
<P> Pd requires "TCP/IP networking" to be turned on.  This doesn't mean you
 
163
have to be on a real network, but simply that Pd actually consists of two
 
164
programs that make a "network link" (locally) to intercommunicate.
 
165
 
 
166
<H4> Audio in Microsoft Windows </H4>
 
167
 
 
168
<P>
 
169
You can ask for a list of audio and MIDI devices by typing
 
170
"pd -listdev"; you can then specify which audio and MIDI device to use.
 
171
Type "pd -help" (or make any mistake) to get the syntax for specifying 
 
172
which device to use.  You can modify the Pd shortcut (or batch file) to
 
173
set these, or else use the "startup" dialog (file menu) to specify
 
174
startup arguments.
 
175
 
 
176
<P>
 
177
Alternatively, (and especially when just starting out) you can experiment
 
178
with different audio configurations using the "audio settings" 
 
179
item in the Media menu.
 
180
 
 
181
<P>
 
182
You can list and
 
183
choose MIDI devices in the same way as audio;  note that, by default, MIDI
 
184
input is disabled in Windows (because it's possible to hang up some MIDI
 
185
devices if Pd exits unexpectedly).
 
186
 
 
187
<P>
 
188
MIDI timing is very poor if you are using simultaneous audio input and output;
 
189
if you suppress either audio input or output things will improve somewhat under
 
190
NT; you can apparently get the jitter down to ~40 msec.  On W95 performance is
 
191
simply terrible.  W98, with either audio input or output suppressed, offers
 
192
fairly good MIDI timing (~5 msec jitter).  The "first edition" used to crash
 
193
occasionally; this might be fixed in the "second edition".
 
194
 
 
195
<H4> ASIO </H4>
 
196
 
 
197
<P> As of version 0.35 Pd supports ASIO.  Invoke Pd as "pd -asio" and, if
 
198
needed, specify "-sounddev" (etc.) flags to specify which device (see
 
199
"the Pd command line" below.)  You can also specify a "-blocksize" different
 
200
from the default (256 samples) and "-audiobuf" in milliseconds.  Pd will
 
201
round this down to a power of two buffers, each of "-blocksize" in sample
 
202
frames.
 
203
 
 
204
<H3> <A name=s1.2> 3.3. Installing Pd in Linux </A> </H3>
 
205
 
 
206
<P> What to do depends on which flavor of Linux you are running (e.g., Debian
 
207
or Red Hat). The instructions here should work for Pd 0.33 and up regardless of
 
208
your situation.  (If not, you can read the Pd mailing list archives for  
 
209
recent problems; if you have found a new problem you're welcome to post it 
 
210
to the list.)
 
211
 
 
212
<P> Pd is available via the package systems for some linux distributions, 
 
213
but not always in the most recent version possible.  It's relatively easy to
 
214
compile your own copy of Pd and that is the approach described here.
 
215
 
 
216
<H4> Getting Pd as a .tar.gz </H4>
 
217
 
 
218
<P> Before you start, you might want to check that you have the resources Pd
 
219
needs.  The main things you need are the C compiler, X windows (including
 
220
the X development package for Pd to link against) and TK.  It's almost
 
221
always enough to load "tcl-devel" and "tk-devel" packages using yum or
 
222
apt-get.
 
223
 
 
224
<P> 
 
225
Download Pd, perhaps from
 
226
    <a href="http://www.crca.ucsd.edu/~msp/software.html">
 
227
    http://www.crca.ucsd.edu/~msp/software.html</A> ,
 
228
to file such as "pd-linux-033.tar.gz".  Open a "shell"
 
229
window, cd to
 
230
the directory containing the file, and type the command,
 
231
<PRE>
 
232
    tar xzf pd-linux-033.tar.gz
 
233
</PRE>
 
234
<P>which creates a directory named "pd".  I do this from my home directory.
 
235
Next, compile it.  "CD" to pd and read the INSTALL.txt, or else just cd
 
236
to "pd/src" and type
 
237
 
 
238
<P>
 
239
<BR> ./configure
 
240
<BR> make
 
241
</P>
 
242
 
 
243
<P> You can pass flags to "configure" to customize your compilation:
 
244
 
 
245
<PRE>
 
246
    To enable debugging (and losing code optimization) add "--enable-debug".
 
247
    To use Portaudio version 19 (experimental), add "--enable-portaudio".
 
248
    To put Pd in /usr/bin instead of /usr/local/bin, add "--prefix=/bin".
 
249
</PRE>
 
250
 
 
251
Alsa and Jack support should auto-configure, but "--enable-alsa" od
 
252
"--enable-jack" will force their inclusion.
 
253
 
 
254
<P> After "make", just type "~/pd/bin/pd" to run pd.
 
255
 
 
256
<P> Alternatively, as superuser, you can run "make install" after "make depend"
 
257
and then anyone on your system can just type "pd" to run it.
 
258
 
 
259
<H4> Testing audio and MIDI. </H4>
 
260
 
 
261
<P>
 
262
Next try audio.  We want to know whether audio output works, whether audio
 
263
input works, and whether they work simultaneously.  First run "aumix" (or
 
264
any newer audio mixer app) to 
 
265
check audio input and output gains and learn which input (mic; line;
 
266
etc.) is "recording".
 
267
Then test audio output by running
 
268
<PRE>
 
269
    pd -noadc
 
270
</PRE>
 
271
<P>and selecting "test audio and MIDI" from the "Media" menu.  You should see
 
272
a patch. Turn on the test tone and listen.  Do the usual where's-the-signal
 
273
business.
 
274
 
 
275
<P>
 
276
Then quit Pd and test audio input via
 
277
<PRE>
 
278
    pd -nodac
 
279
</PRE>
 
280
<P>Re-open the test patch and hit "meter"; look at the levels.  100 dB is a
 
281
hard clip; arrange gains so that the input signal tops out around 80 or 90,
 
282
but no higher.
 
283
 
 
284
<P> Now see if your audio driver can do full duplex by typing "pd" with no
 
285
flags.  If you see error messages involving /dev/dsp or /dev/dsp2, you're
 
286
probably not able to run audio in and out at the same time.  If on the other
 
287
hand there's no complaint, and if the audio test patch does what you want, you
 
288
might wish to experiment with the "-audiobuffer" flag to see what values of
 
289
audio latency your audio system can handle.
 
290
 
 
291
<H3> Audio hardware in Linux </H3>
 
292
 
 
293
<P>
 
294
Be forewarned: installing and testing audio and MIDI drivers in Linux can take
 
295
days or weeks.  There apears to be no single place where you can get detailed
 
296
information on Linux audio.  One good source of information lives at:
 
297
<A href=http://www.djcj.org/LAU/guide/index.php>
 
298
http://www.djcj.org/LAU/guide/index.php </A>.
 
299
 
 
300
<P>
 
301
There are two widely-used driver sets, called "OSS" and "ALSA".  OSS is 
 
302
included in the standard Linux kernels since version 2.2.  However, for some
 
303
audio cards you can find newer versions than are included in the kernel
 
304
releases.  You can get ALSA from
 
305
 
 
306
    <a href="http://www.alsa-project.org/">
 
307
    http://www.alsa-project.org/</A> .
 
308
 
 
309
<P> ALSA is able to emulate OSS, so that you can usually run Pd using the
 
310
default "OSS" settings even if it's actually ALSA that's running.
 
311
ALSA is newer, hence less stable and harder to use, than OSS.
 
312
Installing ALSA can be tricky and/or confusing.
 
313
 
 
314
<P> By default, Pd uses OSS.  If you are running ALSA, Pd will use ALSA's OSS
 
315
emulation.  To make Pd use ALSA "natively", i.e., the way ALSA is designed
 
316
to be used, include the "-alsa" flag in the command line or bang on the "media"
 
317
menu items.
 
318
 
 
319
<P> You can add ALSA devices by name on the Pd command line:
 
320
<PRE>
 
321
    pd -alsaadd loupgarou
 
322
</PRE>
 
323
instructs Pd to offer the 'loupgarou' audio device in the Audio Settings panel.
 
324
 
 
325
<H4> Experiences with particular soudcards </H4>
 
326
 
 
327
<P>
 
328
Here are some of my own experiences with sound cards so far.  See
 
329
also the Pd mailing list archives.
 
330
 
 
331
<H6> RME 9652 (Hammerfall) </H6>
 
332
 
 
333
<P>  This is the best sound card out there; it costs around $500 and has 3 ADAT
 
334
I/O ports and one SPDIF.  There is a "baby hammerfall" also, which I think is
 
335
the "9632."  DO NOT CONFUSE THE 9652/9632 WITH OTHER RME BOARDS WHICH  MIGHT
 
336
NOT WORK WITH PD.
 
337
 
 
338
<P> The easiest way to use 
 
339
Hammerfall boards in Pd is via ALSA and jack; but you can use ALSA alone:
 
340
<PRE>
 
341
    pd -alsa -channels 26
 
342
</PRE>
 
343
works for me.  If you don't specify the number of channels correctly Pd crashes.
 
344
 
 
345
<H6> MIDIMAN </H6>
 
346
 
 
347
<P>Midiman sells PCI devices (delta 44, 66, 1010, and 1010LT)
 
348
with between 4 and 10 channels in and out, for
 
349
which there are ALSA drivers.  These are also very good, and they are a
 
350
bit cheaper than Hammerfalls.  The driver name is "ice1712".
 
351
 
 
352
<P> Alsa provides an "envy24control" program (in "utils".  You should run
 
353
this and check that your ice1712's sync source is internal if you have no
 
354
SPDIF input, or "SPDIF" if you do.  I think the default is now "internal"
 
355
but don't take it for granted...
 
356
 
 
357
<H6> warning about i810/i815 drivers...</H6>
 
358
 
 
359
<P>As of RedHat 7.0, motherboards with native i810 audio systems didn't work in
 
360
full duplex (they crashed linux).  Either run Pd -noadc or else (better)
 
361
install ALSA.  This ought to be fixed by now...
 
362
 
 
363
<H3> <A name="s1.3"> 3.4. Installing Pd in Macintosh OSX </A> </H3>
 
364
 
 
365
<P>Pd version 0.35 and up support Macintosh OSX.  You need the OSX Jaguar
 
366
distribution (10.2) or later.
 
367
 
 
368
<P> To install Pd you can always just download  the sources and compile them
 
369
yourself, or (easier)  just download the Mac binary from the download page:
 
370
 
 
371
<A href="http://crca.ucsd.edu/~msp/software.html">
 
372
http://crca.ucsd.edu/~msp/software.html</A>.
 
373
 
 
374
This is in the form of a compressed Tar archive; just click on it and the Max
 
375
will extract the Pd application.  Open this and you should be running.
 
376
 
 
377
<P> The package by Hans-Christoph Steiner, on
 
378
 
 
379
<A href="http://at.or.at/hans/pd/installers.html">
 
380
http://at.or.at/hans/pd/installers.html</A>,
 
381
 
 
382
has many updates and extensions
 
383
which are not included in the original Pd distribution.  Download this and
 
384
follow the (simple) instructions found there. 
 
385
</P>
 
386
 
 
387
<H4> To install on OSX from source: </H4>
 
388
 
 
389
<P> 
 
390
Whether you've downloaded the source or the "package" you can   
 
391
always compile Pd for yourself, whether to make your own improvements, or   
 
392
possibly so that you can get the newest version before it shows up compiled for
 
393
Mac OS X.      
 
394
 
 
395
<P> To be able to compile Pd, you must have Tcl/Tk installed in the standard
 
396
places.  I think this is true fro all reasoably recent releases of OSX.
 
397
 
 
398
<P> Then, just as for linux, just unload pd-whatever.tar.gz into a directory
 
399
such as ~/pd-0.36-0, cd to pd-0.36-0/src, type "./configure"
 
400
and "make".  Then type ~/pd-0.36-0/bin/pd to a shell and enjoy!
 
401
 
 
402
<P> If you wish you can put a line such as,
 
403
 
 
404
<pre>
 
405
    alias pd ~/pd/bin/pd
 
406
</pre>
 
407
 
 
408
<P>in the file, ~/.tcshrc, so that you can later just type "pd" to a shell.
 
409
(The
 
410
shell only reads the ~/.tcshrc file on startup, so this won't take effect in
 
411
any existing shells unless you specially type
 
412
<pre>
 
413
    source ~/.tcshrc
 
414
</pre>
 
415
<P>to them.)
 
416
 
 
417
<P> Follow the general directions above for testing audio and/or MIDI
 
418
as needed.
 
419
 
 
420
<P> To get MIDI working, you have to do the Mac OSX magic to get a USB
 
421
MIDI interface installed.  I've seen this done with Midisport devices and
 
422
I think you just download the OSX driver and follow directions.
 
423
 
 
424
<H3> <A name=s4> 3.6. Preferences and startup options </A> </H3>
 
425
 
 
426
<P> Pd's behavior may be customized to instruct it where to find files, which
 
427
audio devices to open, what font size to use, and so on.  Most of
 
428
these may also be changed using the various dialogs you can open from Pd's
 
429
menus.  Others take effect only when Pd starts up; some of these appear
 
430
on the ``startup" dialog and some of them, too cranky to put in a GUI, must
 
431
be typed as <I> command line arguments </I>.
 
432
 
 
433
<P> In addition to the Audio and MIDI settings (see 
 
434
<A href="#s1.0"> Audio and MIDI </A>), you can customize font size (from the
 
435
``edit" menu), directories to search for files (see 
 
436
<A href="#s5"> How Pd searches for files </A>), and additional startup
 
437
parameters described below.
 
438
 
 
439
<P> All of these settings may be saved automatically between Pd sessions. 
 
440
It is also possible to specify settings directly via the <I> command
 
441
line </I>.  (A third mechanism, using configuration files, is deprecated and
 
442
isn't described here.)  The Pd command line is described in the next
 
443
section.  Command line settings, if given, each override the corresponding
 
444
setting that was saved from Pd.
 
445
 
 
446
<P>  The startup settings (i.e., those that take effect only when Pd is started)
 
447
are controlled using the ``startup..." dialog from the File menu.  The
 
448
dialog appears as follows:
 
449
 
 
450
<CENTER><P>
 
451
    <IMG src="fig11.3.png" ALT="startup dialog">
 
452
</P></CENTER>
 
453
 
 
454
The slots at top each specify a binary ``library" for Pd to load on startup.
 
455
These may be for Gem, pdp, zexy, iemlib, cyclone, and so on.  Typically, a
 
456
single binary object (an ``extern") is left for Pd to load automatically;
 
457
startup library loading is appropriate for collections of many objects
 
458
specified by a single binary library.
 
459
 
 
460
<P> The ``defeat real-time scheduling" contol, if enabled, makes Pd run without
 
461
its usual effort to become a real-time process (whatever this means in the
 
462
operating system you are using.)  In Unix, Pd must usually be setuid to allow
 
463
real-time scheduling at all.
 
464
 
 
465
<P> The ``startup flags" allow you to add to Pd's command line on startup. This
 
466
is specified as described below, except that the initial word, ``pd", is
 
467
understood.  For example, putting ``-rt" in this field sets real-time
 
468
scheduling; ``-sleepgrain 1" sets the sleep grain to 1 (see under MIDI below),
 
469
and typing "-rt -sleepgrain 1" does both.
 
470
 
 
471
<P> You may save the current settings for future Pd sessions with the
 
472
``save all settings" button; this saves not only the path but all other
 
473
settings as well.
 
474
 
 
475
<H6> Command line arguments </A> </H3>
 
476
 
 
477
<P>Pd may be run as a "command line" program from your "terminal emulator,"
 
478
"shell," or "MSDOS prompt."  In Windows, if Pd is started using a "shortcut"
 
479
it is also run from a command line which you can edit using the ``properties"
 
480
dialog for the shortcut.  In any operating system, Pd can be called from a
 
481
script (called a <I> batch file </I> on Windows or a <I> shell script </I>
 
482
on OSX or unix).  The command line is just a line of text, which should be
 
483
of the form:
 
484
 
 
485
<PRE>
 
486
 
 
487
    pd [options] [patches to open]
 
488
 
 
489
</PRE>
 
490
 
 
491
<P>although you may have to specify a path (such as "~/pd/bin/pd" or
 
492
"C:\program files\pd\bin\pd") so your command interpreter can find
 
493
Pd.  Possible options include:
 
494
 
 
495
<PRE>
 
496
 
 
497
audio configuration flags:
 
498
-r &lt;n&gt;           -- specify sample rate
 
499
-audioindev ...  -- sound in device list; e.g., "2,1" for second and first
 
500
-audiooutdev ... -- sound out device list, same as above 
 
501
-audiodev ...    -- specify both -audioindev and -audiooutdev together
 
502
-inchannels ...  -- number of audio in channels (by device, like "2" or "16,8")
 
503
-outchannels ... -- number of audio out channels (by device)
 
504
-channels ...    -- specify both input and output channels
 
505
-audiobuf &lt;n&gt;    -- specify size of audio I/O buffer in msec
 
506
-blocksize &lt;n&gt;   -- specify audio I/O block size in sample frames
 
507
-sleepgrain &lt;n&gt;  -- specify number of milliseconds to sleep when idle
 
508
-nodac           -- suppress audio output
 
509
-noadc           -- suppress audio input
 
510
-noaudio         -- suppress audio input and output (-nosound is synonym) 
 
511
-listdev         -- list audio and MIDI devices
 
512
 
 
513
(linux specific audio:)
 
514
-oss            -- use ALSA audio drivers
 
515
-alsa           -- use ALSA audio drivers
 
516
-pa             -- use portaudio (experimental version 19)
 
517
-alsadev &lt;n&gt;    -- obsolete: use -audiodev
 
518
-32bit          -- (probably obsolete) -- use 32 bit OSS extension
 
519
-alsaadd &lt;dev&gt;  -- add a device to the ALSA device list
 
520
 
 
521
(Windows specific audio:)
 
522
-mmio           -- use MMIO drivers and API
 
523
-asio           -- use ASIO drivers and API
 
524
 
 
525
MIDI configuration flags:
 
526
-midiindev ...   -- midi in device list; e.g., "1,3" for first and third
 
527
-midioutdev ...  -- midi out device list, same format
 
528
-mididev ...     -- specify -midioutdev and -midiindev together
 
529
-nomidiin        -- suppress MIDI input
 
530
-nomidiout       -- suppress MIDI output
 
531
-nomidi          -- suppress MIDI input and output
 
532
-alsamidi        -- use ALSA midi API
 
533
 
 
534
general flags:
 
535
-path &lt;path&gt;     -- add to file search path
 
536
-nostdpath       -- don't search standard ("extra") directory
 
537
-stdpath         -- search standard directory (true by default)
 
538
-helppath &lt;path&gt; -- add to help search path
 
539
-open &lt;file&gt;     -- open file(s) on startup
 
540
-lib &lt;file&gt;      -- load object library(s)
 
541
-font &lt;n&gt;        -- specify default font size in points
 
542
-verbose         -- extra printout on startup and when searching for files
 
543
-version         -- don't run Pd; just print out which version it is
 
544
-d &lt;n&gt;           -- specify debug level
 
545
-noloadbang      -- suppress all loadbangs
 
546
-stderr          -- send printout to standard error instead of GUI
 
547
-nogui           -- suppress starting the GUI
 
548
-guiport &lt;n&gt;     -- connect to pre-existing GUI over port 'n'
 
549
-guicmd "cmd..." -- substitute another GUI program (e.g., rsh)
 
550
-send "msg..."   -- send a message at startup (after patches are loaded)
 
551
-rt or -realtime -- use real-time priority (needs root privilege)
 
552
-nrt             -- don't use real-time priority
 
553
-nosleep         -- never relinquish CPU (only for multiprocessors!)
 
554
 
 
555
</PRE> 
 
556
 
 
557
<P>Here are some details on some of the audio, MIDI, and scheduler options (but
 
558
see also the next section on file management.)
 
559
 
 
560
<H4> multiple devices.  </H4>
 
561
 
 
562
<P> You can specify multiple MIDI input and output devices.  For example,
 
563
"pd -midiindev 3 -midioutdev 4,2" asks for the third MIDI input device and the
 
564
fourth and second MIDI output device.  
 
565
 
 
566
<P> Audio device selection is similar, except that you can also specify
 
567
channels by device: "-audioindev 1,3 -inchannels 2,8" will try to open device 1
 
568
(2 channels) and device 3 (8 channels.)
 
569
 
 
570
<H4> sample rate. </H4>
 
571
 
 
572
<P>The sample rate controls Pd's logical sample rate which need not be that of
 
573
the audio input and output devices.  If Pd's sample rate is wrong, time will
 
574
flow at the wrong rate and synthetic sounds will be transposed.  If the output
 
575
and input devices are running at different rates, Pd will constantly drop frames
 
576
to re-sync them, which will sound bad.  You can disable input or output if this
 
577
is a problem.
 
578
 
 
579
<H4> audio buffer size and block size </H4>
 
580
 
 
581
<P>You can specify an audio buffer size in milliseconds, typically between 10 and
 
582
300, depending on how responsive your OS and drivers are.  If this is set too
 
583
low there will be audio I/O errors ("data late").  The higher the value is,
 
584
on the other hand, the more throughput delay you will hear from the audio
 
585
and/or control inputs (MIDI, GUI) and the audio coming out.
 
586
 
 
587
<P> You can also specify the audio block size in sample frames.  This is 64 by
 
588
default (except for MMIO for which it's 256), and may be 64, 128, or 256.  
 
589
 
 
590
<H4> MIDI and sleepgrain</H4>
 
591
 
 
592
<P> In Linux, if you
 
593
ask for "pd -midioutdev 1" for instance, you get /dev/midi0 or /dev/midi00
 
594
(or even /dev/midi).  "-midioutdev 45" would be /dev/midi44.  In NT, device
 
595
number 0 is the "MIDI mapper", which is the default MIDI device you selected
 
596
from the control panel; counting from one, the device numbers are card
 
597
numbers as listed by "pd -listdev."
 
598
 
 
599
<P> The "sleepgrain" controls how long (in milliseconds) Pd sleeps between
 
600
periods of computation.  This is normally the audio buffer divided by 4, but
 
601
no less than 0.1 and no more than 5.  On most OSes, ingoing and outgoing MIDI
 
602
is quantized to this value, so if you care about MIDI timing, reduce this to 1
 
603
or less. 
 
604
 
 
605
<H3> <A name="s5"> 3.7. How Pd searches for files </A> </H3>
 
606
 
 
607
<P>Pd has a search path feature; you specify the path on the command line
 
608
using the "-path" option.  Paths may contain any number of files.  If you
 
609
specify several files in a single "-path" option they're separated by colons
 
610
in unix or semicolons in NT.  
 
611
 
 
612
<P> You can see and edit the path while Pd is running using the "path..."
 
613
item in the "File" menu:
 
614
 
 
615
<CENTER><P>
 
616
    <IMG src="fig11.4.png" ALT="startup dialog">
 
617
</P></CENTER>
 
618
 
 
619
<P>  The path must be correctly set before you load
 
620
a patch or it may fail to find abstractions, etc., that are needed to
 
621
construct the patch.  When Pd searches for an abstraction or an
 
622
"extern" it uses the path to try to find the necessary file.  The "read"
 
623
messages to qlists and arrays (aka tables) do this too.
 
624
 
 
625
<P> If ``use standard extensions" is enabled, the usual ``extras" directory
 
626
is also searched.  This contains standard external objects like ``expr" and
 
627
``fiddle", and perhaps much more depending on the distribution of Pd
 
628
you're using.
 
629
 
 
630
<P> You may save the current settings for future Pd sessions with the
 
631
``save all settings" button; this saves not only the path but all other
 
632
settings as well.
 
633
 
 
634
<P> Path entries may be relative to the patch directory; for instance,
 
635
if your path has an item, "../sound", and your patch is in "my stuff/all mine",
 
636
then Pd will look in "my stuff/sound".  Spaces should be OK in the path to
 
637
the patch, but not in the path entry (../sound) itself.  This is useful if
 
638
you have a patch and supporting files (even a supporting snapshot of pd)
 
639
that you want to distribute or carry around together.
 
640
 
 
641
<P> Regardless of path, Pd should look first in the directory containing
 
642
the patch before searching down the path.  Pd does not automatically look
 
643
in the <I> current directory </I> however; to enable that, include ``." in
 
644
the path.  The ``extra" directory, if enabled, is searched last.
 
645
 
 
646
<P> Filenames in Pd are always separated by (unix-style) forward slashes, even
 
647
if you're on Windows (which uses backslashes).  This is so that patches can be
 
648
ported more easily between operating systems.  On the other hand, if you
 
649
specify a filename on the command line (as in "pd -path c:\pdlib") the file
 
650
separator should agree with the operating system. <BR>
 
651
 
 
652
<P> If a filename specified in a patch has any "/" characters in it, the "path"
 
653
is not used; thus, "../sounds/sample1.wav" causes Pd only to look relative to
 
654
the directory containing the patch.  You may also invoke externs that way.
 
655
 
 
656
<P> As of version 0.35, there may be spaces in the path to Pd itself; also,
 
657
the "openpanel" and "savepanel" objects can handle spaces.  Spaces in the
 
658
path should work as of version 0.38.
 
659
 
 
660
</BODY>
 
661
</HTML>
 
662
 
 
663