tzh
2024-08-22 c7d0944258c7d0943aa7b2211498fd612971ce27
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
K\¬Qc@sPdZddlZddlZdddgZdefd„ƒYZdZd„Zd    „Zd
„Z    d „Z
d „Z d Z d„Z d„Zd„Zd„Zd„Zd„Zd„ZddlmZdfd„ƒYZdfd„ƒYZed„ZeZedkrLddlZejd r<ejjdƒnejdZeedƒZ dGeGHd Ge j!ƒGHd!Ge j"ƒGHd"Ge j#ƒGHd#Ge j$ƒGHd$Ge j%ƒGHd%Ge j&ƒGHejd&rIejd&Z'd'Ge'GHee'd(ƒZ(e(j)e j*ƒƒx*e j+d)ƒZ,e, rPne(j-e,ƒqe(j.ƒe j.ƒd*GHnndS(+sDStuff to parse AIFF-C and AIFF files.
 
Unless explicitly stated otherwise, the description below is true
both for AIFF-C files and AIFF files.
 
An AIFF-C file has the following structure.
 
  +-----------------+
  | FORM            |
  +-----------------+
  | <size>          |
  +----+------------+
  |    | AIFC       |
  |    +------------+
  |    | <chunks>   |
  |    |    .       |
  |    |    .       |
  |    |    .       |
  +----+------------+
 
An AIFF file has the string "AIFF" instead of "AIFC".
 
A chunk consists of an identifier (4 bytes) followed by a size (4 bytes,
big endian order), followed by the data.  The size field does not include
the size of the 8 byte header.
 
The following chunk types are recognized.
 
  FVER
      <version number of AIFF-C defining document> (AIFF-C only).
  MARK
      <# of markers> (2 bytes)
      list of markers:
          <marker ID> (2 bytes, must be > 0)
          <position> (4 bytes)
          <marker name> ("pstring")
  COMM
      <# of channels> (2 bytes)
      <# of sound frames> (4 bytes)
      <size of the samples> (2 bytes)
      <sampling frequency> (10 bytes, IEEE 80-bit extended
          floating point)
      in AIFF-C files only:
      <compression type> (4 bytes)
      <human-readable version of compression type> ("pstring")
  SSND
      <offset> (4 bytes, not used by this program)
      <blocksize> (4 bytes, not used by this program)
      <sound data>
 
A pstring consists of 1 byte length, a string of characters, and 0 or 1
byte pad to make the total length even.
 
Usage.
 
Reading AIFF files:
  f = aifc.open(file, 'r')
where file is either the name of a file or an open file pointer.
The open file pointer must have methods read(), seek(), and close().
In some types of audio files, if the setpos() method is not used,
the seek() method is not necessary.
 
This returns an instance of a class with the following public methods:
  getnchannels()  -- returns number of audio channels (1 for
             mono, 2 for stereo)
  getsampwidth()  -- returns sample width in bytes
  getframerate()  -- returns sampling frequency
  getnframes()    -- returns number of audio frames
  getcomptype()   -- returns compression type ('NONE' for AIFF files)
  getcompname()   -- returns human-readable version of
             compression type ('not compressed' for AIFF files)
  getparams() -- returns a tuple consisting of all of the
             above in the above order
  getmarkers()    -- get the list of marks in the audio file or None
             if there are no marks
  getmark(id) -- get mark with the specified id (raises an error
             if the mark does not exist)
  readframes(n)   -- returns at most n frames of audio
  rewind()    -- rewind to the beginning of the audio stream
  setpos(pos) -- seek to the specified position
  tell()      -- return the current position
  close()     -- close the instance (make it unusable)
The position returned by tell(), the position given to setpos() and
the position of marks are all compatible and have nothing to do with
the actual position in the file.
The close() method is called automatically when the class instance
is destroyed.
 
Writing AIFF files:
  f = aifc.open(file, 'w')
where file is either the name of a file or an open file pointer.
The open file pointer must have methods write(), tell(), seek(), and
close().
 
This returns an instance of a class with the following public methods:
  aiff()      -- create an AIFF file (AIFF-C default)
  aifc()      -- create an AIFF-C file
  setnchannels(n) -- set the number of channels
  setsampwidth(n) -- set the sample width
  setframerate(n) -- set the frame rate
  setnframes(n)   -- set the number of frames
  setcomptype(type, name)
          -- set the compression type and the
             human-readable compression type
  setparams(tuple)
          -- set all parameters at once
  setmark(id, pos, name)
          -- add specified mark to the list of marks
  tell()      -- return current position in output file (useful
             in combination with setmark())
  writeframesraw(data)
          -- write audio frames without pathing up the
             file header
  writeframes(data)
          -- write audio frames and patch up the file header
  close()     -- patch up the file header and close the
             output file
You should set the parameters before the first writeframesraw or
writeframes.  The total number of frames does not need to be set,
but when it is set to the correct value, the header does not have to
be patched up.
It is best to first set all parameters, perhaps possibly the
compression type, and then write audio frames using writeframesraw.
When all frames have been written, either call writeframes('') or
close() to patch up the sizes in the header.
Marks can be added anytime.  If there are any marks, ypu must call
close() after all frames have been written.
The close() method is called automatically when the class instance
is destroyed.
 
When a file is opened with the extension '.aiff', an AIFF file is
written, otherwise an AIFF-C file is written.  This default can be
changed by calling aiff() or aifc() before the first writeframes or
writeframesraw.
iÿÿÿÿNtErrortopentopenfpcBseZRS((t__name__t
__module__(((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyRŽsl@QEcCsBy!tjd|jdƒƒdSWntjk
r=t‚nXdS(Ns>lii(tstructtunpacktreadterrortEOFError(tfile((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyt
_read_long“s!cCsBy!tjd|jdƒƒdSWntjk
r=t‚nXdS(Ns>Lii(RRRRR    (R
((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyt _read_ulong™s!cCsBy!tjd|jdƒƒdSWntjk
r=t‚nXdS(Ns>hii(RRRRR    (R
((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyt _read_shortŸs!cCsBy!tjd|jdƒƒdSWntjk
r=t‚nXdS(Ns>Hii(RRRRR    (R
((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyt _read_ushort¥s!cCs_t|jdƒƒ}|dkr*d}n|j|ƒ}|d@dkr[|jdƒ}n|S(Niit(tordR(R
tlengthtdatatdummy((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyt _read_string«s     gâÿÿÿÿÿïcCs¿t|ƒ}d}|dkr1d}|d}nt|ƒ}t|ƒ}||kok|kokdknryd}n>|dkrŽt}n)|d}|d|td    |d
ƒ}||S( Niiiÿÿÿÿi€giÿiÿ?lg@i?(R R t    _HUGE_VALtpow(tftexpontsignthimanttlomant((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyt _read_float·s     '         
cCs|jtjd|ƒƒdS(Ns>h(twriteRtpack(Rtx((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyt _write_shortÈscCs|jtjd|ƒƒdS(Ns>H(RRR(RR((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyt _write_ushortËscCs|jtjd|ƒƒdS(Ns>l(RRR(RR((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyt _write_longÎscCs|jtjd|ƒƒdS(Ns>L(RRR(RR((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyt _write_ulongÑscCs}t|ƒdkr!tdƒ‚n|jtjdt|ƒƒƒ|j|ƒt|ƒd@dkry|jtdƒƒndS(Niÿs%string exceeds maximum pstring lengthtBii(tlent
ValueErrorRRRtchr(Rts((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyt _write_stringÔs  c    Cshddl}|dkr+d}|d}nd}|dkrRd}d}d}në|j|ƒ\}}|dks‹|dks‹||kr¤|dB}d}d}n™|d}|dkrÕ|j||ƒ}d}n||B}|j|dƒ}|j|ƒ}t|ƒ}|j||dƒ}|j|ƒ}t|ƒ}t||ƒt||ƒt||ƒdS(    Niÿÿÿÿii€i@iiÿiþ?i (tmathtfrexptldexptfloortlongR!R#(    RRR*RRRRtfmanttfsmant((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyt _write_floatÜs8        $
    
     
    (tChunkt    Aifc_readcBsÎeZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z    d„Z
d    „Z d
„Z d „Z d „Zd „Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„ZRS(cCsTd|_d|_d|_g|_d|_||_t|ƒ}|jƒdkr`t    d‚n|j
dƒ}|dkr‡d|_ n!|dkrŸd|_ n    t    d‚d|_ xÙd|_ yt|jƒ}Wntk
räPnX|jƒ}|d    kr|j|ƒd|_ nj|d
krF||_|j
d ƒ}d|_ n:|d krdt|ƒ|_n|d kr€|j|ƒn|jƒq´|j s¡|j r­t    d‚n|j rP|jrPddl}|jd|j|jd |j|jg}|jdkr|j|d<n(|jdkr4|j|d<n    t    d‚|jj|ƒndS(NitFORMs file does not start with FORM iditAIFFtAIFCisnot an AIFF or AIFF-C filetCOMMtSSNDitFVERtMARKs$COMM chunk and/or SSND chunk missingiÿÿÿÿis$cannot compress more than 2 channels(t_versiontNonet_decompt_convertt_markerst    _soundpost_fileR2tgetnameRRt_aifct_comm_chunk_readt_ssnd_seek_neededR    t_read_comm_chunkt _ssnd_chunkR t    _readmarktskiptcltORIGINAL_FORMATtBITS_PER_COMPONENTt
_sampwidtht
FRAME_RATEt
_frameratet
_nchannelstMONOtSTEREO_INTERLEAVEDt    SetParams(tselfR
tchunktformdatat    chunknameRRJtparams((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pytinitfp#s`                                                                  cCs>t|ƒtdƒkr-tj|dƒ}n|j|ƒdS(NRtrb(ttypet __builtin__RRY(RTR((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyt__init__WscCs|jS(N(RA(RT((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pytgetfp`scCsd|_d|_dS(Nii(RER@(RT((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pytrewindcs    cCs3|jr"|jjƒd|_n|jjƒdS(N(R=tCloseDecompressorR<RAtclose(RT((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyRags      cCs|jS(N(R@(RT((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyttellmscCs|jS(N(RP(RT((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyt getnchannelspscCs|jS(N(t_nframes(RT((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyt
getnframessscCs|jS(N(RM(RT((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyt getsampwidthvscCs|jS(N(RO(RT((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyt getframerateyscCs|jS(N(t    _comptype(RT((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyt getcomptype|scCs|jS(N(t    _compname(RT((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyt getcompnamescCs:|jƒ|jƒ|jƒ|jƒ|jƒ|jƒfS(N(RcRfRgReRiRk(RT((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyt    getparams…scCs t|jƒdkrdS|jS(Ni(R%R?R<(RT((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyt
getmarkersŠscCs<x%|jD]}||dkr
|Sq
Wtd|f‚dS(Nismarker %r does not exist(R?R(RTtidtmarker((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pytgetmarkscCs=|dks||jkr'td‚n||_d|_dS(Nisposition not in rangei(RdRR@RE(RTtpos((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pytsetpos•s     cCsÖ|jrd|jjdƒ|jjdƒ}|j|j}|rX|jj|dƒnd|_n|dkrtdS|jj||jƒ}|jr®|r®|j|ƒ}n|jt|ƒ|j|j    |_|S(NiiR(
RERGtseekRR@t
_framesizeR>R%RPRM(RTtnframesRRqR((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyt
readframes›s      $cCsNddl}|jj|jt|ƒdƒ}|jjt|ƒ|j|ƒS(Niÿÿÿÿi(RJR=tSetParamtFRAME_BUFFER_SIZER%t
DecompressRP(RTRRJR((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyt _decomp_data¯s
 cCsddl}|j|dƒS(Niÿÿÿÿi(taudiooptulaw2lin(RTRR{((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyt    _ulaw2lin¶s cCsLddl}t|dƒs'd|_n|j|d|jƒ\}|_|S(Niÿÿÿÿt _adpcmstatei(R{thasattrR<R~t    adpcm2lin(RTRR{((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyt
_adpcm2linºs    cCs•t|ƒ|_t|ƒ|_t|ƒdd|_tt|ƒƒ|_|j|j|_|j    rd}|j
dkr’d}dGHd|_
n|j dƒ|_ |rt |jj dƒƒ}|d@dkrß|d}n|j
||_
|jjd    dƒnt|ƒ|_|j d
kr‘|j d kryyd    dl}Wntk
rUqyX|j|_|jd|_dSnyd    dl}Wnptk
rû|j d krïy0d    dl}|j|_|jd |_dSWqïtk
rëqïXntd‚nX|j d kr'|j}|jd |_n4|j dkrR|j}|jd |_n    td‚|j|ƒ|_|j|_q‘nd
|_ d|_dS(NiiiiisWarning: bad COMM chunk sizeiiiÿÿÿÿtNONEtG722tULAWis#cannot read compressed AIFF-C filestALAWsunsupported compression typesnot compressed(R RPR RdRMtintRRORtRCt    chunksizeRRhRR
RsRRjR{t ImportErrorRR>RJR}Rt    G711_ULAWt    G711_ALAWtOpenDecompressorR=Rz(RTRUtkludgeRR{RJtscheme((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyRFÃsf                             cCsÅt|ƒ}ygx`t|ƒD]R}t|ƒ}t|ƒ}t|ƒ}|sR|r|jj|||fƒqqWWnKtk
rÀdGt|jƒGt|jƒdkr°dGndGdG|GHnXdS(Ns!Warning: MARK chunk contains onlyiRotmarkerss
instead of(R trangeR RR?tappendR    R%(RTRUtnmarkerstiRnRqtname((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyRHs     $  (RRRYR]R^R_RaRbRcReRfRgRiRkRlRmRpRrRvRzR}RRFRH(((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyR3ÿs,$    4                                                                                        =t
Aifc_writecBs:eZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z    d„Z
d    „Z d
„Z d „Z d „Zd „Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z!d „Z"d!„Z#RS("cCsot|ƒtdƒkr3|}tj|dƒ}nd}|j|ƒ|ddkrbd|_n    d|_dS(NRtwbs???iûÿÿÿs.aiffii(R[R\RRYRC(RTRtfilename((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyR]3s  cCs”||_t|_d|_d|_d|_d|_d|_d|_    d|_
d|_ d|_ d|_ d|_g|_d|_d|_dS(NR‚snot compressedii(RAt _AIFC_versionR;RhRjR<t_compR>RPRMRORdt_nframeswrittent _datawrittent _datalengthR?t _marklengthRC(RTR
((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyRY@s                                                             cCs|jr|jƒndS(N(RARa(RT((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyt__del__Rs    cCs"|jrtd‚nd|_dS(Ns0cannot change parameters after starting to writei(R™RRC(RT((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pytaiffYs     cCs"|jrtd‚nd|_dS(Ns0cannot change parameters after starting to writei(R™RRC(RT((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pytaifc^s     cCs:|jrtd‚n|dkr-td‚n||_dS(Ns0cannot change parameters after starting to writeisbad # of channels(R™RRP(RTt    nchannels((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyt setnchannelscs
       cCs|jstd‚n|jS(Nsnumber of channels not set(RPR(RT((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyRcjs     cCsF|jrtd‚n|dks-|dkr9td‚n||_dS(Ns0cannot change parameters after starting to writeiisbad sample width(R™RRM(RTt    sampwidth((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyt setsampwidthos
      cCs|jstd‚n|jS(Nssample width not set(RMR(RT((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyRfvs     cCs:|jrtd‚n|dkr-td‚n||_dS(Ns0cannot change parameters after starting to writeisbad frame rate(R™RRO(RTt    framerate((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyt setframerate{s
       cCs|jstd‚n|jS(Nsframe rate not set(ROR(RT((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyRg‚s     cCs"|jrtd‚n||_dS(Ns0cannot change parameters after starting to write(R™RRd(RTRu((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyt
setnframes‡s     cCs|jS(N(R™(RT((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyReŒscCsC|jrtd‚n|dkr-td‚n||_||_dS(Ns0cannot change parameters after starting to writeR‚R„R…Rƒsunsupported compression type(sNONEsULAWsALAWsG722(R™RRhRj(RTtcomptypetcompname((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyt setcomptypes            cCs|jS(N(Rh(RT((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyRi—scCs|jS(N(Rj(RT((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyRkšscCs|\}}}}}}|jr-td‚n|dkrEtd‚n|j|ƒ|j|ƒ|j|ƒ|j|ƒ|j||ƒdS(Ns0cannot change parameters after starting to writeR‚R„R…Rƒsunsupported compression type(sNONEsULAWsALAWsG722(R™RR¡R£R¥R¦R©(RTtinfoR R¢R¤RuR§R¨((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyt    setparams¢s           cCsR|j s|j s|j r*td‚n|j|j|j|j|j|jfS(Nsnot all parameters set(RPRMRORRdRhRj(RT((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyRl®s cCsÂ|dkrtd‚n|dkr0td‚nt|ƒtdƒkrTtd‚nxNtt|jƒƒD]7}||j|dkrj|||f|j|<dSqjW|jj|||fƒdS(Nismarker ID must be > 0smarker position must be >= 0Rsmarker name must be a string(RR[RR%R?R(RTRnRqR“R’((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pytsetmark´s     cCs<x%|jD]}||dkr
|Sq
Wtd|f‚dS(Nismarker %r does not exist(R?R(RTRnRo((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyRpÁscCs t|jƒdkrdS|jS(Ni(R%R?R<(RT((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyRmÇscCs|jS(N(R™(RT((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyRbÌscCs‚|jt|ƒƒt|ƒ|j|j}|jrH|j|ƒ}n|jj|ƒ|j||_|jt|ƒ|_dS(N(    t_ensure_header_writtenR%RMRPR>RARR™Rš(RTRRu((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pytwriteframesrawÏs    cCsB|j|ƒ|j|jks1|j|jkr>|jƒndS(N(R®R™RdR›Ršt _patchheader(RTR((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyt writeframesØs cCsí|jdkrdSz­|jdƒ|jd@rY|jjtdƒƒ|jd|_n|jƒ|j|jks|j    |jks|j
r|j ƒn|j r¿|j j ƒd|_ nWdd|_|j}d|_|jƒXdS(Nii(RAR<R­RšRR't _writemarkersR™RdR›RœR¯R˜tCloseCompressorR>Ra(RTR((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyRaÞs&  
                      cCs^ddl}|jj|jt|ƒƒ}|jj|jt|ƒƒ}|jj|j|ƒS(Niÿÿÿÿ(RJR˜RwRxR%tCOMPRESSED_BUFFER_SIZEtCompressRd(RTRRJR((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyt
_comp_dataús cCsddl}|j|dƒS(Niÿÿÿÿi(R{tlin2ulaw(RTRR{((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyt    _lin2ulaws cCsLddl}t|dƒs'd|_n|j|d|jƒ\}|_|S(NiÿÿÿÿR~i(R{RR<R~t    lin2adpcm(RTRR{((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyt
_lin2adpcms    cCsà|jsÜ|jd
krK|js-d|_n|jdkrKtd‚qKn|jdkr|jsod|_n|jdkrtd‚qn|js¢td‚n|js·td‚n|jsÌtd    ‚n|j|ƒndS( NR„R…is9sample width must be 2 when compressing with ULAW or ALAWRƒs:sample width must be 2 when compressing with G7.22 (ADPCM)s# channels not specifiedssample width not specifiedssampling rate not specified(sULAWsALAW(R™RhRMRRPROt _write_header(RTtdatasize((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyR­ s$                             c
Csœ|jdkr|j|_dSyddl}Wn`tk
r‘|jdkr…y ddl}|j|_dSWq…tk
rq…Xntd‚nX|jdkr­|j}n$|jdkrÈ|j    }n    td‚|j
|ƒ|_ |j d|j |jd|j|j|jd    |jd    g
}|jd
kr?|j|d
<n(|jd kr^|j|d
<n    td ‚|j j|ƒ|j jdd ƒ}|j|_dS(NRƒiÿÿÿÿR„s$cannot write compressed AIFF-C filesR…sunsupported compression typeiiidiis$cannot compress more than 2 channelsR(RhR¹R>RJRˆR{R·RR‰RŠtOpenCompressorR˜RKRLRMRNRORxR³RPRQRRRSR´Rµ(RTRJR{RRXR((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyt_init_compression sB                         cCsº|jr%|jdkr%|jƒn|jjdƒ|jsX||j|j|_n|j|j|j|_|jd@r’|jd|_n|jr&|jdkrÝ|jd|_|jd@r#|jd|_q#q&|jdkr&|jdd    |_|jd@r#|jd|_q#q&n|jj    ƒ|_
|j |jƒ}|jr™|jjd
ƒ|jjd ƒt |jd    ƒt |j|j ƒn|jjd ƒ|jjd ƒt |j|ƒt|j|jƒ|jj    ƒ|_t |j|jƒt|j|jdƒt|j|jƒ|jr]|jj|jƒt|j|jƒn|jjdƒ|jj    ƒ|_t |j|jdƒt |jdƒt |jdƒdS(NR‚R4iR„R…iRƒiiR6R9R5R7iR8i(sULAWsALAW(RCRhR½RARRdRPRMR›Rbt_form_length_post_write_form_lengthR#R;R t _nframes_posR1ROR)Rjt_ssnd_length_pos(RTt
initlengtht
commlength((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyRºFsP                    cCsw|jr<d    t|jƒ}|d@r3|d}nd}n d}d}t|jd||jd|d|ƒ|S(
Niiii iiiii(RCR%RjR#RARœ(RTt
datalengthRÃt
verslength((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyR¿qs    
         "cCs6|jjƒ}|jd@rB|jd}|jjtdƒƒn    |j}||jkr’|j|jkr’|jdkr’|jj    |dƒdS|jj    |j
dƒ|j |ƒ}|jj    |j dƒt |j|jƒ|jj    |jdƒt |j|dƒ|jj    |dƒ|j|_||_dS(Niii(RARbRšRR'R›RdR™RœRsR¾R¿RÀR#RÁ(RTtcurposRÄR((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyR¯~s&       cCst|jƒdkrdS|jjdƒd}x[|jD]P}|\}}}|t|ƒdd}t|ƒd@dkr9|d}q9q9Wt|j|ƒ|d|_t|jt|jƒƒxP|jD]E}|\}}}t|j|ƒt|j|ƒt|j|ƒqÍWdS(NiR:iiii(R%R?RARR#RœR R)(RTRRoRnRqR“((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyR±”s" ($RRR]RYRRžRŸR¡RcR£RfR¥RgR¦ReR©RiRkR«RlR¬RpRmRbR®R°RaRµR·R¹R­R½RºR¿R¯R±(((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyR”sD                                                                                                                            &    +        cCsi|dkr0t|dƒr'|j}q0d}n|dkrFt|ƒS|dkr\t|ƒStd‚dS(    NtmodeRZtrtwR•s$mode must be 'r', 'rb', 'w', or 'wb'(RÈsrb(RÉswb(R<RRÇR3R”R(RRÇ((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyR§s       
 
t__main__is/usr/demos/data/audio/bach.aiffRÈtReadings nchannels =s nframes   =s sampwidth =s framerate =s comptype  =s compname  =itWritingRÉisDone.(/t__doc__RR\t__all__t    ExceptionRR—R R R RRRRR R!R"R#R)R1RUR2R3R”R<RRRtsystargvRtfnRRcReRfRgRiRktgntgR«RlRvRR°Ra(((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/aifc.pyt<module>‡sf                      
                            !ÿÿ“