annotate Doc/libaifc.tex @ 4566:6403c94de50d legacy-trunk

Added safeguard against failure in __del__.
author Guido van Rossum <guido@python.org>
date Wed, 27 Nov 1996 19:39:58 +0000
parents 7ef72873e4d6
children 3468ea8645ca
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1920
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1 \section{Standard Module \sectcode{aifc}}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2 \stmodindex{aifc}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
4 This module provides support for reading and writing AIFF and AIFF-C
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
5 files. AIFF is Audio Interchange File Format, a format for storing
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
6 digital audio samples in a file. AIFF-C is a newer version of the
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
7 format that includes the ability to compress the audio data.
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
8
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
9 Audio files have a number of parameters that describe the audio data.
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
10 The sampling rate or frame rate is the number of times per second the
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
11 sound is sampled. The number of channels indicate if the audio is
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
12 mono, stereo, or quadro. Each frame consists of one sample per
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
13 channel. The sample size is the size in bytes of each sample. Thus a
2609
7ef72873e4d6 restructured library manual accordiung to functional group
Guido van Rossum <guido@python.org>
parents: 2576
diff changeset
14 frame consists of \var{nchannels}*\var{samplesize} bytes, and a
7ef72873e4d6 restructured library manual accordiung to functional group
Guido van Rossum <guido@python.org>
parents: 2576
diff changeset
15 second's worth of audio consists of
7ef72873e4d6 restructured library manual accordiung to functional group
Guido van Rossum <guido@python.org>
parents: 2576
diff changeset
16 \var{nchannels}*\var{samplesize}*\var{framerate} bytes.
7ef72873e4d6 restructured library manual accordiung to functional group
Guido van Rossum <guido@python.org>
parents: 2576
diff changeset
17
7ef72873e4d6 restructured library manual accordiung to functional group
Guido van Rossum <guido@python.org>
parents: 2576
diff changeset
18 For example, CD quality audio has a sample size of two bytes (16
7ef72873e4d6 restructured library manual accordiung to functional group
Guido van Rossum <guido@python.org>
parents: 2576
diff changeset
19 bits), uses two channels (stereo) and has a frame rate of 44,100
7ef72873e4d6 restructured library manual accordiung to functional group
Guido van Rossum <guido@python.org>
parents: 2576
diff changeset
20 frames/second. This gives a frame size of 4 bytes (2*2), and a
7ef72873e4d6 restructured library manual accordiung to functional group
Guido van Rossum <guido@python.org>
parents: 2576
diff changeset
21 second's worth occupies 2*2*44100 bytes, i.e.\ 176,400 bytes.
1920
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
22
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
23 Module \code{aifc} defines the following function:
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
24
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
25 \renewcommand{\indexsubitem}{(in module aifc)}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
26 \begin{funcdesc}{open}{file\, mode}
2527
815dfaa6a778 small changes by Soren Larsen
Guido van Rossum <guido@python.org>
parents: 1920
diff changeset
27 Open an AIFF or AIFF-C file and return an object instance with
1920
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
28 methods that are described below. The argument file is either a
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
29 string naming a file or a file object. The mode is either the string
2576
f47bc5554418 mass changes; fix titles; add examples; correct typos; clarifications;
Guido van Rossum <guido@python.org>
parents: 2527
diff changeset
30 \code{'r'} when the file must be opened for reading, or \code{'w'}
f47bc5554418 mass changes; fix titles; add examples; correct typos; clarifications;
Guido van Rossum <guido@python.org>
parents: 2527
diff changeset
31 when the file must be opened for writing. When used for writing, the
f47bc5554418 mass changes; fix titles; add examples; correct typos; clarifications;
Guido van Rossum <guido@python.org>
parents: 2527
diff changeset
32 file object should be seekable, unless you know ahead of time how many
f47bc5554418 mass changes; fix titles; add examples; correct typos; clarifications;
Guido van Rossum <guido@python.org>
parents: 2527
diff changeset
33 samples you are going to write in total and use
f47bc5554418 mass changes; fix titles; add examples; correct typos; clarifications;
Guido van Rossum <guido@python.org>
parents: 2527
diff changeset
34 \code{writeframesraw()} and \code{setnframes()}.
1920
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
35 \end{funcdesc}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
36
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
37 Objects returned by \code{aifc.open()} when a file is opened for
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
38 reading have the following methods:
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
39
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
40 \renewcommand{\indexsubitem}{(aifc object method)}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
41 \begin{funcdesc}{getnchannels}{}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
42 Return the number of audio channels (1 for mono, 2 for stereo).
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
43 \end{funcdesc}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
44
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
45 \begin{funcdesc}{getsampwidth}{}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
46 Return the size in bytes of individual samples.
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
47 \end{funcdesc}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
48
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
49 \begin{funcdesc}{getframerate}{}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
50 Return the sampling rate (number of audio frames per second).
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
51 \end{funcdesc}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
52
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
53 \begin{funcdesc}{getnframes}{}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
54 Return the number of audio frames in the file.
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
55 \end{funcdesc}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
56
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
57 \begin{funcdesc}{getcomptype}{}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
58 Return a four-character string describing the type of compression used
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
59 in the audio file. For AIFF files, the returned value is
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
60 \code{'NONE'}.
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
61 \end{funcdesc}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
62
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
63 \begin{funcdesc}{getcompname}{}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
64 Return a human-readable description of the type of compression used in
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
65 the audio file. For AIFF files, the returned value is \code{'not
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
66 compressed'}.
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
67 \end{funcdesc}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
68
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
69 \begin{funcdesc}{getparams}{}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
70 Return a tuple consisting of all of the above values in the above
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
71 order.
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
72 \end{funcdesc}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
73
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
74 \begin{funcdesc}{getmarkers}{}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
75 Return a list of markers in the audio file. A marker consists of a
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
76 tuple of three elements. The first is the mark ID (an integer), the
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
77 second is the mark position in frames from the beginning of the data
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
78 (an integer), the third is the name of the mark (a string).
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
79 \end{funcdesc}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
80
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
81 \begin{funcdesc}{getmark}{id}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
82 Return the tuple as described in \code{getmarkers} for the mark with
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
83 the given id.
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
84 \end{funcdesc}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
85
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
86 \begin{funcdesc}{readframes}{nframes}
2527
815dfaa6a778 small changes by Soren Larsen
Guido van Rossum <guido@python.org>
parents: 1920
diff changeset
87 Read and return the next \var{nframes} frames from the audio file. The
1920
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
88 returned data is a string containing for each frame the uncompressed
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
89 samples of all channels.
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
90 \end{funcdesc}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
91
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
92 \begin{funcdesc}{rewind}{}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
93 Rewind the read pointer. The next \code{readframes} will start from
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
94 the beginning.
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
95 \end{funcdesc}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
96
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
97 \begin{funcdesc}{setpos}{pos}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
98 Seek to the specified frame number.
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
99 \end{funcdesc}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
100
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
101 \begin{funcdesc}{tell}{}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
102 Return the current frame number.
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
103 \end{funcdesc}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
104
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
105 \begin{funcdesc}{close}{}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
106 Close the AIFF file. After calling this method, the object can no
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
107 longer be used.
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
108 \end{funcdesc}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
109
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
110 Objects returned by \code{aifc.open()} when a file is opened for
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
111 writing have all the above methods, except for \code{readframes} and
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
112 \code{setpos}. In addition the following methods exist. The
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
113 \code{get} methods can only be called after the corresponding
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
114 \code{set} methods have been called. Before the first
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
115 \code{writeframes} or \code{writeframesraw}, all parameters except for
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
116 the number of frames must be filled in.
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
117
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
118 \begin{funcdesc}{aiff}{}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
119 Create an AIFF file. The default is that an AIFF-C file is created,
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
120 unless the name of the file ends in '.aiff' in which case the default
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
121 is an AIFF file.
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
122 \end{funcdesc}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
123
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
124 \begin{funcdesc}{aifc}{}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
125 Create an AIFF-C file. The default is that an AIFF-C file is created,
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
126 unless the name of the file ends in '.aiff' in which case the default
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
127 is an AIFF file.
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
128 \end{funcdesc}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
129
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
130 \begin{funcdesc}{setnchannels}{nchannels}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
131 Specify the number of channels in the audio file.
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
132 \end{funcdesc}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
133
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
134 \begin{funcdesc}{setsampwidth}{width}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
135 Specify the size in bytes of audio samples.
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
136 \end{funcdesc}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
137
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
138 \begin{funcdesc}{setframerate}{rate}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
139 Specify the sampling frequency in frames per second.
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
140 \end{funcdesc}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
141
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
142 \begin{funcdesc}{setnframes}{nframes}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
143 Specify the number of frames that are to be written to the audio file.
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
144 If this parameter is not set, or not set correctly, the file needs to
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
145 support seeking.
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
146 \end{funcdesc}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
147
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
148 \begin{funcdesc}{setcomptype}{type\, name}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
149 Specify the compression type. If not specified, the audio data will
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
150 not be compressed. In AIFF files, compression is not possible. The
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
151 name parameter should be a human-readable description of the
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
152 compression type, the type parameter should be a four-character
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
153 string. Currently the following compression types are supported:
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
154 NONE, ULAW, ALAW, G722.
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
155 \end{funcdesc}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
156
2609
7ef72873e4d6 restructured library manual accordiung to functional group
Guido van Rossum <guido@python.org>
parents: 2576
diff changeset
157 \begin{funcdesc}{setparams}{nchannels\, sampwidth\, framerate\, comptype\, compname}
1920
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
158 Set all the above parameters at once. The argument is a tuple
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
159 consisting of the various parameters. This means that it is possible
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
160 to use the result of a \code{getparams} call as argument to
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
161 \code{setparams}.
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
162 \end{funcdesc}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
163
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
164 \begin{funcdesc}{setmark}{id\, pos\, name}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
165 Add a mark with the given id (larger than 0), and the given name at
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
166 the given position. This method can be called at any time before
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
167 \code{close}.
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
168 \end{funcdesc}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
169
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
170 \begin{funcdesc}{tell}{}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
171 Return the current write position in the output file. Useful in
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
172 combination with \code{setmark}.
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
173 \end{funcdesc}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
174
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
175 \begin{funcdesc}{writeframes}{data}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
176 Write data to the output file. This method can only be called after
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
177 the audio file parameters have been set.
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
178 \end{funcdesc}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
179
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
180 \begin{funcdesc}{writeframesraw}{data}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
181 Like \code{writeframes}, except that the header of the audio file is
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
182 not updated.
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
183 \end{funcdesc}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
184
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
185 \begin{funcdesc}{close}{}
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
186 Close the AIFF file. The header of the file is updated to reflect the
2527
815dfaa6a778 small changes by Soren Larsen
Guido van Rossum <guido@python.org>
parents: 1920
diff changeset
187 actual size of the audio data. After calling this method, the object
1920
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
188 can no longer be used.
5f33ca521452 Added documentation on the aifc module.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
189 \end{funcdesc}