66 Recording Tutorial
6.9 File Formats
In the above sections we have assumed the le b eing stored contains just audio
data stored as 16 bit signed integers. This default is called the
raw
format. Other
formats are available by using the
-f
option followed by a format name. A full list
of p ossible formats can be displayatany time bytyping:
narecord -f help
Appendix B.1 describ es the enco ding of each format. In addition to the overall le
format, the type of data encoding can b e specied using the
-e
option. The valid
encoding choices are:
Linear
:
Direct linear enco ding of the data as signed integers. The precision of the
values defaults to 16 bits/sample, but can be changed using the
-p
option
described b elow. This is the default encoding.
IEEE
:
IEEE oating point format using 4 bytes/sample.
ALaw
:
One byte per sample, A-law companded data.
uLaw
:
One byte per sample,
-law companded data.
For example, the command:
narecord -f raw -e ieee -t 10 file
records 10 seconds of data and stores it as oating p ointnumb ers.
For the linear enco ding, the numb er of bits/sample can also be specied using the
-p
option. To record a le using 20-bit samples:
narecord -p20 file
Note that the data is assumed to be packed such that every pair of samples will
occupy 5 bytes. Valid choices of the precision are 4, 8, 12, 16, 20, 24, 28, or 32
bits/sample.
Note that not all combinations of the
-f
,
-e
, and
-p
options are valid. Certain le
formats supp ort only particular enco dings and precisions. Also, when sample-rate
conversion is used only 16 bits/sample, linear encoding is available.
6.10 Using Standard Output
If no lename is given on the command line, then the audio data will be directed to
the standard output. This allows another program which accepts sampled data to