Imported Upstream version 1.0.28
[platform/upstream/alsa-lib.git] / doc / asoundrc.txt
1 # Configuration file syntax
2
3 # Include a new configuration file
4 <filename>
5
6 # Simple assign
7 name [=] value [,|;]
8
9 # Compound assign (first style)
10 name [=] {
11         name1 [=] value [,|;]
12         ...
13 }
14
15 # Compound assign (second style)
16 name.name1 [=] value [,|;]
17
18 # Array assign (first style)
19 name [
20         value0 [,|;]
21         value1 [,|;]
22         ...
23 ]
24
25 # Array assign (second style)
26 name.0 [=] value0 [,|;]
27 name.1 [=] value1 [,|;]
28
29 # ******************************************************************************
30
31 # Server definition
32 server.NAME {
33   host STR              # host where the server is located (if map to local address 
34                         # server is local, and then it may be started automatically)
35   [socket STR]          # PF_LOCAL socket name to listen/connect
36   [port INT]            # PF_INET port number to listen/connect
37 }
38
39 # PCM type definition
40 pcm_type.NAME {
41   [lib STR]             # Library file (default libasound.so)
42   [open STR]            # Open function (default _snd_pcm_NAME_open)
43   [redirect {           # Redirect this PCM to an another
44      [filename STR]     # Configuration file specification
45      name STR           # PCM name specification
46   }]
47 }
48
49 # PCM scope type definition
50 pcm_scope_type.NAME {
51   [lib STR]             # Library file (default libasound.so)
52   [open STR]            # Open function (default _snd_pcm_scope_NAME_open)
53 }
54
55 # PCM scope definition
56 pcm_scope.NAME {
57   type STR              # Scope type
58   ...
59 }
60
61 # Slave PCM definition
62 pcm_slave.NAME {
63   pcm STR               # PCM name
64   # or
65   pcm { }               # PCM definition
66   format STR            # Format
67   channels INT          # Channels
68   rate INT              # Rate
69   period_time INT       # Period time
70   buffer_time INT       # Buffer time
71   etc.
72 }
73
74 # Hook arguments definition
75 hook_args.NAME {
76   ...                   # Arbitrary arguments
77 }
78
79 # PCM hook type
80 pcm_hook_type.NAME {
81   [lib STR]             # Library file (default libasound.so)
82   [install STR]         # Install function (default _snd_pcm_hook_NAME_install)
83 }
84
85 # PCM hook definition
86 pcm_hook.NAME {
87   type STR              # PCM Hook type (see pcm_hook_type)
88   [args STR]            # Arguments for install function (see hook_args)
89   # or
90   [args { }]            # Arguments for install function
91 }
92
93 # PCM definition
94 pcm.NAME {
95   type STR              # Type
96   [comment ANY]         # Saved comments
97
98
99 # PCM types:
100   type hw               # Kernel PCM
101   card INT/STR          # Card name or number
102   [device] INT          # Device number (default 0)     
103   [subdevice] INT       # Subdevice number, -1 first available (default -1)
104   mmap_emulation BOOL   # enable mmap emulation for ro/wo devices
105
106
107   type hooks            # PCM with hooks
108   slave STR             # Slave name (see pcm_slave)
109   # or
110   slave {               # Slave definition
111     pcm STR             # Slave PCM name
112     # or
113     pcm { }             # Slave PCM definition
114   }
115   hooks {
116     ID STR              # Hook name (see pcm_hook)
117     # or
118     ID { }              # Hook definition (see pcm_hook)
119   }
120
121   type plug             # Format adjusted PCM
122   slave STR             # Slave name (see pcm_slave)
123   # or
124   slave {               # Slave definition
125     pcm STR             # Slave PCM name
126     # or
127     pcm { }             # Slave PCM definition
128     [format STR]        # Slave format (default nearest) or "unchanged"
129     [channels INT]      # Slave channels (default nearest) or "unchanged"
130     [rate INT]          # Slave rate (default nearest) or "unchanged"
131   }
132   route_policy STR      # route policy for automatic ttable generation
133                         # STR can be 'default', 'average', 'copy', 'duplicate'
134                         # average: result is average of input channels
135                         # copy: only first channels are copied to destination
136                         # duplicate: duplicate first set of channels
137                         # default: copy policy, except for mono capture - sum
138   ttable {              # Transfer table (bidimensional compound of 
139                         # cchannels * schannels numbers)
140     CCHANNEL {
141       SCHANNEL REAL     # route value (0.0 ... 1.0)
142     }
143   }
144
145
146   type copy             # Copy conversion PCM
147   slave STR             # Slave name (see pcm_slave)
148   # or
149   slave {               # Slave definition
150     pcm STR             # Slave PCM name
151     # or
152     pcm { }             # Slave PCM definition
153   }
154
155
156   type linear           # Linear format conversion PCM
157   type adpcm            # IMA-ADPCM format conversion PCM
158   type alaw             # A-Law format conversion PCM
159   type mulaw            # Mu-Law format conversion PCM
160   slave STR             # Slave name (see pcm_slave)
161   # or
162   slave {               # Slave definition
163     pcm STR             # Slave PCM name
164     # or
165     pcm { }             # Slave PCM definition
166     format STR          # Slave format
167   }
168
169
170   type rate             # Rate conversion PCM
171   slave STR             # Slave name (see pcm_slave)
172   # or
173   slave {               # Slave definition
174     pcm STR             # Slave PCM name
175     # or
176     pcm { }             # Slave PCM definition
177     [format STR]        # Slave format (default client format)
178     rate INT            # Slave rate
179   }
180
181
182   type route            # Attenuated static route PCM
183   slave STR             # Slave name (see pcm_slave)
184   # or
185   slave {               # Slave definition
186     pcm STR             # Slave PCM name
187     # or
188     pcm { }             # Slave PCM definition
189     [format STR]        # Slave format (default client format)
190     [channels INT]      # Slave channels (default client channels)
191   }
192   ttable {              # Transfer table (bidimensional compound of 
193                         # cchannels * schannels numbers)
194     CCHANNEL {
195       SCHANNEL REAL     # route value (0.0 ... 1.0)
196     }
197   }
198
199
200   type multi            # Linked PCMs (exclusive access to selected channels)
201   slaves {              # Slaves definitions
202     ID STR              # Slave name for slave N (see pcm_slave)
203     # or
204     ID {                # Slave definition for slave N
205       pcm STR           # Slave PCM name
206     # or
207       pcm { }           # Slave PCM definition
208       channels INT      # Slave channels
209     }
210   }
211   bindings {            # Bindings table
212     N {                 # Binding for client channel N
213       slave STR         # Slave key
214       channel INT       # Slave channel
215     }
216   }
217   [master INT]          # Define the master slave
218
219
220   type file             # File plugin
221   slave STR             # Slave name (see pcm_slave)
222   # or
223   slave {               # Slave definition
224     pcm STR             # Slave PCM name
225     # or
226     pcm { }             # Slave PCM definition
227   }
228   file STR              # File name
229   # or
230   file INT              # File descriptor
231   [format STR]          # File format (NYI)
232   [perm INT]            # File permission (default 0600)
233
234   type meter            # Meter PCM
235   slave STR             # Slave name (see pcm_slave)
236   # or
237   slave {               # Slave definition or name
238     pcm STR             # Slave PCM name
239     # or
240     pcm { }             # Slave PCM definition
241   }
242   [frequency INT]       # Updates per second
243   scopes {              # Scopes
244     ID STR              # Scope name (see pcm_scope)
245   # or
246     ID { }              # Scope definition (see pcm_scope)
247   }
248
249
250   type droute           # Attenuated dynamic route PCM (NYI)
251   slave STR             # Slave name (see pcm_slave)
252   # or
253   slave {               # Slave definition
254     pcm STR             # Slave PCM name
255     # or
256     pcm { }             # Slave PCM definition
257     [format STR]        # Slave format (default client format)
258     [channels INT]      # Slave channels (default client channels)
259   }
260   ctl STR               # Ctl name
261   bindings {            # Bindings table
262     ID {                # Binding entry
263       cchannels {       # Client channels
264         C INT           # Client channel
265       }
266       schannel {        # Slave channels
267         S INT           # Slave channel
268       }
269       control STR       # Control name of C * S (or C values: only if C == S)
270     }
271   }
272
273
274   type null             # Null endpoint plugin
275   [time INT]            # Time related or not (NYI)
276
277
278   type shm              # Shared memory client PCM
279   server STR            # Server name
280   pcm STR               # PCM name on server
281
282
283   type share            # Share PCM
284   slave STR             # Slave name (see pcm_slave)
285   bindings {            # Bindings table
286     N INT               # Slave channel for client channel N
287   }
288
289
290   type mix              # Mix PCM
291   slave STR             # Slave name (see pcm_slave)
292   bindings {            # Bindings table
293     N INT               # Slave channel for client channel N
294   }
295
296
297   type ladspa           # LADSPA plugin PCM
298   slave STR             # Slave name (see pcm_slave)
299   path STR              # Path or paths (delimited with ':')
300   plugins | playback_plugins | capture_plugins {
301     N {                 # Configuration for LADSPA plugin N
302       id #              # LADSPA plugin ID (for example 1043)
303       label STR         # LADSPA plugin label (for example 'delay_5s')
304       filename STR      # Full filename of .so library with LADPA plugin code
305       policy STR        # Policy can be 'none' or 'duplicate'
306       input | output {
307         bindings {
308           C INT or STR  # C - channel, INT - audio port index, STR - audio port name
309         }
310         controls {
311           I INT or REAL # I - control port index, INT or REAL - control value
312         }
313       }
314     }
315   }
316
317   type dmix             # Direct mixing plugin
318   slave STR             # Slave name (see pcm_slave)
319   ipc_key INT           # Unique ipc key
320   ipc_perm INT          # ipc permissions (default 0600)
321   ipc_gid INT           # ipc gid (default -1 = disable)
322   ipc_key_add_uid BOOL  # Add current uid to ipc_key
323   bindings {            # Bindings table
324     N INT               # Slave channel for client channel N
325   }
326
327   type dsnoop           # Direct snoop (split one capture stream to more)
328   slave STR             # Slave name (see pcm_slave)
329   ipc_key INT           # Unique ipc key
330   ipc_perm INT          # ipc permissions (default 0600)
331   ipc_gid INT           # ipc gid (default -1 = disable)
332   ipc_key_add_uid BOOL  # Add current uid to ipc_key
333   bindings {            # Bindings table
334     N INT               # Slave channel for client channel N
335   }
336
337   type dshare           # Share channels from one stream
338   slave STR             # Slave name (see pcm_slave)
339   ipc_key INT           # Unique ipc key
340   ipc_perm INT          # ipc permissions (default 0600)
341   ipc_gid INT           # ipc gid (default -1 = disable)
342   ipc_key_add_uid BOOL  # Add current uid to ipc_key
343   bindings {            # Bindings table
344     N INT               # Slave channel for client channel N
345   }
346 }
347
348 # CTL type definition
349 ctl_type.NAME {
350   [lib STR]             # Library file (default libasound.so)
351   [open STR]            # Open function (default _snd_ctl_NAME_open)
352 }
353
354 # CTL definition
355 ctl.NAME {
356   type STR              # Type
357   [comment ANY]         # Saved comments
358
359 # CTL types
360   type hw
361   card STR/INT          # Card name or number
362
363
364   type shm              # Shared memory client CTL
365   server STR            # Server name
366   ctl STR               # CTL name on server
367
368
369 }
370
371
372 # RAWMIDI type definition
373 rawmidi_type.NAME {
374   [lib STR]             # Library file (default libasound.so)
375   [open STR]            # Open function (default _snd_rawmidi_NAME_open)
376 }
377
378 # RAWMIDI definition
379 rawmidi.NAME {
380   type STR              # Type
381   [comment ANY]         # Saved comments
382
383 # RAWMIDI types:
384   type hw               # Kernel RAWMIDI
385   card INT/STR          # Card name or number
386   [device] INT          # Device number (default 0)     
387   [subdevice] INT       # Subdevice number, -1 first available (default -1)
388
389
390 }
391
392 # SEQ type definition
393 seq_type.NAME {
394   [lib STR]             # Library file (default libasound.so)
395   [open STR]            # Open function (default _snd_seq_NAME_open)
396 }
397
398 # SEQ definition
399 seq.NAME {
400   type STR              # Type
401   [comment ANY]         # Saved comments
402
403 # SEQ types:
404   type hw               # Kernel SEQ
405
406
407 }
408
409 # Aliases
410 DEF.NAME1 NAME2         # DEF.NAME1 is an alias for DEF.NAME2
411
412 Some examples:
413
414 pcm.trident {
415         type hw
416         card 0
417         device 0
418 }
419
420 pcm.ice1712 {
421         type hw
422         card 1
423         device 0
424 }
425
426 pcm.ice1712_spdif {
427         type plug
428         ttable.0.8 1
429         ttable.1.9 1
430         slave.pcm ice1712
431 }
432
433 pcm_slave.rs {
434         pcm trident
435         rate 44100
436 }
437
438 pcm.r {
439         type rate
440         slave rs
441 }
442
443 pcm.m {
444         type meter
445         slave.pcm plug:trident
446         frequency 50
447         scopes [
448                 {
449                         type level
450                 }
451         ]
452 }
453
454 pcm_scope_type.level {
455         lib /home/abramo/scopes/scope-level.so
456
457
458 # an example command is 'aplay -D plug:ladspa <filename>'
459 # otherwise, the ladspa plugin expects FLOAT type which
460 # is very rare
461 pcm.ladspa {
462         type ladspa
463         slave.pcm "plughw:0,0";
464         path "/home/perex/src/ladspa_sdk/plugins";
465         plugins [
466                 {
467                         label delay_5s
468                         input {
469                                 controls [ 0.8 0.2 ]
470                         }
471                 }
472         ]
473 }
474
475 # an example command for dmix plugin to force 44100Hz mixing rate:
476 # aplay -D"plug:'dmix:RATE=44100'" <filename>
477 # an example command for dmix plugin to force 44100Hz and hw:1,0 output device
478 # aplay -Dplug:\'dmix:SLAVE=\"hw:1,0\",RATE=44100\' <filename>
479 # an example command for dmix plugin to force 32-bit signed little endian format
480 # aplay -D"plug:'dmix:FORMAT=S32_LE'" <filename>