Updated for 2.1b2 distribution.
[python/dscho.git] / Doc / lib / libsndhdr.tex
bloba7f8c6eaaea28f75299989598c9913981edc1318
1 \section{\module{sndhdr} ---
2 Determine type of sound file}
4 \declaremodule{standard}{sndhdr}
5 \modulesynopsis{Determine type of a sound file.}
6 \sectionauthor{Fred L. Drake, Jr.}{fdrake@acm.org}
7 % Based on comments in the module source file.
10 The \module{sndhdr} provides utility functions which attempt to
11 determine the type of sound data which is in a file. When these
12 functions are able to determine what type of sound data is stored in a
13 file, they return a tuple \code{(\var{type}, \var{sampling_rate},
14 \var{channels}, \var{frames}, \var{bits_per_sample})}. The value for
15 \var{type} indicates the data type and will be one of the strings
16 \code{'aifc'}, \code{'aiff'}, \code{'au'}, \code{'hcom'},
17 \code{'sndr'}, \code{'sndt'}, \code{'voc'}, \code{'wav'},
18 \code{'8svx'}, \code{'sb'}, \code{'ub'}, or \code{'ul'}. The
19 \var{sampling_rate} will be either the actual value or \code{0} if
20 unknown or difficult to decode. Similarly, \var{channels} will be
21 either the number of channels or \code{0} if it cannot be determined
22 or if the value is difficult to decode. The value for \var{frames}
23 will be either the number of frames or \code{-1}. The last item in
24 the tuple, \var{bits_per_sample}, will either be the sample size in
25 bits or \code{'A'} for A-LAW\index{A-LAW} or \code{'U'} for
26 u-LAW\index{u-LAW}.
29 \begin{funcdesc}{what}{filename}
30 Determines the type of sound data stored in the file \var{filename}
31 using \function{whathdr()}. If it succeeds, returns a tuple as
32 described above, otherwise \code{None} is returned.
33 \end{funcdesc}
36 \begin{funcdesc}{whathdr}{filename}
37 Determines the type of sound data stored in a file based on the file
38 header. The name of the file is given by \var{filename}. This
39 function returns a tuple as described above on success, or
40 \code{None}.
41 \end{funcdesc}