1AXFER-TRANSFER(1)           General Commands Manual          AXFER-TRANSFER(1)
2
3
4

NAME

6       axfer-transfer  - transferrer of audio data frame for sound devices and
7       nodes.
8
9

SYNOPSIS

11       axfer transfer direction [  common-options  ]  [  backend-options  ]  [
12       filepath ]
13
14       axfer  transfer  direction  [ common-options ] [ backend-options ] -I |
15       --separate-channels filepath ...
16
17       direction = capture | playback
18
19       common-options = ( read OPTIONS section )
20
21       backend-options = ( read OPTIONS section )
22
23       filepaths = ( read OPTIONS section )
24
25

DESCRIPTION

27       The transfer subcommand of axfer performs transmission  of  audio  data
28       frames  for  devices  available  in supported backends. This program is
29       essentially designed to use alsa-lib APIs (libasound backend) to handle
30       sound devices supported by Linux sound subsystem (ALSA).
31
32

OPTIONS

34   Direction
35       capture
36              Operates for capture transmission.
37
38
39       playback
40              Operates for playback transmission.
41
42
43   Filepath
44       Filepath  is handled as a path relative to current working directory of
45       run time if it's not full path from root directory.
46
47       The standard input or output is used if filepath is  not  specified  or
48       given as '-' .
49
50       For  playback  transmission,  container  format  of given I filepath is
51       detected automatically and metadata is used for  parameters  of  sample
52       format, channels, rate, duration. If nothing detected, content of given
53       file path is handled as raw data. In this case, the  parameters  should
54       be indicated as options.
55
56       Multiple filepaths are allowed with -I | --separate-channels option. In
57       this case, standard  input  and  output  is  not  available.  The  same
58       filepath is not allowed except for paths listed below:
59        - /dev/null
60        - /dev/zero
61        - /dev/full
62        - /dev/random
63        - /dev/urandom
64
65
66   Common options
67       -h, --help
68              Print help messages and finish run time. Not yet implemented.
69
70
71       -q, --quiet
72              Quiet mode. Suppress messages (not sound :))
73
74
75       -v, --verbose
76              Verbose  mode.  Runtime dumps supplemental information according
77              to the number of this option given in command line.
78
79
80       -d, --duration=#
81              Interrupt after # seconds. A value of zero means  infinity.  The
82              default is zero, so if this option is omitted then the transmis‐
83              sion process will run until it is killed. Either -d or -s option
84              is available exclusively.
85
86
87       -s, --samples=#
88              Interrupt after transmission of # number of data frames. A value
89              of zero means infinity. The default is zero, so if this  options
90              is  omitted  then  the transmission process will run until it is
91              killed. Either -d or -s option is available exclusively.
92
93
94       -f, --format=FORMAT
95              Indicate format of audio sample. This is  required  for  capture
96              transmission,  or playback transmission with files including raw
97              audio data.
98
99              Available sample format is listed below:
100               - [S8|U8|S16|U16|S32|U32][_LE|_BE]
101               - [S24|U24][_LE|_BE]
102               - FLOAT[_LE|_BE]
103               - FLOAT64[_LE|_BE]
104               - IEC958_SUBFRAME[_LE|_BE]
105               - MU_LAW
106               - A_LAW
107               - [S20|U20][_LE|_BE]
108               - [S24|U24][_3LE|_3BE]
109               - [S20|U20][_3LE|_3BE]
110               - [S18|U18][_3LE|_3BE]
111               - DSD_U8
112               - DSD_[U16|U32][_LE|_BE]
113
114              If endian-ness is omitted, host endian-ness is used.
115
116              Some special formats are available:
117               - cd (16 bit little endian, 44100, stereo) [= -f S16_LE -c 2 -r
118              44100]
119               -  cdr  (16 bit big endian, 44100, stereo) [= -f S16_BE -c 2 -f
120              44100]
121               - dat (16 bit little endian, 48000, stereo) [= -f S16_LE  -c  2
122              -r 48000]
123
124              If  omitted,  U8  is used as a default. Actual available formats
125              are restricted by each transmission backend.
126
127              Unavailable sample format is listed below. These format has size
128              of data frame unaligned to byte unit.
129
130               - IMA_ADPCM
131               - MPEG
132               - GSM
133               - SPECIAL
134               - G723_24
135               - G723_24_1B
136               - G723_40
137               - G723_40_1B
138
139
140       -c, --channels=#
141              Indicate  the  number  of  audio data samples per frame. This is
142              required for capture transmission, or playback transmission with
143              files including raw audio data. The value should be between 1 to
144              256 . If omitted, 1 is used as a default.
145
146
147       -r, --rate=#
148              Indicate the number of audio data  frame  per  second.  This  is
149              required for capture transmission, or playback transmission with
150              files including raw audio data. If the value is less than 1000 ,
151              it's  interpreted  by kHz unit. The value should be between 2000
152              and 192000 . If omitted, 8000 is used as a default.
153
154
155       -t, --file-type=TYPES
156              Indicate the type of file. This is required for  capture  trans‐
157              mission. Available types are listed below:
158               - wav: Microsoft/IBM RIFF/Wave format
159               - au, sparc: Sparc AU format
160               - voc: Creative Tech. voice format
161               - raw: raw data
162
163              When nothing is indicated, for capture transmission, the type is
164              decided according to suffix of filepath , and raw type  is  used
165              for fallback.
166
167
168       -I, --separate-channels
169              Indicate this option when several files are going to be handled.
170              For capture transmission, if one filepath is given as filepath ,
171              a    list    of    filepaths   is   generated   in   a   formula
172              '<filepath>-<sequential number>[.suffix]'.  The suffix is  omit‐
173              ted when raw format of container is used.
174
175
176       --dump-hw-params
177              Dump hardware parameters and finish run time if backend supports
178              it.
179
180
181       --xfer-backend=BACKEND
182              Select backend of transmission from a list below. The default is
183              libasound.
184               - libasound
185               - libffado (optional if compiled)
186
187
188   Backend options for libasound
189       -D, --device
190
191              This  option  is used to select PCM node in libasound configura‐
192              tion space.  Available nodes are listed by pcm operation of list
193              subcommand.
194
195
196       -N, --nonblock
197
198              With  this option, PCM substream is opened in non-blocking mode.
199              When audio data frame is not available in buffer of the PCM sub‐
200              stream,  I/O  operation  immediately  returns  without  blocking
201              process. This option implicitly  uses  --waiter-type  option  as
202              well to prevent heavy consumption of CPU time.
203
204
205       -M, --mmap
206
207              With this option, audio data frame is processed directly in buf‐
208              fer of PCM substream if selected node supports  this  operation.
209              Without  the  option,  temporary  buffers are used to copy audio
210              data frame for buffer of PCM substream.  This option  implicitly
211              uses  --waiter-type  option as well to prevent heavy consumption
212              of CPU time.
213
214
215       -F, --period-size
216
217              This option  configures  given  value  to  period_size  hardware
218              parameter  of  PCM substream. The parameter indicates the number
219              of audio data frame per period in buffer of the  PCM  substream.
220              Actual number is decided as a result of interaction between each
221              implementation of PCM plugin chained from the selected PCM node,
222              and in-kernel driver or PCM I/O plugins.
223
224              Ideally, the same amount of audio data frame as the value should
225              be handled in one I/O operation. Actually, it is not,  depending
226              on  implementation of the PCM plugins, in-kernel driver, PCM I/O
227              plugins and scheduling model.  For  'hw'  PCM  plugin  in  'irq'
228              scheduling model, the value is used to decide intervals of hard‐
229              ware interrupt, thus the same amount of audio data frame as  the
230              value is expected to be available for one I/O operation.
231
232
233       --period-time
234
235              This  option  configures  given  value  to  period_time hardware
236              parameter  of  PCM  substream.  This  option   is   similar   to
237              --period-size option, however its unit is micro-second.
238
239
240       -B, --buffer-size
241
242              This  option  configures  given  value  to  buffer_size hardware
243              parameter of PCM substream. The parameter indicates  the  number
244              of audio data frame in buffer of PCM substream. Actual number is
245              decided as a result of interaction between  each  implementation
246              of  PCM plugin chained from the selected PCM node, and in-kernel
247              driver or PCM I/O plugins.
248
249              Ideally, this is multiples of the number of audio data frame per
250              period,  thus the size of period. Actually, it is not, depending
251              on implementation of the PCM plugins, in-kernel driver  and  PCM
252              I/O plugins.
253
254
255       --buffer-time
256
257              This  option  configures  given  value  to  buffer_time hardware
258              parameter of PCM substream. This option  is  similar  to  --buf‐
259              fer-size option, however its unit is micro-second.
260
261
262       --waiter-type
263
264              This option indicates the type of waiter for event notification.
265              At present, four types are available; default ,  select  ,  poll
266              and  epoll  .  With default type, 'snd_pcm_wait()' is used. With
267              select type, 'select(2)' system call is used.  With  poll  type,
268              'poll(2)'  system  call is used. With epoll type, Linux-specific
269              'epoll(7)' system call is used.
270
271              This option should correspond to one  of  --nonblock  or  --mmap
272              options,  or  timer value of --sched-model option.  Neither this
273              option nor --test-nowait is available at the same time.
274
275
276       --sched-model
277
278              This option selects scheduling model for process  of  this  pro‐
279              gram.  One  of irq or timer is available. In detail, please read
280              'SCHEDULING MODEL' section.
281
282              When nothing specified, irq model is used.
283
284
285       -A, --avail-min
286
287              This option configures given value to avail-min software parame‐
288              ter  of  PCM  substream.  In blocking mode, the value is used as
289              threshold of the number of available audio data frames in buffer
290              of PCM substream to wake up process blocked by I/O operation. In
291              non-blocking mode, any I/O operation returns -EAGAIN untill  the
292              available number of audio data frame reaches the threshold.
293
294              This  option  has  an  effect  in cases neither --mmap nor timer
295              value of --sched-model option is used.
296
297
298       -R, --start-delay
299
300              This option configures given value to  start_threshold  software
301              parameter  of  PCM  substream. The value is used as threshold to
302              start PCM substream automatically. At present, this  option  has
303              an   effect   in   cases  neither  --mmap  nor  timer  value  of
304              --sched-model option is used.
305
306              For playback transmission, when the number of accumulated  audio
307              data  frame  in  buffer  of  PCM substream to which this program
308              writes out reaches the threshold, the PCM substream starts auto‐
309              matically without an explicit call of snd_pcm_start() to the PCM
310              substream.
311
312              For capture transmission, this option is useless. The number  of
313              accumulated  audio  data  frame  is  not  increased  without  an
314              explicit call of snd_pcm_start() to the PCM substream.
315
316              This option has an effect in  cases  neither  --mmap  nor  timer
317              value of --sched-model option is used.
318
319
320       -T, --stop-delay
321
322              This  option  configures  given value to stop_threshold software
323              parameter of PCM substream. The value is used  as  threshold  to
324              stop PCM substream automatically. At present, this option has an
325              effect in cases neither --mmap nor timer value of  --sched-model
326              option is used.
327
328              For  capture  transmission, when the number of accumulated audio
329              data frame in buffer of PCM  substream  to  which  a  driver  or
330              alsa-lib  PCM  plugins write reaches the threshold, the PCM sub‐
331              stream  stops  automatically  without  an   explicit   call   of
332              snd_pcm_stop()  to  the  PCM substream. This is a case that this
333              program leaves the audio  data  frames  without  reading  for  a
334              while.
335
336              For  playback transmission, when the number available audio data
337              frame in buffer of PCM substream from which a driver or alsa-lib
338              PCM  plugins read reaches the threshold, the PCM substream stops
339              automatically without an explicit call of snd_pcm_stop() to  the
340              PCM substream. This is a case that this program leaves the audio
341              data frames without writing for a while.
342
343              This option has an effect in  cases  neither  --mmap  nor  timer
344              value of --sched-model option is used.
345
346
347       --disable-resample
348
349              This  option has an effect for 'plug' plugin in alsa-lib to sup‐
350              press conversion of sampling rate for audio data frame.
351
352
353       --disable-channels
354
355              This option has an effect for 'plug' plugin in alsa-lib to  sup‐
356              press conversion of channels for audio data frame.
357
358
359       --disable-format
360
361              This  option has an effect for 'plug' plugin in alsa-lib to sup‐
362              press conversion of sample format for audio data frame.
363
364
365       --disable-softvol
366
367              This option has an effect for 'softvol' plugin  in  alsa-lib  to
368              suppress  conversion  of  samples for audio data frame via addi‐
369              tional control element.
370
371
372       --fatal-errors
373
374              This option suppresses recovery operation  from  XRUN  state  of
375              running  PCM substream, then process of this program is going to
376              finish as usual.
377
378
379       --test-nowait
380
381              This option disables any waiter for I/O event notification.  I/O
382              operations  are  iterated till any of audio data frame is avail‐
383              able. The option brings heavy load in consumption of CPU time.
384
385
386   Backend options for libffado
387       This backend is automatically available when configure  script  detects
388       ffado_streaming_init() symbol in libffado shared object.
389
390
391       -p, --port
392
393              This  option  uses  given  value  to decide which 1394 OHCI con‐
394              troller is used to communicate. When Linux system has  two  1394
395              OHCI  controllers, 0 or 1 are available. Neither this option nor
396              -g is available at the same time. If nothing specified, libffado
397              performs to communicate to units on IEEE 1394 bus managed by all
398              of 1394 OHCI controller available in Linux system.
399
400
401       -n, --node
402
403              This option uses given value to decide which  unit  is  used  to
404              communicate.  This  option  requires -p option to indicate which
405              1394 OHCI controller is used to  communicate  to  the  specified
406              unit.
407
408
409       -g, --guid
410
411              This option uses given value to decide a target unit to communi‐
412              cate. The value should be prefixed with  '0x'  and  consists  of
413              hexadecimal literal letters (0-9, a-f, A-F). Neither this option
414              nor -p is available at the  same  time.  If  nothing  specified,
415              libffado  performs to communicate to units on IEEE 1394 bus man‐
416              aged by all of 1394 OHCI controller available in Linux system.
417
418
419       --frames-per-period
420
421              This option uses given value to decide the number of audio  data
422              frame in one read/write operation. The operation is blocked till
423              the number of available  audio  data  frame  exceeds  the  given
424              value. As a default, 512 audio data frames is used.
425
426
427       --periods-per-buffer
428
429              This  option uses given value to decide the size of intermediate
430              buffer between this program and libffado. As a default, 2  peri‐
431              ods per buffer is used.
432
433
434       --slave
435
436              This option allows this program to run slave mode. In this mode,
437              libffado adds unit directory into configuration ROM of 1394 OHCI
438              controller  where  Linux  system runs. The unit directory can be
439              found by the other node on the same bus.  Linux  system  running
440              on  the  node  can  transfer  isochronous packet with audio data
441              frame to the unit. This  program  can  receive  the  packet  and
442              demultiplex the audio data frame.
443
444
445       --snoop
446
447              This option allows this program to run snoop mode. In this mode,
448              libffado listens all isochronous channels. When isochronous com‐
449              munication  starts  by any unit on the same bus, the packets can
450              be handled by this program.
451
452
453       --sched-priority
454
455              This  option  executes  pthread_setschedparam()  in  a  call  of
456              ffado_streaming_init()  to configure scheduling policy and given
457              value as its priority for threads related to isochronous  commu‐
458              nication.  The given value should be within RLIMIT_RTPRIO param‐
459              eter of process. Please read getrlimit(2) for details.
460
461

POSIX SIGNALS

463       During transmission, SIGINT and SIGTERM will close  handled  files  and
464       PCM substream to be going to finish run time.
465
466       SIGTSTP will suspend PCM substream and SIGCONT will resume it. No XRUNs
467       are expected. With libffado backend, the  suspend/resume  is  not  sup‐
468       ported and runtime is aboeted immediately.
469
470       The other signals perform default behaviours.
471
472

EXAMPLES

474           $ axfer transfer playback -d 1 something
475
476       The  above will transfer audio data frame in 'something' file for play‐
477       back during 1 second.  The sample format is detected automatically as a
478       result  to parse 'something' as long as it's compliant to one of Micro‐
479       soft/IBM RIFF/Wave, Sparc AU, Creative Tech. voice formats. If  nothing
480       detected,  -r  ,  -c and -f should be given, or -f should be given with
481       special format.
482
483
484           $ axfer transfer playback -r 22050 -c 1 -f S16_LE -t raw something
485
486       The above will transfer audio data frame in 'something' file  including
487       no  information  of sample format, as sample format of 22050 Hz, monau‐
488       ral, signed 16 bit little endian PCM  for  playback.  The  transmission
489       continues till catching SIGINT from keyboard or SIGTERM by kill(1) .
490
491
492           $ axfer transfer capture -d 10 -f cd something.wav
493
494       The  above  will  transfer  audio data frame to 'something.wav' file as
495       sample format of 44.1 kHz, 2 channels, signed 16 bit little endian PCM,
496       during 10 seconds. The file format is Microsoft/IBM RIFF/Wave according
497       to suffix of the given filepath .
498
499
500           $ axfer transfer capture -s 1024 -r 48000 -c 2 -f S32_BE -I -t au channels
501
502       The above will transfer audio data frame as sample format of 48.0  kHz,
503       2  channels,  signed  32  bit  big  endian PCM for 1,024 number of data
504       frames to files named 'channels-1.au' and 'channels-2.au'.
505
506

SCHEDULING MODEL

508       In a design of ALSA PCM core, runtime of  PCM  substream  supports  two
509       modes;  period-wakeup  and  no-period-wakeup.   These two modes are for
510       different scheduling models.
511
512
513   IRQ-based scheduling model
514       As a default, period-wakeup mode is used. In this mode, in-kernel driv‐
515       ers  should  operate  hardware  to generate periodical notification for
516       transmission of audio data  frame.  The  interval  of  notification  is
517       equivalent to the same amount of audio data frame as one period of buf‐
518       fer, against actual time.
519
520       In a handler assigned to the notification, a helper  function  of  ALSA
521       PCM  core  is called to update a position to head of hardware transmis‐
522       sion, then compare it with a position to head of application  operation
523       to judge overrun/underrun (XRUN) and to wake up blocked processes.
524
525       For  this purpose, hardware IRQ of controller for serial audio bus such
526       as Inter-IC sound is typically used. In this case, the controller  gen‐
527       erates  the  IRQ  according to transmission on the serial audio bus. In
528       the handler assigned to the IRQ, direct media access (DMA) transmission
529       is requested between dedicated host memory and device memory.
530
531       If target hardware doesn't support this kind of mechanism, the periodi‐
532       cal notification should be emulated by any timer; e.g. hrtimer,  kernel
533       timer.   External  PCM  plugins generated by PCM plugin SDK in alsa-lib
534       should also emulate the above behaviour.
535
536       In this mode, PCM applications are programmed according to typical  way
537       of  I/O  operations.  They  execute blocking system calls to read/write
538       audio data frame in buffer of PCM substream, or blocking  system  calls
539       to  wait  until  any  audio data frame is available. In axfer , this is
540       called IRQ-based scheduling model and a default  behaviour.  Users  can
541       explicitly  configure  this  mode by usage of --sched-model option with
542       irq value.
543
544
545   Timer-based scheduling model
546       The no-period-wakeup mode is an optional mode of runtime  of  PCM  sub‐
547       stream.  The  mode assumes a specific feature of hardware and assist of
548       in-kernel driver and PCM applications. In this mode, in-kernel  drivers
549       don't  operate  hardware to generate periodical notification for trans‐
550       mission of audio data frame.  The hardware  should  automatically  con‐
551       tinue  transmission of audio data frame without periodical operation of
552       the drivers; e.g. according to auto-triggered DMA transmission, a chain
553       of registered descriptors.
554
555       In  this mode, nothing wakes up blocked processes, therefore PCM appli‐
556       cations should be programmed without any blocking operation.  For  this
557       reason,  this mode is enabled when the PCM applications explicitly con‐
558       figure hardware parameter to runtime of PCM substream, to prevent  dis‐
559       order of existing applications.  Additionally, nothing maintains timing
560       for transmission of audio data frame, therefore  the  PCM  applications
561       should voluntarily handle any timer to queue audio data frame in buffer
562       of the PCM substream for lapse of time. Furthermore, instead of driver,
563       the  PCM  application should call a helper function of ALSA PCM core to
564       update a position to head of hardware transmission and to check XRUN.
565
566       In axfer , this is called timer-based scheduling model and available as
567       long  as hardware/driver assists no-period-wakeup runtime. Users should
568       explicitly set this mode by usage of --sched-model  option  with  timer
569       value.
570
571       In  the  scheduling  model,  PCM applications need to care of available
572       space on PCM buffer by lapse of time, typically  by  yielding  CPU  and
573       wait  for  rescheduling.  For  the  yielding, timeout is calculated for
574       preferable amount of PCM frames to process. This  is  convenient  to  a
575       kind  of  applications,  like  sound servers. when an I/O thread of the
576       server wait for the timeout, the other threads can process  audio  data
577       frames  for  server  clients. Furthermore, with usage of rewinding/for‐
578       warding, applications can  achieve  low  latency  between  transmission
579       position and handling position even if they uses large size of PCM buf‐
580       fers.
581
582
583   Advantages and issues
584       Ideally,  timer-based  scheduling  model  has  some   advantages   than
585       IRQ-based scheduling model. At first, no interrupt context runs for PCM
586       substream. The PCM substream is handled in any process context only. No
587       need  to care of race conditions between IRQ and process contexts. This
588       reduces some concerns for some developers of drivers and  applications.
589       Secondary,  CPU time is not used for handlers on the interrupt context.
590       The CPU time can be dedicated for the other tasks. This is  good  in  a
591       point  of  Time  Sharing System. Thirdly, hardware is not configured to
592       generate interrupts. This is good in a point of  reduction  of  overall
593       power consumption possibly.
594
595       In  either  scheduling model, the hardware should allow drivers to read
596       the number of audio data frame transferred between the dedicated memory
597       and  the  device  memory  for audio serial bus. However, in timer-based
598       scheduling model, fine granularity and accuracy of the value is  impor‐
599       tant.  Actually hardware performs transmission between dedicated memory
600       and device memory for a small batch of audio data frames or bytes. In a
601       view  of  PCM  applications, the granularity in current transmission is
602       required to decide correct timeout for each I/O operation. As of  Linux
603       kernel  v4.21,  ALSA PCM interface between kernel/userspace has no fea‐
604       ture to report it.
605
606

COMPATIBILITY TO APLAY

608       The transfer subcommand of axfer is designed to keep  compatibility  to
609       aplay(1).  However some options below are not compatible due to several
610       technical reasons.
611
612
613       -I, --separate-channels
614              This option is supported just for  files  to  store  audio  data
615              frames  corresponding  to  each channel. In aplay(1) implementa‐
616              tion, this option has an additional effect  to  use  PCM  buffer
617              aligned to non-interleaved order if a target device supports. As
618              of 2018, PCM buffer of non-interleaved order is hardly  used  by
619              sound devices.
620
621
622       -A, --avail-min
623              This  option indicates threshold to wake up blocked process in a
624              unit of audio data frame. Against aplay(1) implementation,  this
625              option  has  no  effect  with  --mmap option as well as timer of
626              --sched-model option.
627
628
629       -R, --start-delay
630              This option indicates threshold to start prepared PCM  substream
631              in  a unit of audio data frame. Against aplay(1) implementation,
632              this option has no effect with --mmap option as well as timer of
633              --sched-model option.
634
635
636       -T, --stop-delay
637              This option indicates threshold to stop running PCM substream in
638              a unit of audio data  frame.  Against  aplay(1)  implementation,
639              this option has no effect with --mmap option as well as timer of
640              --sched-model option.
641
642
643       --max-file-time=#
644              This option is  unsupported.  In  aplay(1)  implementation,  the
645              option  has  an effect for capture transmission to save files up
646              to the same number of data frames as the given value  by  second
647              unit,  or  the  maximum  number of data frames supported by used
648              file format. When reaching  to  the  limitation,  used  file  is
649              closed,  then new file is opened and audio data frames are writ‐
650              ten. However, this option requires extra handling of  files  and
651              shall increase complexity of main loop of axfer.
652
653
654       --use-strftime=FORMAT
655              This  option  is  unsupported.  In  aplay(1) implementation, the
656              option has an effect for capture transmission to  generate  file
657              paths  according to given format in which some extra formats are
658              available as well as formats supported by strftime(3).  However,
659              this  option requires extra string processing for file paths and
660              it's bothersome if written in C language.
661
662
663       --process-id-file=FILEPATH
664              This option is  unsupported.  In  aplay(1)  implementation,  the
665              option  has an effect to create a file for given value and write
666              out process ID to it. This file allows users to get  process  ID
667              and  send any POSIX signal to aplay process.  However, this idea
668              has some troubles for file locking when multiple aplay processes
669              run with the same file.
670
671
672       -V, --vumeter=TYPE
673              This option is not supported at present. In aplay(1) implementa‐
674              tion, this option has an effect to occupy stdout with some  ter‐
675              minal  control  characters  and display vumeter for monaural and
676              stereo channels. However, some problems  lay;  this  feature  is
677              just  for audio data frames with PCM format, this feature brings
678              disorder of terminal after aborting, stdout is not available for
679              pipeline.
680
681
682       -i, --interactive
683              This option is not supported at present. In aplay(1) implementa‐
684              tion, this option has an effect to occupy stdin  for  key  input
685              and  suspend/resume PCM substream according to pushed enter key.
686              However, this feature requires an additional input  handling  in
687              main  loop  and  leave bothersome operation to maintain PCM sub‐
688              stream.
689
690
691       SIGTSTP, SIGCONT
692              This performs  suspend/resume  of  PCM  substream.  In  aplay(1)
693              implementation,  these  operations  bring XRUN state to the sub‐
694              stream, and suspend/resume is done in interactive  mode  in  the
695              above.  Some  developers  use  the signal for recovery test from
696              XRUN. At present, no alternative is supported for the test.
697
698
699       SIGUSR1
700              This is not supported. In aplay(1) implementation,  this  signal
701              is  assigned to a handler to close a current file to store audio
702              data frame and open a new file to continue processing.  However,
703              as  well  as --max-file-time option, this option should increase
704              complexity of main loop of axfer.
705
706

DESIGN

708   Modular structure
709       This program consists of three modules; xfer , mapper and  container  .
710       Each module has an abstraction layer to enable actual implementation.
711
712                  --------     ----------     -------------
713       device <-> | xfer | <-> | mapper | <-> | container | <-> file
714                  --------     ----------     -------------
715                   libasound    single         wav
716                   libffado     multiple       au
717                                               voc
718                                               raw
719
720       The  xfer module performs actual transmission to devices and nodes. The
721       module can have several transmission backends. As  a  default  backend,
722       libasound  backend  is  used to perform transmission via alsa-lib APIs.
723       The module allows each backend to parse own command line options.
724
725       The container module  performs  to  read/write  audio  data  frame  via
726       descriptor  for  file/stream  of  multimedia container or raw data. The
727       module automatically detect type  of  multimedia  container  and  parse
728       parameters  in  its metadata of data header. At present, three types of
729       multimedia containers are supported; Microsoft/IBM RIFF/Wave (  wav  ),
730       Sparc  AU ( au ) and Creative Technology voice ( voc ). Additionally, a
731       special container is prepared for raw audio data ( raw ).
732
733       The mapper module handles buffer layout and alignment for  transmission
734       of  audio  data  frame.  The module has two implementations; single and
735       multiple .  The single backend uses one container to construct the buf‐
736       fer. The multiple backend uses several containers to construct it.
737
738
739   Care of copying audio data frame
740       Between  the xfer module and mapper module, a pointer to buffer includ‐
741       ing audio data frames is passed. This buffer has two shapes for  inter‐
742       leaved and non-interleaved order. For the former, the pointer points to
743       one buffer. For the latter, the pointer points to  an  array  in  which
744       each  element  points to one buffer. Between the mapper module and con‐
745       tainer module, a pointer to one  buffer  is  passed  because  supported
746       media  containers  including raw type store audio data frames in inter‐
747       leaved order.
748
749       In passing audio data frame between the modules, axfer is programmed to
750       avoid  copying  between a buffer to another buffer as much as possible.
751       For example, in some scenarios below, no copying  occurs  between  mod‐
752       ules.
753
754        - xfer(mmap/interleaved), mapper(single), container(any)
755        - xfer(mmap/non-interleaved), mapper(multiple), containers(any)
756
757

SEE ALSO

759        axfer(1), axfer-list(1), alsamixer(1), amixer(1)
760
761

AUTHOR

763       Takashi Sakamoto <o-takashi@sakamocchi.jp>
764
765
766
767alsa-utils                     28 November 2018              AXFER-TRANSFER(1)
Impressum