[Back to overview]

writeloop --help

writeloop (version 0.7 of frankl's stereo utilities)
  writeloop --block-size=<bsize> --file-size=<fsize> <file1> <file2> [<file3>..]

  This program 'writeloop' reads data from stdin or a file and writes them 
  cyclically into the files whose names <file1>, ..., are given on the 
  command line. (If the next file to be written exists then the program 
  will wait until it is deleted.)

  Some overhead can be saved by using shared memory files instead of files
  in a file system. See the --shared option below.

  This can be used together with 'catloop' which does the converse
  (reading the files cyclically and writing a stream to stdout).

  The given files should be on a ramdisk. writeloop/catloop provide
  a buffer for data read from a hard disk or from the network.

  --block-size=intval, -b intval
      the size in bytes of the data chunks written to the given filenames.
      Default is 2000 bytes.

  --file-size=intval, -f intval
      the maximal size of the written files (default is 64000).
  --from-file=fname,  -F fname
      read data from file fname instead of stdin.

  --shared, -s
      use named shared memory instead of files. The convention is that
      the given names start with a slash like '/file1'.
      For large amounts of shared memory you may need to enlarge
      '/proc/sys/kernel/shmmax' directly or via sysctl.

  --version, -V
      print information about the version of the program and abort.

  --help, -h
      print this help page and abort.

  If you want to play an audio file (CD format) on a hard disk or on a 
  network file system, you can use writeloop and catloop as a buffer:

       sox /my/disk/cd.flac -t raw | writeloop --block-size=4000 \
                --file-size=20000 /ramdisk/aa /ramdisk/bb /ramdisk/cc &

       catloop --block-size=1000 /ramdisk/aa /ramdisk/bb /ramdisk/cc | \
             aplay -t raw -f S16_LE -c 2 -r44100 -D "hw:0,0" 

  Or similarly, using less system resources, with shared memory:

       sox /my/disk/cd.flac -t raw | writeloop --block-size=4000 \
                --file-size=20000 --shared /aa /bb /cc &

       catloop --block-size=1000 --shared /aa /bb /cc | \
             aplay -t raw -f S16_LE -c 2 -r44100 -D "hw:0,0" 

  In experiments I found that audio playback was improved compared to a 
  direct playing. For larger file sizes (a few megabytes) the effect was
  similar to copying the file into RAM and playing that file.
  But even better was the effect with small file sizes (a few kilobytes)
  such that all files fit into the processor cache.