sunau.rst 6.9 KB

:mod:`sunau` --- Read and write Sun AU files

The :mod:`sunau` module provides a convenient interface to the Sun AU sound format. Note that this module is interface-compatible with the modules :mod:`aifc` and :mod:`wave`.

An audio file consists of a header followed by the data. The fields of the header are:

Field Contents
magic word The four bytes .snd.
header size Size of the header, including info, in bytes.
data size Physical size of the data, in bytes.
encoding Indicates how the audio samples are encoded.
sample rate The sampling rate.
# of channels The number of channels in the samples.
info ASCII string giving a description of the audio file (padded with null bytes).

Apart from the info field, all header fields are 4 bytes in size. They are all 32-bit unsigned integers encoded in big-endian byte order.

The :mod:`sunau` module defines the following functions:

The :mod:`sunau` module defines the following exception:

The :mod:`sunau` module defines the following data items:

AU_read Objects

AU_read objects, as returned by :func:`open` above, have the following methods:

The following two methods define a term "position" which is compatible between them, and is otherwise implementation dependent.

The following two functions are defined for compatibility with the :mod:`aifc`, and don't do anything interesting.

AU_write Objects

AU_write objects, as returned by :func:`open` above, have the following methods:

Note that it is invalid to set any parameters after calling :meth:`writeframes` or :meth:`writeframesraw`.