blob: a7f8c6eaaea28f75299989598c9913981edc1318 [file] [log] [blame]
Fred Drake60adb361999-01-05 23:09:12 +00001\section{\module{sndhdr} ---
Fred Drakef8ca7d82000-10-10 17:03:45 +00002 Determine type of sound file}
Fred Drake60adb361999-01-05 23:09:12 +00003
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.
8
9
10The \module{sndhdr} provides utility functions which attempt to
11determine the type of sound data which is in a file. When these
12functions are able to determine what type of sound data is stored in a
13file, 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
20unknown or difficult to decode. Similarly, \var{channels} will be
21either the number of channels or \code{0} if it cannot be determined
22or if the value is difficult to decode. The value for \var{frames}
23will be either the number of frames or \code{-1}. The last item in
24the tuple, \var{bits_per_sample}, will either be the sample size in
25bits or \code{'A'} for A-LAW\index{A-LAW} or \code{'U'} for
26u-LAW\index{u-LAW}.
27
28
29\begin{funcdesc}{what}{filename}
30 Determines the type of sound data stored in the file \var{filename}
Fred Drakec5533581999-01-06 15:21:19 +000031 using \function{whathdr()}. If it succeeds, returns a tuple as
32 described above, otherwise \code{None} is returned.
Fred Drake60adb361999-01-05 23:09:12 +000033\end{funcdesc}
34
35
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}