Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325
 lŽŒYã@svdZddgZddlmZeddƒZdd„Zdd„ZgZd d „Zej eƒd d „Z ej e ƒd d„Z ej e ƒdd„Z ej e ƒdd„Z ej e ƒdd„Zej eƒdd„Zej eƒdd„Zej eƒdd„Zdd„Zdd„Zdd „Zd!d"„Zd#d$„Zed%krreƒd&S)'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. ÚwhatÚwhathdré)Ú namedtupleÚ SndHeadersz.filetype framerate nchannels nframes sampwidthcCst|ƒ}|S)zGuess the type of a sound file.)r)ÚfilenameÚres©rú%/opt/python35/lib/python3.5/sndhdr.pyr(s c Cs`t|dƒ�J}|jdƒ}x-tD]%}|||ƒ}|r(t|ŒSq(WdSWdQRXdS)zRecognize sound headers.ÚrbiN)ÚopenÚreadÚtestsr)rÚfÚhZtfrrrr r.s cCsÕddl}|jdƒsdS|dd…dkr>d}n#|dd…dkr]d}ndS|jdƒy|j|d ƒ}Wnt|jfk r¥dSYnX||jƒ|jƒ|jƒd|j ƒfS) NrsFORMéé sAIFCÚaifcsAIFFZaiffÚr) rÚ startswithÚseekr ÚEOFErrorÚErrorÚ getframerateÚ getnchannelsÚ getnframesÚ getsampwidth)rrrÚfmtÚarrr Ú test_aifc?s     rc Cs6|jdƒrt}n#|dd…dkr7t}ndSd}||dd…ƒ}||dd…ƒ}||dd…ƒ}||dd …ƒ}||d d …ƒ}d } |d krÊd } n6|d krßd} n!|dkrúd} d } nd} | |} | r|| } nd} |||| | fS)Ns.sndéóds.ódns.ZaurrééééÚUééú?)r r!éÿÿÿÿ)rÚ get_long_beÚ get_long_le) rrÚfuncZfiletypeZhdr_sizeZ data_sizeÚencodingÚrateZ nchannelsZ sample_sizeZ sample_bitsÚ frame_sizeZnframerrr Útest_auTs2          r1cCsr|dd…dks,|dd…dkr0dSt|dd…ƒ}|rYd |}nd }d |d dd fS)NéAéEsFSSDé€é„sHCOMé�é”i"VrZhcomr%rr*)r+)rrZdivisorr/rrr Ú test_hcomus, r8cCs–|jdƒsdSt|dd…ƒ}d}d|koFdknrƒ||dkrƒd||d}|rƒtd |ƒ}d |dd d fS) NsCreative Voice Filer#ériôr%érg€„.AZvocrr*)rÚ get_short_leÚint)rrZsbseekr/Zratecoderrr Útest_voc‚s,r=cCsÀddl}|jdƒ sH|dd…dksH|dd…dkrLdS|jdƒy|j|dƒ}Wnt|jfk r�dSYnXd |jƒ|jƒ|jƒd|j ƒfS) NrsRIFFrrsWAVEr"sfmt rZwav) ÚwaverrZopenfprrrrrr)rrr>Úwrrr Útest_wav�s <  r@cCs.|jdƒ s&|dd…dkr*dSdS) NsFORMrrs8SVXÚ8svxrr%)rArr%rr)r)rrrrr Ú test_8svx s&rBcCsR|jdƒrNt|dd…ƒ}t|dd…ƒ}d|d|dfSdS)NsSOUNDrrr#r9Zsndtr%)rr,r;)rrZnsamplesr/rrr Ú test_sndt©srCcCsX|jdƒrTt|dd…ƒ}d|ko<dknrTd|dd dfSdS) Nsr'ri i¨aZsndrr%rr*)rr;)rrr/rrr Ú test_sndr²srDcCs,|dd>|dd>B|dd>B|dBS)Nrr$r%r"r'rr(r)Úbrrr r+¿sr+cCs,|dd>|dd>B|dd>B|dBS)Nr(r$r'r"r%rrr)rErrr r,Âsr,cCs|dd>|dBS)Nrrr%r)rErrr Ú get_short_beÅsrFcCs|dd>|dBS)Nr%rrr)rErrr r;Èsr;c CsÎddl}d}|jdd…rN|jddkrN|jdd…=d}yJ|jdd…r„t|jdd…|dƒntdg|dƒWn/tk rÉ|jjdƒ|jdƒYnXdS)Nrr%z-rr'Ú.z [Interrupted] )ÚsysÚargvÚtestallÚKeyboardInterruptÚstderrÚwriteÚexit)rHÚ recursiverrr ÚtestÐs &  rPc Csddl}ddl}xè|D]à}|jj|ƒr«t|dddƒ|sW|ržtdƒddl}|j|jj|dƒƒ}t||dƒqÿtdƒqt|dddƒ|jj ƒytt |ƒƒWqt k rþtd ƒYqXqWdS) Nrz/:Úendú zrecursing down:Ú*z*** directory (use -r) ***ú:z*** not found ***) rHÚosÚpathÚisdirÚprintÚglobÚjoinrJÚstdoutÚflushrÚOSError)ÚlistrOZtoplevelrHrUrrYÚnamesrrr rJßs"         rJÚ__main__N)Ú__doc__Ú__all__Ú collectionsrrrrr rÚappendr1r8r=r@rBrCrDr+r,rFr;rPrJÚ__name__rrrr Ús>