/snap/core24/1643/usr/lib/python3.12/__pycache__
NameSizeModeActions
abc.cpython-312.pyc80550644editdlrm
aifc.cpython-312.pyc428630644editdlrm
antigravity.cpython-312.pyc10030644editdlrm
argparse.cpython-312.pyc1016820644editdlrm
ast.cpython-312.pyc1002790644editdlrm
base64.cpython-312.pyc244080644editdlrm
bdb.cpython-312.pyc373590644editdlrm
bisect.cpython-312.pyc36410644editdlrm
bz2.cpython-312.pyc151330644editdlrm
calendar.cpython-312.pyc396210644editdlrm
cgi.cpython-312.pyc402280644editdlrm
cgitb.cpython-312.pyc173320644editdlrm
chunk.cpython-312.pyc73100644editdlrm
cmd.cpython-312.pyc186190644editdlrm
code.cpython-312.pyc130510644editdlrm
codecs.cpython-312.pyc422740644editdlrm
codeop.cpython-312.pyc69160644editdlrm
colorsys.cpython-312.pyc46420644editdlrm
compileall.cpython-312.pyc204970644editdlrm
configparser.cpython-312.pyc635820644editdlrm
contextlib.cpython-312.pyc303760644editdlrm
contextvars.cpython-312.pyc2610644editdlrm
copy.cpython-312.pyc98000644editdlrm
copyreg.cpython-312.pyc74140644editdlrm
cProfile.cpython-312.pyc85930644editdlrm
crypt.cpython-312.pyc53610644editdlrm
csv.cpython-312.pyc177880644editdlrm
dataclasses.cpython-312.pyc446780644editdlrm
datetime.cpython-312.pyc4090644editdlrm
decimal.cpython-312.pyc4060644editdlrm
difflib.cpython-312.pyc754990644editdlrm
dis.cpython-312.pyc345600644editdlrm
doctest.cpython-312.pyc1056860644editdlrm
enum.cpython-312.pyc807080644editdlrm
filecmp.cpython-312.pyc146610644editdlrm
fileinput.cpython-312.pyc202800644editdlrm
fnmatch.cpython-312.pyc64950644editdlrm
fractions.cpython-312.pyc366670644editdlrm
ftplib.cpython-312.pyc426360644editdlrm
functools.cpython-312.pyc405060644editdlrm
genericpath.cpython-312.pyc68220644editdlrm
getopt.cpython-312.pyc83630644editdlrm
getpass.cpython-312.pyc68500644editdlrm
gettext.cpython-312.pyc221510644editdlrm
glob.cpython-312.pyc98410644editdlrm
graphlib.cpython-312.pyc103270644editdlrm
gzip.cpython-312.pyc320150644editdlrm
hashlib.cpython-312.pyc80870644editdlrm
heapq.cpython-312.pyc179560644editdlrm
hmac.cpython-312.pyc106980644editdlrm
imaplib.cpython-312.pyc628890644editdlrm
imghdr.cpython-312.pyc69440644editdlrm
inspect.cpython-312.pyc1334460644editdlrm
io.cpython-312.pyc41390644editdlrm
ipaddress.cpython-312.pyc907620644editdlrm
keyword.cpython-312.pyc10410644editdlrm
linecache.cpython-312.pyc64010644editdlrm
locale.cpython-312.pyc595360644editdlrm
lzma.cpython-312.pyc158550644editdlrm
mailbox.cpython-312.pyc1116180644editdlrm
mailcap.cpython-312.pyc111550644editdlrm
mimetypes.cpython-312.pyc241850644editdlrm
modulefinder.cpython-312.pyc279440644editdlrm
netrc.cpython-312.pyc89030644editdlrm
nntplib.cpython-312.pyc449390644editdlrm
ntpath.cpython-312.pyc260330644editdlrm
nturl2path.cpython-312.pyc30340644editdlrm
numbers.cpython-312.pyc139670644editdlrm
opcode.cpython-312.pyc147160644editdlrm
operator.cpython-312.pyc173640644editdlrm
optparse.cpython-312.pyc675460644editdlrm
os.cpython-312.pyc434740644editdlrm
pathlib.cpython-312.pyc620980644editdlrm
pdb.cpython-312.pyc849190644editdlrm
pickle.cpython-312.pyc761760644editdlrm
pickletools.cpython-312.pyc811280644editdlrm
pipes.cpython-312.pyc109140644editdlrm
pkgutil.cpython-312.pyc199590644editdlrm
platform.cpython-312.pyc416000644editdlrm
plistlib.cpython-312.pyc412860644editdlrm
poplib.cpython-312.pyc184460644editdlrm
posixpath.cpython-312.pyc182360644editdlrm
pprint.cpython-312.pyc294740644editdlrm
profile.cpython-312.pyc225400644editdlrm
pstats.cpython-312.pyc379220644editdlrm
pty.cpython-312.pyc73630644editdlrm
pyclbr.cpython-312.pyc148870644editdlrm
pydoc.cpython-312.pyc1429550644editdlrm
py_compile.cpython-312.pyc100780644editdlrm
queue.cpython-312.pyc147320644editdlrm
quopri.cpython-312.pyc93230644editdlrm
random.cpython-312.pyc331530644editdlrm
reprlib.cpython-312.pyc99090644editdlrm
rlcompleter.cpython-312.pyc82820644editdlrm
runpy.cpython-312.pyc143850644editdlrm
sched.cpython-312.pyc77350644editdlrm
secrets.cpython-312.pyc25560644editdlrm
selectors.cpython-312.pyc261280644editdlrm
shelve.cpython-312.pyc129130644editdlrm
shlex.cpython-312.pyc141620644editdlrm
shutil.cpython-312.pyc681130644editdlrm
signal.cpython-312.pyc44480644editdlrm
site.cpython-312.pyc290630644editdlrm
sitecustomize.cpython-312.pyc3000644editdlrm
smtplib.cpython-312.pyc482210644editdlrm
sndhdr.cpython-312.pyc107120644editdlrm
socket.cpython-312.pyc418170644editdlrm
socketserver.cpython-312.pyc342580644editdlrm
sre_compile.cpython-312.pyc6250644editdlrm
sre_constants.cpython-312.pyc6280644editdlrm
sre_parse.cpython-312.pyc6210644editdlrm
ssl.cpython-312.pyc630110644editdlrm
stat.cpython-312.pyc52310644editdlrm
statistics.cpython-312.pyc554230644editdlrm
string.cpython-312.pyc114820644editdlrm
stringprep.cpython-312.pyc251600644editdlrm
struct.cpython-312.pyc3250644editdlrm
subprocess.cpython-312.pyc791870644editdlrm
sunau.cpython-312.pyc254230644editdlrm
symtable.cpython-312.pyc187810644editdlrm
sysconfig.cpython-312.pyc300010644editdlrm
tabnanny.cpython-312.pyc121560644editdlrm
tarfile.cpython-312.pyc1233880644editdlrm
telnetlib.cpython-312.pyc284230644editdlrm
tempfile.cpython-312.pyc473390644editdlrm
textwrap.cpython-312.pyc182930644editdlrm
this.cpython-312.pyc14080644editdlrm
threading.cpython-312.pyc653460644editdlrm
timeit.cpython-312.pyc148640644editdlrm
token.cpython-312.pyc35570644editdlrm
tokenize.cpython-312.pyc247750644editdlrm
trace.cpython-312.pyc330240644editdlrm
traceback.cpython-312.pyc515230644editdlrm
tracemalloc.cpython-312.pyc269070644editdlrm
tty.cpython-312.pyc26680644editdlrm
turtle.cpython-312.pyc1846320644editdlrm
types.cpython-312.pyc149390644editdlrm
typing.cpython-312.pyc1418600644editdlrm
uu.cpython-312.pyc78160644editdlrm
uuid.cpython-312.pyc330070644editdlrm
warnings.cpython-312.pyc237920644editdlrm
wave.cpython-312.pyc320840644editdlrm
weakref.cpython-312.pyc313480644editdlrm
webbrowser.cpython-312.pyc263530644editdlrm
xdrlib.cpython-312.pyc118410644editdlrm
zipapp.cpython-312.pyc99770644editdlrm
zipimport.cpython-312.pyc244750644editdlrm
_aix_support.cpython-312.pyc47590644editdlrm
_collections_abc.cpython-312.pyc459120644editdlrm
_compat_pickle.cpython-312.pyc72210644editdlrm
_compression.cpython-312.pyc74970644editdlrm
_distutils_system_mod.cpython-312.pyc78180644editdlrm
_markupbase.cpython-312.pyc122790644editdlrm
_osx_support.cpython-312.pyc177310644editdlrm
_pydatetime.cpython-312.pyc941930644editdlrm
_pydecimal.cpython-312.pyc2278070644editdlrm
_pyio.cpython-312.pyc1102690644editdlrm
_pylong.cpython-312.pyc99830644editdlrm
_py_abc.cpython-312.pyc70540644editdlrm
_sitebuiltins.cpython-312.pyc47600644editdlrm
_strptime.cpython-312.pyc241160644editdlrm
_sysconfigdata__linux_x86_64-linux-gnu.cpython-312.pyc586510644editdlrm
_sysconfigdata__x86_64-linux-gnu.cpython-312.pyc586450644editdlrm
_threading_local.cpython-312.pyc82950644editdlrm
_weakrefset.cpython-312.pyc117510644editdlrm
__future__.cpython-312.pyc47040644editdlrm
__hello__.cpython-312.pyc8700644editdlrm
Edit: /snap/core24/1643/usr/lib/python3.12/__pycache__/aifc.cpython-312.pyc (42863B)
ЦibdZddlZddlZddlZddgZej edGddeZdZ d Z d Z d Z d Z d ZdZdZdZdZdZdZdZdZej.5ej0deddlmZdddddlmZeddZdej>_dej@_dejB_dejD_dejF_d ejH_Gd!d"Z%Gd#d$Z&d6d%Z'ed&k(rkddl(Z(e(jRd'dse(jRjUd(e(jRd'Z+e'e+d)5Z,e-d*e+e-d+e,j]e-d,e,j_e-d-e,jae-d.e,jce-d/e,jee-d0e,jge(jRd1drye(jRd1Z4e-d2e4e'e4d35Z5e5jme,jo e,jqd4Z9e9sne5jue9& ddde-d5dddyy#1swY xYw#1swY(xYw#1swYyxYw)7aJStuff 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 | +-----------------+ | | +----+------------+ | | AIFC | | +------------+ | | | | | . | | | . | | | . | +----+------------+ 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 (AIFF-C only). MARK <# of markers> (2 bytes) list of markers: (2 bytes, must be > 0) (4 bytes) ("pstring") COMM <# of channels> (2 bytes) <# of sound frames> (4 bytes) (2 bytes) (10 bytes, IEEE 80-bit extended floating point) in AIFF-C files only: (4 bytes) ("pstring") SSND (4 bytes, not used by this program) (4 bytes, not used by this program) 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 namedtuple 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(b'') or close() to patch up the sizes in the header. Marks can be added anytime. If there are any marks, you 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. NErroropen) )removec eZdZy)rN)__name__ __module__ __qualname__/usr/lib/python3.12/aifc.pyrrsr l@QEc tjd|jddS#tj$rtdwxYw)N>lrstructunpackreaderrorEOFErrorfiles r _read_longr@!}}T499Q<033 <<!D ! '*Ac tjd|jddS#tj$rtdwxYw)N>Lrrrrs r _read_ulongrrrc tjd|jddS#tj$rtdwxYw)N>hrrrs r _read_shortr#rrc tjd|jddS#tj$rtdwxYw)N>Hr"rrrs r _read_ushortr&rrct|jd}|dk(rd}n|j|}|dzdk(r|jd}|S)Nrr )ordr)rlengthdatadummys r _read_stringr-sK 1 F {yy  zQ !  Kr gct|}d}|dkrd}|dz}t|}t|}||cxk(r |cxk(rdk(r nnd}||zS|dk(r t}||zS|dz }|dz|ztd |d z z}||zS) Nr(rgi?lg@?)r#r _HUGE_VALpow)fexponsignhimantlomants r _read_floatr:s NE D qy ^F ^F %&%A%  !8O &  !8O  k !F *c#urz.B B !8Or cN|jtjd|y)Nr!writerpackr5xs r _write_shortrAGGFKKa !r cN|jtjd|y)Nr%r<r?s r _write_ushortrDrBr cN|jtjd|y)Nrr<r?s r _write_longrFrBr cN|jtjd|y)Nrr<r?s r _write_ulongrHrBr ct|dkDr td|jtjdt||j|t|dzdk(r|jdyy)Nz%string exceeds maximum pstring lengthBr(r)len ValueErrorr=rr>)r5ss r _write_stringrPs_ 1v|@AAGGFKKSV $%GGAJ 1vzQ r cddl}|dkrd}|dz}nd}|dk(rd}d}d}n|j|\}}|dkDs |dk\s||k7r |dz}d}d}n|dz}|dkr|j||}d}||z}|j|d}|j|}t |}|j||z d}|j|}t |}t ||t ||t ||y) Nrr0r/i@r(r1i? )mathfrexpldexpfloorintrDrH) r5r@rSr7r6r8r9fmantfsmants r _write_floatrZs 1u FAvzz!} u 5=EQJ%5.KEFFEMEqy 5%0DLEJJub)EZZ&F[FJJuv~r2EZZ&F[F!UFFr ignore)Chunk) namedtuple _aifc_paramsz7nchannels sampwidth framerate nframes comptype compnamez3Number of audio channels (1 for mono, 2 for stereo)zSample width in byteszSampling frequencyzNumber of audio framesz(Compression type ("NONE" for AIFF files)zRA human-readable version of the compression type ('not compressed' for AIFF files)ceZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZdZdZdZdZdZdZdZdZdZy) Aifc_readNcd|_d|_g|_d|_||_t |}|j dk7r td|jd}|dk(rd|_ n|dk(rd|_ n tdd|_ d|_ d|_ t |j}|j }|d k(r|j|d|_ nQ|d k(r ||_ |jd }d|_ n,|d k(rt||_n|d k(r|j!||j##t$rYnwxYw|jr |js tdy)NrFORMz file does not start with FORM idrAIFFAIFCr(znot an AIFF or AIFF-C fileCOMMSSNDFVERMARKz$COMM chunk and/or SSND chunk missing)_version_convert_markers _soundpos_filer\getnamerr_aifc_comm_chunk_read _ssnd_chunk_ssnd_seek_neededr_read_comm_chunkr _readmarkskip)selfrchunkformdata chunknamer,s rinitfpzAifc_read.initfp:sk    d  ==?g %:; ;::a= w DJ  DJ45 5 !%&D " djj) IG#%%e,()%g%#(  1 )*&g% +E 2 g%u% JJL%  $$D,<,<>? ?-=sD?? E  E ct|tr)tj|d} |j |y|j |y#|j xYw)Nrb) isinstancestrbuiltinsrr{closerwr5 file_objects r__init__zAifc_read.__init__bsP a "--40K  K( KKN  !!#s A Ac|SNr rws r __enter__zAifc_read.__enter__n r c$|jyrrrwargss r__exit__zAifc_read.__exit__q  r c|jSr)rnrs rgetfpzAifc_read.getfpws zzr c d|_d|_y)Nr(r)rsrmrs rrewindzAifc_read.rewindzs!"r cP|j}|d|_|jyyr)rnrrwrs rrzAifc_read.close~s&zz  DJ JJL r c|jSr)rmrs rtellzAifc_read.tell ~~r c|jSr) _nchannelsrs r getnchannelszAifc_read.getnchannels r c|jSr)_nframesrs r getnframeszAifc_read.getnframess }}r c|jSr) _sampwidthrs r getsampwidthzAifc_read.getsampwidthrr c|jSr) _frameraters r getframeratezAifc_read.getframeraterr c|jSr _comptypers r getcomptypezAifc_read.getcomptyperr c|jSr _compnamers r getcompnamezAifc_read.getcompnamerr c t|j|j|j|j |j |j Sr)r^rrrrrrrs r getparamszAifc_read.getparamssSD--/1B1B1D --/1B ,,.0@0@0BD Dr cLt|jdk(ry|jSNrrMrlrs r getmarkerszAifc_read.getmarkers t}}  "}}r cp|jD]}||dk(s |cStdj|Nrzmarker {0!r} does not existrlrformatrwidmarkers rgetmarkzAifc_read.getmark>mm FVAY  188<==r c^|dks||jkDr td||_d|_y)Nrzposition not in ranger()rrrmrs)rwposs rsetposzAifc_read.setposs/ 7cDMM)/0 0!"r c|jrv|jjd|jjd}|j|j z}|r|jj|dzd|_|dk(ry|jj||j z}|j r|r|j |}|jt||j|jzzz|_|S)Nrrgr ) rsrrseekrrm _framesizerkrMrr)rwnframesr,rr+s r readframeszAifc_read.readframess  ! !    ! !! $$$))!,E..4??2C  %%cAg.%&D " a<$$Wt%>? ==T==&D#d):>//9J+KK r ctj5tjdtddl}dddj |dS#1swYxYwNr[categoryrr")warningscatch_warnings simplefilterDeprecationWarningaudioopalaw2linrwr+rs r _alaw2linzAifc_read._alaw2linL  $ $ &   ! !(5G H  a((   AActj5tjdtddl}dddj |dS#1swYxYwr)rrrrrulaw2linrs r _ulaw2linzAifc_read._ulaw2linrrctj5tjdtddl}dddt |dsd|_j|d|j \}|_|S#1swYCxYwNr[rr _adpcmstater")rrrrrhasattrr adpcm2linrs r _adpcm2linzAifc_read._adpcm2linsr  $ $ &   ! !(5G H  t]+#D !(!2!24D>W,$(OODM^^'99$(NNDM^^'99$(NNDM^^'99$(NNDM >??"#)%DN.DNr c|t|} t|D]F}t|}t|}t|}|s|s)|jj |||fHy#t $rPdt|jdt|jdk(rdndd|}tj|YywxYw)Nz"Warning: MARK chunk contains only z markerr(rOz instead of ) r#rangerr-rlappendrrMrr)rwrxnmarkersirrnamews rruzAifc_read._readmarksu% 8_ : ' '#E*$MM(("c49 : dmm$C ,>!,Cb&LA MM!   s3A" A""AB;:B;)r r r rnr{rrrrrrrrrrrrrrrrrrrrrrrtrur r rr`r`sH E&@P    D  > # *) ) ) */Xr r`ceZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!d Z"d!Z#d"Z$d#Z%d$Z&d%Z'd&Z(y)' Aifc_writeNct|trBtj|d} |j ||j drd|_yy|j |y#|j xYw)Nwbz.aiffr)r~rrrr{rendswithrprs rrzAifc_write.__init__Csj a "--40K  K( zz'" # KKN !!#s A%%A8c||_t|_d|_d|_d|_d|_d|_d|_d|_ d|_ d|_ d|_ g|_ d|_d|_y)Nrrrr()rn _AIFC_versionrjrrrkrrrr_nframeswritten _datawritten _datalengthrl _marklengthrprs rr{zAifc_write.initfpSso %  *     r c$|jyrrrs r__del__zAifc_write.__del__drr c|Srr rs rrzAifc_write.__enter__grr c$|jyrrrs rrzAifc_write.__exit__jrr c@|jr tdd|_y)N0cannot change parameters after starting to writerrrrprs raiffzAifc_write.aiffp   JK K r c@|jr tdd|_y)Nrr(rrs raifczAifc_write.aifcurr c`|jr td|dkr td||_y)Nrr(r)rrr)rw nchannelss r setnchannelszAifc_write.setnchannelszs1   JK K q=+, ,#r cH|js td|jS)Nznumber of channels not set)rrrs rrzAifc_write.getnchannelss45 5r cj|jr td|dks|dkDr td||_y)Nrr(rr)rrr)rw sampwidths r setsampwidthzAifc_write.setsampwidths7   JK K q=IM*+ +#r cH|js td|jS)Nzsample width not set)rrrs rrzAifc_write.getsampwidths./ /r c`|jr td|dkr td||_y)Nrrzbad frame rate)rrr)rw framerates r setframeratezAifc_write.setframerates1   JK K >() )#r cH|js td|jS)Nzframe rate not set)rrrs rrzAifc_write.getframerates,- -r c@|jr td||_y)Nr)rrr)rwrs r setnframeszAifc_write.setnframess   JK K r c|jSrrrs rrzAifc_write.getnframes###r cl|jr td|dvr td||_||_yNr)rrrrrrrrr)rrrr)rwcomptypecompnames r setcomptypezAifc_write.setcomptypes@   JK K I I67 7!!r c|jSrrrs rrzAifc_write.getcomptyperr c|jSrrrs rrzAifc_write.getcompnamerr c|\}}}}}}|jr td|dvr td|j||j||j ||j ||j ||yr()rrrrr r#r+)rwparamsrrrrr)r*s r setparamszAifc_write.setparamssGMD 9i(H   JK K I I67 7 )$ )$ )$   8,r c|jr|jr |js tdt |j|j|j|j |j |jS)Nznot all parameters set)rrrrr^rrrrs rrzAifc_write.getparamssUdooT__01 1DOOT__doo MM4>>4>>K Kr cN|dkr td|dkr tdt|ts tdtt |j D]+}||j |dk(s|||f|j |<y|j j |||fy)Nrzmarker ID must be > 0zmarker position must be >= 0zmarker name must be bytes)rr~bytesrrMrlr)rwrrrrs rsetmarkzAifc_write.setmarks 7/0 0 767 7$&34 4s4==)* AT]]1%a((#%sD= a   b#t_-r cp|jD]}||dk(s |cStdj|rrrs rrzAifc_write.getmarkrr cLt|jdk(ry|jSrrrs rrzAifc_write.getmarkersrr c|jSrr%rs rrzAifc_write.tellr&r ct|ttfst|j d}|j t |t ||j|jzz}|jr|j|}|jj||j|z|_ |jt |z|_ y)NrK)r~r3 bytearray memoryviewcast_ensure_header_writtenrMrrrkrnr=rr)rwr+rs rwriteframesrawzAifc_write.writeframesraws$ 23d#((-D ##CI.d)$// AB ====&D #33g= --D 9r c|j||j|jk7s|j|jk7r|j yyr)r=rrr r _patchheader)rwr+s r writeframeszAifc_write.writeframessG D!   4== 0$"3"33    4r c,|jy |jd|jdzr/|jjd|jdz|_|j |j |j k7s%|j|jk7s |jr|jd|_ |j}d|_|jy#d|_ |j}d|_|jwxYw)Nrr(rL) rnr<rr= _writemarkersrrr r r?rkr)rwr5s rrzAifc_write.closes ::     ' ' *  1$   )$($5$5$9!    ##t}}4""d&7&77""!!#!DM ADJ GGI!DM ADJ GGIs B-C'',Dctj5tjdtddl}dddj |dS#1swYxYwr)rrrrrlin2alawrs r _lin2alawzAifc_write._lin2alawrrctj5tjdtddl}dddj |dS#1swYxYwr)rrrrrlin2ulawrs r _lin2ulawzAifc_write._lin2ulawrrctj5tjdtddl}dddt |dsd|_j|d|j \}|_|S#1swYCxYwr)rrrrrrr lin2adpcmrs r _lin2adpcmzAifc_write._lin2adpcmsr  $ $ &   ! !(5G H  t]+#D !(!2!24D>W $ OODM ^^1 1 NNDM ^^1 1 NNDM ^^1 1 NNDM2r ch|jr|jdk7r|j|jj d|j s!||j |jzz|_|j |j z|jz|_|jdzr|jdz|_|jr|jdvr8|jdz|_|jdzr^|jdz|_nI|jdk(r:|jdzdz|_|jdzr|jdz|_ |jj|_ |j|j}|jrm|jj d |jj d t|jdt|j|jn|jj d |jj d t|j|t!|j|j |j|jj|_t|j|j |jd vrt!|jdn#t!|j|jdzt%|j|j&|jrE|jj |jt)|j|j*|jj d|j|jj|_t|j|jdzt|jdt|jdy#ttf$r d|_ YwxYw)Nrrbr()rrrrr"rrrrdrhrcre)rrrrrrgrfr)rprrRrnr=rrrr r_form_length_posAttributeErrorOSError_write_form_lengthrHrjrA _nframes_posrZrrPr_ssnd_length_pos)rw initlength commlengths rrOzAifc_write._write_headerJs ::$..G3  " " $ !}}&4??T__+LMDM==4??:T__L   a #//!3D  ::~~!EE#'#3#3q#8 ##a''+'7'7!';D$7*$($4$4q$8Q#> ##a''+'7'7!';D$ )$(JJOO$5D !,,T-=-=> :: JJ  W % JJ  W % Q ' T]] 3 JJ  W % !TZZ,TZZ1  , $  1D TZZ/ >>J J Q ' T__q%8 9TZZ1 :: JJ  T^^ , $**dnn 5 !  ,$(JJOO$5D !TZZ!1!1A!56TZZ#TZZ#;( )$(D ! )sPP10P1c|jr%dt|jz}|dzr|dz}d}nd}d}t|jd|z|j zdz|zdz|z|S) Nrr( rrrrg)rprMrrHrnr )rw datalengthr[ verslengths rrWzAifc_write._write_form_length}s ::#dnn"55JA~'!^ JJJTZZZ$2B2B!B"#"$&(")+5"6 7r cL|jj}|jdzr+|jdz}|jjdn |j}||jk(rE|j |j k(r,|jdk(r|jj|dy|jj|jd|j|}|jj|jdt|j|j |jj|jdt|j|dz|jj|d|j |_||_y)Nr(rLrrg)rnrrr=r rrr rrTrWrXrHrY)rwcurposr_r,s rr?zAifc_write._patchheaders5"   q **Q.J JJ  W %**J )) )mmt333!# JJOOFA &  --q1'' 3 ))1-TZZ!5!56 --q1TZZa0 ",, %r c8t|jdk(ry|jjdd}|jD]3}|\}}}|t|zdzdz}t|dzdk(s/|dz}5t |j||dz|_t |jt|j|jD]J}|\}}}t |j|t |j|t|j|Ly)Nrrir"r(rg)rMrlrnr=rHr rArP)rwr*rrrrs rrBzAifc_write._writemarkerss t}}  "  !mm $F"MBTc$i'!+a/F4y1}!!  $ TZZ(!A:TZZT]]!34mm ,F"MBT R ( S ) $**d +  ,r ))r r r rnrr{r rrrrrrrrr rr#rr+rrr0rr4rrrr=r@rrErHrKrMr<rRrOrWr?rBr r rrr#s< E "   $ $ $  $" -K .>  $ : 2) ) ) )&+1$f &,,r rc|t|dr |j}nd}|dvr t|S|dvr t|St d)Nmoder})rr})rrz$mode must be 'r', 'rb', 'w', or 'wb')rrfr`rr)r5rfs rrrsO | 1f 66DD {|  !}:;;r __main__r(z/usr/demos/data/audio/bach.aiffrgReadingz nchannels =z nframes =z sampwidth =z framerate =z comptype =z compname =r"WritingrizDone.r);__doc__rrr__all__ _deprecatedr Exceptionrrrrr#r&r-r3r:rArDrFrHrPrZrrrrxr\ collectionsr]r^rrrrr)r*r`rrsysargvrfnr5printrrrrrrgngr0rrr+r@r r rrvsFP F Xg. I  ! ! ! !  " """""BXH($67#.SU "W !8 !5 7  J "%  MM^N,N,` < z 88AB< 9: !B b#! i mQ^^-. mQ\\^, mQ^^-. mQ^^-. mQ]]_- mQ]]_- 88AB<!B )R b# (! AKKM*<<-DMM$'   ( 'N% ^ ( (s2+J &CJ%*AJ2J% JJ" J%%J.