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KO}ӽmSşذqsOy?\[,d@'73'j%kOe`1.g2"e =YIzS2|zŐƄa\U,dP;jhhhaxǶ?КZ՚.q SE+XrbOu%\GتX(H,N^~]JyEZQKceTQ]VGYqnah;y$cQahT&QPZ*iZ8UQQM.qo/T\7X"u?Mttl2Xq(IoW{R^ ux*SYJ! 4S.Jy~ BROS[V|žKNɛP(L6V^|cR7i7nZW1Fd@ Ara{詑|(T*dN]Ko?s=@ |_EvF]׍kR)eBJc" MUUbY6`~V޴dJKß&~'d3i WWWWWW
Current Directory: /usr/lib64/python3.6/__pycache__
Viewing File: /usr/lib64/python3.6/__pycache__/aifc.cpython-36.opt-1.pyc
3 \�~�@s>dZddlZddlZddlZdddgZGdd�de�ZdZdd �Zd d �Z d d �Z dd�Z dd�Z dZ dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zdd!lmZdd"lmZed#d$�Zd%ej_d&ej_d'ej_d(ej_d)ej_d*ej_Gd+d,�d,�Z Gd-d.�d.�Z!d@d/d�Z"e"Z#e$d0k�r:ddl%Z%e%j&d1d��sHe%j&j'd2�e%j&d1Z(e"e(d3���Z)e*d4e(�e*d5e)j+��e*d6e)j,��e*d7e)j-��e*d8e)j.��e*d9e)j/��e*d:e)j0��e%j&d;d��r0e%j&d;Z1e*d<e1�e"e1d=��8Z2e2j3e)j4��x"e)j5d>�Z6e6�sPe2j7e6��q�WWdQRXe*d?�WdQRXdS)AaJStuff 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 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. �N�Error�open�openfpc@s eZdZdS)rN)�__name__� __module__� __qualname__�rr�/usr/lib64/python3.6/aifc.pyr�sl@QEc Cs6ytjd|jd��dStjk r0t�YnXdS)Nz>l�r)�struct�unpack�read�error�EOFError)�filerrr � _read_long�src Cs6ytjd|jd��dStjk r0t�YnXdS)Nz>Lr r)r r r rr)rrrr � _read_ulong�src Cs6ytjd|jd��dStjk r0t�YnXdS)Nz>h�r)r r r rr)rrrr � _read_short�src Cs6ytjd|jd��dStjk r0t�YnXdS)Nz>Hrr)r r r rr)rrrr � _read_ushort�srcCs@t|jd��}|dkrd}n |j|�}|d@dkr<|jd�}|S)N�r�)�ordr )r�length�data�dummyrrr � _read_string�s   rg�����cCs�t|�}d}|dkr d }|d}t|�}t|�}||koL|koLdknrXd}n0|dkrft}n"|d}|d|td|d �}||S) Nrri�gi�i�?lg@�?���)rr� _HUGE_VAL�pow)�f�expon�sign�himant�lomantrrr � _read_float�s"r&cCs|jtjd|��dS)Nz>h)�writer �pack)r!�xrrr � _write_short�sr*cCs|jtjd|��dS)Nz>H)r'r r()r!r)rrr � _write_ushort�sr+cCs|jtjd|��dS)Nz>l)r'r r()r!r)rrr � _write_long�sr,cCs|jtjd|��dS)Nz>L)r'r r()r!r)rrr � _write_ulong�sr-cCsRt|�dkrtd��|jtjdt|���|j|�t|�d@dkrN|jd�dS)N�z%string exceeds maximum pstring length�Brr�)�len� ValueErrorr'r r()r!�srrr � _write_string�s   r4c Cs�ddl}|dkrd}|d}nd}|dkr8d}d}d}n�|j|�\}}|dks^|dks^||krp|dB}d}d}nh|d}|dkr�|j||�}d}||B}|j|d�}|j|�}t|�}|j||d�}|j|�}t|�}t||�t||�t||�dS) Nri�ri@i�i�?� r)�mathZfrexpZldexpZfloor�intr+r-) r!r)r6r#r"r$r%ZfmantZfsmantrrr � _write_float�s8       r8)�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)c@s�eZdZdZdd�Zdd�Zdd�Zdd �Zd d �Zd d �Z dd�Z dd�Z dd�Z dd�Z dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�ZdS)2� Aifc_readNc Cs<d|_d|_g|_d|_||_t|�}|j�dkr:td��|jd�}|dkrTd|_ n|dkrdd|_ ntd��d|_ d|_ x�d|_ yt|j�}Wnt k r�PYnX|j�}|d kr�|j|�d|_ nH|d kr�||_ |jd �}d|_ n(|d kr�t|�|_n|d k�r|j|�|j�qzW|j �s0|j �r8td��dS)NrsFORMz file does not start with FORM idr sAIFFsAIFCrznot an AIFF or AIFF-C filesCOMMsSSND�sFVERsMARKz$COMM chunk and/or SSND chunk missing)�_version�_convert�_markers� _soundpos�_filer9Zgetnamerr �_aifcZ_comm_chunk_read� _ssnd_chunk�_ssnd_seek_neededr�_read_comm_chunkr� _readmark�skip)�selfr�chunkZformdataZ chunknamerrrr �initfp4sJ        zAifc_read.initfpc CsLt|t�r>tj|d�}y|j|�WqH|j��YqHXn |j|�dS)N�rb)� isinstance�str�builtinsrrK�close)rIr!� file_objectrrr �__init__\s   zAifc_read.__init__cCs|S)Nr)rIrrr � __enter__hszAifc_read.__enter__cGs |j�dS)N)rP)rI�argsrrr �__exit__kszAifc_read.__exit__cCs|jS)N)rB)rIrrr �getfpqszAifc_read.getfpcCsd|_d|_dS)Nrr)rErA)rIrrr �rewindtszAifc_read.rewindcCs |j}|dk rd|_|j�dS)N)rBrP)rIrrrr rPxszAifc_read.closecCs|jS)N)rA)rIrrr �tell~szAifc_read.tellcCs|jS)N)� _nchannels)rIrrr � getnchannels�szAifc_read.getnchannelscCs|jS)N)�_nframes)rIrrr � getnframes�szAifc_read.getnframescCs|jS)N)� _sampwidth)rIrrr � getsampwidth�szAifc_read.getsampwidthcCs|jS)N)� _framerate)rIrrr � getframerate�szAifc_read.getframeratecCs|jS)N)� _comptype)rIrrr � getcomptype�szAifc_read.getcomptypecCs|jS)N)� _compname)rIrrr � getcompname�szAifc_read.getcompnamecCs*t|j�|j�|j�|j�|j�|j��S)N)r;rZr^r`r\rbrd)rIrrr � getparams�s zAifc_read.getparamscCst|j�dkrdS|jS)Nr)r1r@)rIrrr � getmarkers�szAifc_read.getmarkerscCs2x|jD]}||dkr|SqWtdj|���dS)Nrzmarker {0!r} does not exist)r@r�format)rI�id�markerrrr �getmark�s  zAifc_read.getmarkcCs*|dks||jkrtd��||_d|_dS)Nrzposition not in ranger)r[rrArE)rI�posrrr �setpos�szAifc_read.setposcCs�|jrD|jjd�|jjd�}|j|j}|r>|jj|d�d|_|dkrPdS|jj||j�}|jrv|rv|j|�}|jt|�|j|j |_|S)Nrr=r) rErD�seekr rA� _framesizer?r1rYr])rI�nframesrrkrrrr � readframes�s     zAifc_read.readframescCsddl}|j|d�S)Nrr)�audioopZalaw2lin)rIrrqrrr � _alaw2lin�szAifc_read._alaw2lincCsddl}|j|d�S)Nrr)rqZulaw2lin)rIrrqrrr � _ulaw2lin�szAifc_read._ulaw2lincCs2ddl}t|d�sd|_|j|d|j�\}|_|S)Nr� _adpcmstater)rq�hasattrrtZ adpcm2lin)rIrrqrrr � _adpcm2lin�s  zAifc_read._adpcm2lincCs.t|�|_t|�|_t|�dd|_tt|��|_|j|j|_|j �rd}|j dkrld}t j d�d|_ |j d�|_|r�t|jj d��}|d@dkr�|d}|j ||_ |jjdd�t|�|_|jd k�r*|jd kr�|j|_n2|jdkr�|j|_n|jdk�r|j|_ntd��d|_n d |_d|_dS)N�r=r�rzWarning: bad COMM chunk size�r sNONEsG722�ulaw�ULAW�alaw�ALAWzunsupported compression typersnot compressedr)rzr{)r|r})rrYrr[r]r7r&r_rnrCZ chunksize�warnings�warnr rarrrmrrcrvr?rsrrr)rIrJZkludgerrrr rF�s<               zAifc_read._read_comm_chunkc Cs�t|�}yHxBt|�D]6}t|�}t|�}t|�}|s8|r|jj|||f�qWWnDtk r�dt|j�t|j�dkr|dnd|f}tj |�YnXdS)Nz;Warning: MARK chunk contains only %s marker%s instead of %sr�r3) r�rangerrr@�appendrr1r~r)rIrJZnmarkers�irhrk�name�wrrr rG�szAifc_read._readmark)rrrrBrKrRrSrUrVrWrPrXrZr\r^r`rbrdrerfrjrlrprrrsrvrFrGrrrr r<s2$( &r<c@s0eZdZdZdd�Zdd�Zdd�Zdd �Zd d �Zd d �Z dd�Z dd�Z dd�Z dd�Z dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�Zd:d;�Z d<d=�Z!d>d?�Z"d@dA�Z#dBdC�Z$dDdE�Z%dFdG�Z&dHdI�Z'dS)J� Aifc_writeNc Cs\t|t�rNtj|d�}y|j|�Wn|j��YnX|jd�rXd|_n |j|�dS)N�wbz.aiffr)rMrNrOrrKrP�endswithrC)rIr!rQrrr rR+s   zAifc_write.__init__cCs^||_t|_d|_d|_d|_d|_d|_d|_d|_ d|_ d|_ d|_ g|_ d|_d|_dS)NsNONEsnot compressedrr)rB� _AIFC_versionr>rarcr?rYr]r_r[�_nframeswritten� _datawritten� _datalengthr@� _marklengthrC)rIrrrr rK;szAifc_write.initfpcCs |j�dS)N)rP)rIrrr �__del__LszAifc_write.__del__cCs|S)Nr)rIrrr rSOszAifc_write.__enter__cGs |j�dS)N)rP)rIrTrrr rURszAifc_write.__exit__cCs|jrtd��d|_dS)Nz0cannot change parameters after starting to writer)r�rrC)rIrrr �aiffXszAifc_write.aiffcCs|jrtd��d|_dS)Nz0cannot change parameters after starting to writer)r�rrC)rIrrr �aifc]szAifc_write.aifccCs(|jrtd��|dkrtd��||_dS)Nz0cannot change parameters after starting to writerzbad # of channels)r�rrY)rI� nchannelsrrr � setnchannelsbs zAifc_write.setnchannelscCs|jstd��|jS)Nznumber of channels not set)rYr)rIrrr rZiszAifc_write.getnchannelscCs0|jrtd��|dks|dkr&td��||_dS)Nz0cannot change parameters after starting to writerr zbad sample width)r�rr])rI� sampwidthrrr � setsampwidthns zAifc_write.setsampwidthcCs|jstd��|jS)Nzsample width not set)r]r)rIrrr r^uszAifc_write.getsampwidthcCs(|jrtd��|dkrtd��||_dS)Nz0cannot change parameters after starting to writerzbad frame rate)r�rr_)rI� frameraterrr � setframeratezs zAifc_write.setframeratecCs|jstd��|jS)Nzframe rate not set)r_r)rIrrr r`�szAifc_write.getframeratecCs|jrtd��||_dS)Nz0cannot change parameters after starting to write)r�rr[)rIrorrr � setnframes�szAifc_write.setnframescCs|jS)N)r�)rIrrr r\�szAifc_write.getnframescCs.|jrtd��|d krtd��||_||_dS) Nz0cannot change parameters after starting to write�NONE�ulaw�ULAW�alaw�ALAW�G722zunsupported compression type)r�r�r�r�r�r�)r�rrarc)rI�comptype�compnamerrr � setcomptype�szAifc_write.setcomptypecCs|jS)N)ra)rIrrr rb�szAifc_write.getcomptypecCs|jS)N)rc)rIrrr rd�szAifc_write.getcompnamecCsf|\}}}}}}|jrtd��|d kr.td��|j|�|j|�|j|�|j|�|j||�dS) Nz0cannot change parameters after starting to write�NONE�ulaw�ULAW�alaw�ALAW�G722zunsupported compression type)r�r�r�r�r�r�)r�rr�r�r�r�r�)rIZparamsr�r�r�ror�r�rrr � setparams�s    zAifc_write.setparamscCs>|j s|j s|j r td��t|j|j|j|j|j|j�S)Nznot all parameters set)rYr]r_rr;r[rarc)rIrrr re�szAifc_write.getparamscCs�|dkrtd��|dkr td��t|t�s2td��x<tt|j��D]*}||j|dkrB|||f|j|<dSqBW|jj|||f�dS)Nrzmarker ID must be > 0zmarker position must be >= 0zmarker name must be bytes)rrM�bytesr�r1r@r�)rIrhrkr�r�rrr �setmark�s zAifc_write.setmarkcCs2x|jD]}||dkr|SqWtdj|���dS)Nrzmarker {0!r} does not exist)r@rrg)rIrhrirrr rj�s  zAifc_write.getmarkcCst|j�dkrdS|jS)Nr)r1r@)rIrrr rf�szAifc_write.getmarkerscCs|jS)N)r�)rIrrr rX�szAifc_write.tellcCszt|ttf�st|�jd�}|jt|��t|�|j|j}|j rN|j |�}|j j |�|j ||_ |j t|�|_ dS)Nr/)rMr�� bytearray� memoryview�cast�_ensure_header_writtenr1r]rYr?rBr'r�r�)rIrrorrr �writeframesraw�s   zAifc_write.writeframesrawcCs.|j|�|j|jks"|j|jkr*|j�dS)N)r�r�r[r�r�� _patchheader)rIrrrr � writeframes�s   zAifc_write.writeframesc Cs�|jdkrdSz^|jd�|jd@r<|jjd�|jd|_|j�|j|jksb|j|jksb|jrj|j �Wdd|_ |j}d|_|j �XdS)Nrrr0) rBr�r�r'� _writemarkersr�r[r�r�r�r?rP)rIr!rrr rP�s         zAifc_write.closecCsddl}|j|d�S)Nrr)rqZlin2alaw)rIrrqrrr � _lin2alaw�szAifc_write._lin2alawcCsddl}|j|d�S)Nrr)rqZlin2ulaw)rIrrqrrr � _lin2ulaw�szAifc_write._lin2ulawcCs2ddl}t|d�sd|_|j|d|j�\}|_|S)Nrrtr)rqrurtZ lin2adpcm)rIrrqrrr � _lin2adpcms  zAifc_write._lin2adpcmcCsf|jsb|jd kr.|jsd|_|jdkr.td��|js<td��|jsJtd ��|jsXtd ��|j|�dS) N�ULAW�ulaw�ALAW�alaw�G722rzRsample width must be 2 when compressing with ulaw/ULAW, alaw/ALAW or G7.22 (ADPCM)z# channels not specifiedzsample width not specifiedzsampling rate not specified)r�r�r�r�r�)r�rar]rrYr_� _write_header)rIZdatasizerrr r� s  z!Aifc_write._ensure_header_writtencCs>|jdkr|j|_n&|jdkr(|j|_n|jdkr:|j|_dS)NsG722�ulaw�ULAW�alaw�ALAW)r�r�)r�r�)rar�r?r�r�)rIrrr �_init_compressions      zAifc_write._init_compressioncCsL|jr|jdkr|j�|jjd�|js<||j|j|_|j|j|j|_|jd@rf|jd|_|jr�|jdkr�|jd|_|jd@r�|jd|_n0|jd kr�|jd d |_|jd@r�|jd|_y|jj �|_ Wn t t fk �r�d|_ YnX|j |j�}|j�rD|jjd �|jjd �t|jd �t|j|j�n |jjd�|jjd�t|j|�t|j|j�|j dk �r�|jj �|_t|j|j�|jdk�r�t|jd�nt|j|jd�t|j|j�|j�r�|jj|j�t|j|j�|jjd�|j dk �r|jj �|_t|j|jd�t|jd�t|jd�dS)NsNONEsFORMr�ulaw�ULAW�alaw�ALAWr�G722�r sAIFCsFVERsAIFFsCOMMr=sSSNDr)r�r�r�r�)r�r�r�r�r�)rCrar�rBr'r[rYr]r�rX�_form_length_pos�AttributeError�OSError�_write_form_lengthr-r>r*� _nframes_posr8r_r4rc�_ssnd_length_pos)rIZ initlength� commlengthrrr r�!s^                        zAifc_write._write_headercCs\|jr*d t|j�}|d@r$|d}d}nd}d}t|jd||jd|d|�|S) Nrx�r� rr r=�ry)rCr1rcr-rBr�)rI� datalengthr�Z verslengthrrr r�Ts zAifc_write._write_form_lengthcCs�|jj�}|jd@r,|jd}|jjd�n|j}||jkrd|j|jkrd|jdkrd|jj|d�dS|jj|j d�|j |�}|jj|j d�t |j|j�|jj|j d�t |j|d�|jj|d�|j|_||_dS)Nrr0rr=)rBrXr�r'r�r[r�r�rmr�r�r�r-r�)rIZcurposr�rrrr r�as&       zAifc_write._patchheadercCs�t|j�dkrdS|jjd�d}xD|jD]:}|\}}}|t|�dd}t|�d@dkr*|d}q*Wt|j|�|d|_t|jt|j��x<|jD]2}|\}}}t|j|�t|j|�t|j|�q�WdS)NrsMARKrr�r=)r1r@rBr'r-r�r*r4)rIrrirhrkr�rrr r�ws"          zAifc_write._writemarkers)(rrrrBrRrKr�rSrUr�r�r�rZr�r^r�r`r�r\r�rbrdr�rer�rjrfrXr�r�rPr�r�r�r�r�r�r�r�r�rrrr r� sJ    3 r�cCsJ|dkrt|d�r|j}nd}|dkr.t|�S|dkr>t|�Std��dS) N�moderL�rr�r�z$mode must be 'r', 'rb', 'w', or 'wb')r�rL)r�r�)rur�r<r�r)r!r�rrr r�s �__main__rz/usr/demos/data/audio/bach.aiffr�ZReadingz nchannels =z nframes =z sampwidth =z framerate =z comptype =z compname =rZWritingr�izDone.)N)8�__doc__r rOr~�__all__� Exceptionrr�rrrrrrr&r*r+r,r-r4r8rJr9� collectionsr:r;r�r�r�ror�r�r<r�rrr�sys�argvr��fnr!�printrZr\r^r`rbrdZgn�gr�rerprr�rrrr �<module>�sz  !  ~