Movatterモバイル変換
[0]ホーム
Thesunau module provides a convenient interface to the SunAU sound format. Note that this module is interface-compatible withthe modulesaifc andwave.
An audio file consists of a header followed by the data. The fieldsof 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 byteorder.
Thesunau module defines the following functions:
- open(file, mode)
- Iffile is a string, open the file by that name, otherwise treat itas a seekable file-like object.mode can be any of
'r'- Read only mode.
'w'- Write only mode.
Note that it does not allow read/write files.Amode of'r' returns aAU_readobject, while amode of'w' or'wb' returnsaAU_write object.
- openfp(file, mode)
- A synonym foropen, maintained for backwards compatibility.
Thesunau module defines the following exception:
- exceptionError
- An error raised when something is impossible because of Sun AU specs or implementation deficiency.
Thesunau module defines the following data items:
- AUDIO_FILE_MAGIC
- An integer every valid Sun AU file begins with, stored in big-endianform. This is the string ".snd" interpreted as an integer.
- AUDIO_FILE_ENCODING_MULAW_8
- AUDIO_FILE_ENCODING_LINEAR_8
- AUDIO_FILE_ENCODING_LINEAR_16
- AUDIO_FILE_ENCODING_LINEAR_24
- AUDIO_FILE_ENCODING_LINEAR_32
- AUDIO_FILE_ENCODING_ALAW_8
- Values of the encoding field from the AU header which are supported bythis module.
- AUDIO_FILE_ENCODING_FLOAT
- AUDIO_FILE_ENCODING_DOUBLE
- AUDIO_FILE_ENCODING_ADPCM_G721
- AUDIO_FILE_ENCODING_ADPCM_G722
- AUDIO_FILE_ENCODING_ADPCM_G723_3
- AUDIO_FILE_ENCODING_ADPCM_G723_5
- Additional known values of the encoding field from the AU header, butwhich are not supported by this module.
SubsectionsSeeAbout this document... for information on suggesting changes.
[8]ページ先頭