cinap_lenrekadd hg and python4bb9e2215 years agoHistory
41 lines · 1.8 KB · TeX
RawDownload
\section{\module{sndhdr} ---         Determine type of sound file} \declaremodule{standard}{sndhdr}\modulesynopsis{Determine type of a sound file.}\sectionauthor{Fred L. Drake, Jr.}{fdrake@acm.org}% Based on comments in the module source file.  The \module{sndhdr} provides utility functions which attempt todetermine the type of sound data which is in a file.  When thesefunctions are able to determine what type of sound data is stored in afile, they return a tuple \code{(\var{type}, \var{sampling_rate},\var{channels}, \var{frames}, \var{bits_per_sample})}.  The value for\var{type} indicates the data type and will be one of the strings\code{'aifc'}, \code{'aiff'}, \code{'au'}, \code{'hcom'},\code{'sndr'}, \code{'sndt'}, \code{'voc'}, \code{'wav'},\code{'8svx'}, \code{'sb'}, \code{'ub'}, or \code{'ul'}.  The\var{sampling_rate} will be either the actual value or \code{0} ifunknown or difficult to decode.  Similarly, \var{channels} will beeither the number of channels or \code{0} if it cannot be determinedor if the value is difficult to decode.  The value for \var{frames}will be either the number of frames or \code{-1}.  The last item inthe tuple, \var{bits_per_sample}, will either be the sample size inbits or \code{'A'} for A-LAW\index{A-LAW} or \code{'U'} foru-LAW\index{u-LAW}.  \begin{funcdesc}{what}{filename}  Determines the type of sound data stored in the file \var{filename}  using \function{whathdr()}.  If it succeeds, returns a tuple as  described above, otherwise \code{None} is returned.\end{funcdesc}  \begin{funcdesc}{whathdr}{filename}  Determines the type of sound data stored in a file based on the file   header.  The name of the file is given by \var{filename}.  This  function returns a tuple as described above on success, or  \code{None}.\end{funcdesc}