Ë ‚Ö¦iãó–—dZddlZejed¬«ddgZddlmZedd «Zd ej_d ej_d ej_d ej_dej_d„Z d„ZgZd„Zej#e«d„Zej#e«d„Zej#e«d„Zej#e«d„Zej#e«d„Zej#e«d„Zej#e«d„Zej#e«d„Zd„Zd„Zd„Zd„Zd„Zedk(re«yy) a¶Routines to help recognizing sound files. Function whathdr() recognizes various types of sound file headers. It understands almost all headers that SOX can decode. The return tuple contains the following items, in this order: - file type (as SOX understands it) - sampling rate (0 if unknown or hard to decode) - number of channels (0 if unknown or hard to decode) - number of frames in the file (-1 if unknown or hard to decode) - number of bits/sample, or 'U' for U-LAW, or 'A' for A-LAW If the file doesn't have a recognizable type, it returns None. If the file can't be opened, OSError is raised. To compute the total time, divide the number of frames by the sampling rate (a frame contains a sample for each channel). Function what() calls whathdr(). (It used to also use some heuristics for raw data, but this doesn't work very well.) Finally, the function test() is a simple main program that calls what() for all files mentioned on the argument list. For directory arguments it calls what() for all files in that directory. Default argument is "." (testing all files in the current directory). The option -r tells it to recurse down directories found inside explicitly given directories. éN)éé )ÚremoveÚwhatÚwhathdr)Ú namedtupleÚ SndHeadersz.filetype framerate nchannels nframes sampwidthz¡The value for type indicates the data type and will be one of the strings 'aifc', 'aiff', 'au','hcom', 'sndr', 'sndt', 'voc', 'wav', '8svx', 'sb', 'ub', or 'ul'.zYThe sampling_rate will be either the actual value or 0 if unknown or difficult to decode.z^The number of channels or 0 if it cannot be determined or if the value is difficult to decode.z?The value for frames will be either the number of frames or -1.zAEither the sample size in bits or 'A' for A-LAW or 'U' for u-LAW.có—t|«}|S)zGuess the type of a sound file.)r)ÚfilenameÚress ú/usr/lib64/python3.12/sndhdr.pyrr8s€ä �(Ó €CØ €Jócó¼—t|d«5}|jd«}tD] }|||«}|sŒt|Žccddd«S ddd«y#1swYyxYw)zRecognize sound headers.ÚrbiN)ÚopenÚreadÚtestsr )r ÚfÚhÚtfr s r rr>sU€ä ˆh˜Ô  Ø �F‰F�3‹KˆßˆBÙ�Q˜“(ˆCÚÜ! 3Ð'Ñ'÷ Ñ àð÷ × Ñ ús�&A´ AÁAÁAcóæ—tj«5tjdt¬«ddl}ddd«|j d«sy|dddk(rd }n |ddd k(rd }ny|j d« j|d «}||j«|j«|j«d|j«zfS#1swYŒ˜xYw#tjf$rYywxYw) zAIFC and AIFF filesÚignore)ÚcategoryrNóFORMéé sAIFCÚaifcsAIFFÚaiffÚr)ÚwarningsÚcatch_warningsÚ simplefilterÚDeprecationWarningrÚ startswithÚseekrÚEOFErrorÚErrorÚ getframerateÚ getnchannelsÚ getnframesÚ getsampwidth)rrrÚfmtÚas r Ú test_aifcr.OsÞ€ä × Ñ Õ "Ü×јhÔ1CÕDÛ÷ #ð �<‰<˜Ô ØØˆˆ2€w�'ÒØ‰Ø ˆ1ˆRˆ�GÒ Ø‰àØ‡F�Fˆ1„IðØ �I‰I�a˜Ó ˆð �—‘Ó! 1§>¡>Ó#3Ø �L‰L‹N˜A §¡Ó 0Ñ0ð 2ð2÷! #Ð "ûô �d—j‘jÐ !òÙðús• C Á8Cà CÃC0Ã/C0có*—|jd«rt}n|dddvrt}nyd}||dd«}||dd«}||dd«}||dd «}||d d «}d } |d k(rd } n|d k(rd} n |dk(rd} d } nd} | |z} | r|| z } nd} |||| | fS)zAU and SND filess.sndNé)sds.sdns.ÚaurrééééÚUérÚ?éÿÿÿÿ)r$Ú get_long_beÚ get_long_le) rrÚfuncÚfiletypeÚhdr_sizeÚ data_sizeÚencodingÚrateÚ nchannelsÚ sample_sizeÚ sample_bitsÚ frame_sizeÚnframes r Útest_aurGgsÚ€à‡|�|�GÔÜ‰Ø ˆ2ˆAˆÐ%Ñ %Ü‰àØ€HÙ�A�a˜�F‹|€HÙ�Q�q˜�W“ €IÙ�A�b˜�H‹~€HÙ ��"�R�‹>€DÙ�Q�r˜"�X“€IØ€KØ�1‚}؉ Ø �QŠØ‰ Ø �QŠØˆ ؉ àˆ Ø˜yÑ(€JÙØ˜ZÑ'‰àˆØ �T˜9 f¨kÐ 9Ð9rcób—|dddk7s|dddk7ryt|dd «}|rd |z }nd }d |d ddfS)z HCOM fileéAéEsFSSDé€é„sHCOMNé�é”i"VrÚhcomr5r9r)r:)rrÚdivisorrAs r Ú test_hcomrQ‰sR€àˆˆB€x�7Ò˜a  C˜j¨GÒ3ØÜ˜!˜C ˜*Ó%€GÙØ�w‰‰àˆØ �4˜˜B Ð !Ð!rcó¶—|jd«syt|dd«}d}d|cxkrdkr&nn#||dk(rd||d zz }|rtd |z «}d |dd d fS)zVOC filesCreative Voice FileNr3ériôr5ér0g€„.AÚvocr9r)r$Ú get_short_leÚint)rrÚsbseekrAÚratecodes r Útest_vocrZ—ss€à �<‰<Ð2Ô 3ØÜ ˜!˜B˜r˜(Ó #€FØ €D؈FÔ�SÕ˜Q˜v™Y¨!š^ؘ˜6 !™8™Ñ$ˆÙ Ü�y 8Ñ+Ó,ˆDØ �$˜˜2˜qÐ Ð rcóP—ddl}|jd«r|dddk7s|dddk7ry|jd« |j|d «}d |j «|j«|j«d|j«zfS#t|j f$rYywxYw) zWAV filerNsRIFFrrsWAVEr2sfmt rÚwav) Úwaver$r%rr&r'r(r)r*r+)rrr]Úws r Útest_wavr_¦s£€ãà �<‰<˜Ô  A a¨ G¨wÒ$6¸!¸B¸r¸(ÀgÒ:MØØ‡F�Fˆ1„IðØ �I‰I�a˜Ó ˆð �1—>‘>Ó# Q§^¡^Ó%5Ø—<‘<“> 1 Q§^¡^Ó%5Ñ#5ð 7ð7øô �d—j‘jÐ !òÙðús¹B  B%Â$B%có8—|jd«r|dddk7ryy)z 8SVX filerrrs8SVXN)Ú8svxrr5rr)r$)rrs r Ú test_8svxrb·s!€à �<‰<˜Ô  A a¨ G¨wÒ$6Øà rcól—|jd«r#t|dd«}t|dd«}d|d|dfSy) z SNDT filesSOUNDrrr3rSÚsndtr5N)r$r;rV)rrÚnsamplesrAs r Ú test_sndtrfÁsD€à‡|�|�HÔܘq  2˜wÓ'ˆÜ˜A˜b ˜HÓ%ˆØ�t˜Q ¨!Ð+Ð+ðrcón—|jd«r$t|dd«}d|cxkrdkr ny d|ddd fSy y ) z SNDR filesr7r0i i¨aÚsndrr5r9rN)r$rV)rrrAs r Ú test_sndrriËsF€à‡|�|�GÔܘA˜a ˜FÓ#ˆØ �4Ô ˜5Õ Ø˜4  B¨Ð)Ð )ð !ðrcóB—|ddz|ddzz|ddzz|dzS)Nrr4r5r2r7rr©©Úbs r r:r:Ùó3€Ø ˆa‰D�B‰J˜1˜Q™4 2™:Ñ &¨!¨A©$°!©)Ñ 4°q¸±tÑ ;Ð;rcóB—|ddz|ddzz|ddzz|dzS)Nrr4r7r2r5rrrkrls r r;r;Ürnrcó—|ddz|dzS)Nrrr5rkrls r Ú get_short_berqßó€Ø ˆa‰D�A‰I˜˜1™Ñ Ðrcó—|ddz|dzS)Nr5rrrkrls r rVrVârrrcó\—ddl}d}|jddr#|jddk(r|jdd…=d} |jddrt|jdd|d«ytdg|d«y#t$r/|jj d«|j d«YywxYw)Nrr5z-rr7Ú.z [Interrupted] )ÚsysÚargvÚtestallÚKeyboardInterruptÚstderrÚwriteÚexit)rvÚ recursives r Útestr~ês�€ÛØ€IØ ‡x�x���|˜Ÿ™ ™  tÒ+Ø �H‰H�Q�q�SˆM؈ ðØ �8‰8�A�B‰<Ü �C—H‘H˜Q˜R�L )¨QÕ /ä �S�E˜9 aÕ (øÜ òØ � ‰ ×ÑÐ,Ô-Ø �‰�Ž ðúsº)A3Á$A3Á35B+Â*B+cóø—ddl}ddl}|D]Ó}|jj|«rwt |dzd¬«|s|rWt d«ddl}|j |jj |j|«d««}t||d«Œ‰t d«Œ•t |dzd¬«|jj« t t|««ŒÕy#t$rt d «YŒíwxYw) Nrz/:Ú )Úendzrecursing down:Ú*z*** directory (use -r) ***Ú:z*** not found ***) rvÚosÚpathÚisdirÚprintÚglobÚjoinÚescaperxÚstdoutÚflushrÚOSError)Úlistr}Útoplevelrvr„r rˆÚnamess r rxrxùsÅ€ÛÛ ÛˆØ �7‰7�=‰=˜Ô "Ü �(˜T‘/ sÕ +Ù™HÜÐ'Ô(ÛØŸ ™  "§'¡'§,¡,¨t¯{©{¸8Ó/DÀcÓ"JÓK�ܘ˜y¨!Õ,äÐ2Õ3ä �(˜S‘. cÕ *Ø �J‰J× Ñ Ô ð +Ü”d˜8“nÕ%ñøôò +ÜÐ)Ö*ð +úsà C"Ã"C9Ã8C9Ú__main__)Ú__doc__r Ú _deprecatedÚ__name__Ú__all__Ú collectionsrr r=Ú frameraterBÚnframesÚ sampwidthrrrr.ÚappendrGrQrZr_rbrfrir:r;rqrVr~rxrkrr Úr›skðñó:à€×Ñ�X gÕ.ð �9Ð €å"á ˜ ØHóJ€ ð >€ ×ÑÔð!1€ ×ÑÔð!6€ ×ÑÔð€ ×ÑÔð!#€ ×ÑÔòò ð €ò2ð*‡ � ˆYÔò:ð>‡ � ˆWÔò "ð‡ � ˆYÔò !ð‡ � ˆXÔò 7ð‡ � ˆXÔòð‡ � ˆYÔò,ð‡ � ˆYÔò*ð‡ � ˆYÔò<ò<òòò ò+ð* ˆzÒÙ…Fðr