GNU Info

Info Node: (python2.1-lib.info)sndhdr

(python2.1-lib.info)sndhdr


Prev: imghdr Up: Multimedia Services
Enter node , (file) or (file)node

Determine type of sound file
============================

Determine type of a sound file.

This manual section was written by Fred L. Drake, Jr. <fdrake@acm.org>.
The `sndhdr' provides utility functions which attempt to determine the
type of sound data which is in a file.  When these functions are able
to determine what type of sound data is stored in a file, they return a
tuple `(TYPE, SAMPLING_RATE, CHANNELS, FRAMES, BITS_PER_SAMPLE)'.  The
value for TYPE indicates the data type and will be one of the strings
`'aifc'', `'aiff'', `'au'', `'hcom'', `'sndr'', `'sndt'', `'voc'',
`'wav'', `'8svx'', `'sb'', `'ub'', or `'ul''.  The SAMPLING_RATE will
be either the actual value or `0' if unknown or difficult to decode.
Similarly, CHANNELS will be either the number of channels or `0' if it
cannot be determined or if the value is difficult to decode.  The value
for FRAMES will be either the number of frames or `-1'.  The last item
in the tuple, BITS_PER_SAMPLE, will either be the sample size in bits
or `'A'' for A-LAW  or `'U'' for u-LAW .

`what(filename)'
     Determines the type of sound data stored in the file FILENAME
     using `whathdr()'.  If it succeeds, returns a tuple as described
     above, otherwise `None' is returned.

`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 FILENAME.  This
     function returns a tuple as described above on success, or `None'.


automatically generated by info2www version 1.2.2.9