config root man

Current Path : /usr/local/lib/python2.5/

FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64
Upload File :
Current File : //usr/local/lib/python2.5/aifc.pyc

hRc@s^dZddkZddkZdddgZdefdYZdZdd	d
ddd
dddf	ZdZdZ	dZ
dZdZdZ
dZdZdZdZddklZdfdYZdfdYZed ZeZed!joDddkZeid"oeiid#neid"Zeed$Zd%GeGHd&GeiGHd'Gei GHd(Gei!GHd)Gei"GHd*Gei#GHd+Gei$GHeid,oeid,Z%d-Ge%GHee%d.Z&e&i'ei(x,ei)d/Z*e*oPne&i+e*q
e&i,ei,d0GHnndS(1sDStuff 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.
iNtErrortopentopenfpcBseZRS((t__name__t
__module__(((s /usr/local/lib/python2.5/aifc.pyRsl@QEtCOMTtINSTtMIDItAESDtAPPLtNAMEtAUTHs(c) tANNOcCsDy!tid|iddSWntij
o
tnXdS(Ns>lii(tstructtunpacktreadterrortEOFError(tfile((s /usr/local/lib/python2.5/aifc.pyt
_read_longs!cCsDy!tid|iddSWntij
o
tnXdS(Ns>Lii(R
RRRR(R((s /usr/local/lib/python2.5/aifc.pyt_read_ulongs!cCsDy!tid|iddSWntij
o
tnXdS(Ns>hii(R
RRRR(R((s /usr/local/lib/python2.5/aifc.pyt_read_shorts!cCsct|id}|djo
d}n|i|}|d@djo|id}n|S(Niit(tordR(Rtlengthtdatatdummy((s /usr/local/lib/python2.5/aifc.pyt_read_strings

gcCst|}d}|djod}|d}nt|}t|}||jo|jo
djno
d}nA|djo
t}n*|d}|d|td	|d
}||S(Niiiigii?lg@i?(RRt	_HUGE_VALtpow(tftexpontsignthimanttlomant((s /usr/local/lib/python2.5/aifc.pyt_read_floats
*



cCs|itid|dS(Ns>h(twriteR
tpack(Rtx((s /usr/local/lib/python2.5/aifc.pyt_write_shortscCs|itid|dS(Ns>L(R$R
R%(RR&((s /usr/local/lib/python2.5/aifc.pyt_write_longscCs{t|djotdn|itt||i|t|d@djo|itdndS(Nis%string exceeds maximum pstring lengthii(tlent
ValueErrorR$tchr(Rts((s /usr/local/lib/python2.5/aifc.pyt
_write_strings
c	Cseddk}|djod}|d}nd}|djod}d}d}n|i|\}}|djp
|djo|dB}d}d}n|d}|djo|i||}d}n||B}|i|d}|i|}t|}|i||d}|i|}t|}t||t||t||dS(	Niiii@iii?i (tmathtfrexptldexptfloortlongR'R((	RR&R.R RR!R"tfmanttfsmant((s /usr/local/lib/python2.5/aifc.pyt_write_floats8










(tChunkt	Aifc_readcBseZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZdZdZdZdZdZdZdZRS(cCsd|_d|_d|_g|_d|_t||_|iidjo
t	dn|ii
d}|djo
d|_n$|djo
d|_n
t	dd|_xd|_
yt|i}Wntj
oPnX|i}|d	jo|i|d|_n|d
jo%||_|i
d}d|_
n`|djot||_n@|d
jo|i|n"|tjont	d|i|iq|ip|io
t	dn|io|ioddk}|id|i|id|i|ig}|idjo|i|d<n+|idjo|i|d<n
t	d|ii|ndS(NitFORMs file does not start with FORM iditAIFFtAIFCisnot an AIFF or AIFF-C filetCOMMtSSNDitFVERtMARKsunrecognized chunk type s$COMM chunk and/or SSND chunk missingiis$cannot compress more than 2 channels( t_versiontNonet_decompt_convertt_markerst	_soundposR6t_filetgetnameRRt_aifct_comm_chunk_readt_ssnd_seek_neededRt_read_comm_chunkt_ssnd_chunkRt	_readmarkt	_skiplistt	chunknametskiptcltORIGINAL_FORMATtBITS_PER_COMPONENTt
_sampwidtht
FRAME_RATEt
_frameratet
_nchannelstMONOtSTEREO_INTERLEAVEDt	SetParams(tselfRtformdatatchunkRNRRPtparams((s /usr/local/lib/python2.5/aifc.pytinitfpsd					




			



	





		cCs@t|tdjoti|d}n|i|dS(NRtrb(ttypet__builtin__RR^(RZR((s /usr/local/lib/python2.5/aifc.pyt__init__QscCs|iS(N(RE(RZ((s /usr/local/lib/python2.5/aifc.pytgetfpZscCsd|_d|_dS(Nii(RIRD(RZ((s /usr/local/lib/python2.5/aifc.pytrewind]s	cCs1|io|iid|_nd|_dS(N(RAtCloseDecompressorR@RE(RZ((s /usr/local/lib/python2.5/aifc.pytcloseas


cCs|iS(N(RD(RZ((s /usr/local/lib/python2.5/aifc.pyttellgscCs|iS(N(RV(RZ((s /usr/local/lib/python2.5/aifc.pytgetnchannelsjscCs|iS(N(t_nframes(RZ((s /usr/local/lib/python2.5/aifc.pyt
getnframesmscCs|iS(N(RS(RZ((s /usr/local/lib/python2.5/aifc.pytgetsampwidthpscCs|iS(N(RU(RZ((s /usr/local/lib/python2.5/aifc.pytgetframeratesscCs|iS(N(t	_comptype(RZ((s /usr/local/lib/python2.5/aifc.pytgetcomptypevscCs|iS(N(t	_compname(RZ((s /usr/local/lib/python2.5/aifc.pytgetcompnameyscCs:|i|i|i|i|i|ifS(N(RhRkRlRjRnRp(RZ((s /usr/local/lib/python2.5/aifc.pyt	getparamsscCs%t|idjodSn|iS(Ni(R)RCR@(RZ((s /usr/local/lib/python2.5/aifc.pyt
getmarkersscCsAx*|iD]}||djo|Sq
q
Wtd|fdS(Nismarker %r does not exist(RCR(RZtidtmarker((s /usr/local/lib/python2.5/aifc.pytgetmarks

cCs@|djp||ijo
tdn||_d|_dS(Nisposition not in rangei(RiRRDRI(RZtpos((s /usr/local/lib/python2.5/aifc.pytsetposs
	cCs|io^|iid|iid}|i|i}|o|ii|dnd|_n|djodSn|ii||i}|io|o|i|}n|it||i|i	|_|S(NiiR(
RIRKtseekRRDt
_framesizeRBR)RVRS(RZtnframesRRvR((s /usr/local/lib/python2.5/aifc.pyt
readframess


$cCsNddk}|ii|it|d}|iit||i|S(Nii(RPRAtSetParamtFRAME_BUFFER_SIZER)t
DecompressRV(RZRRPR((s /usr/local/lib/python2.5/aifc.pyt_decomp_datas
cCsddk}|i|dS(Nii(taudiooptulaw2lin(RZRR((s /usr/local/lib/python2.5/aifc.pyt	_ulaw2linscCsNddk}t|dp
d|_n|i|d|i\}|_|S(Nit_adpcmstatei(RthasattrR@Rt	adpcm2lin(RZRR((s /usr/local/lib/python2.5/aifc.pyt
_adpcm2lins
c
Cst||_t||_t|dd|_tt||_|i|i|_|i	o0d}|i
djod}dGHd|_
n|id|_|o^t
|iid}|d@djo|d}n|i
||_
|iid	dnt||_|id
joh|idjoJyd	dk}Wntj
oqX|i|_|id|_dSnyd	dk}Wnvtj
oj|idjoJy0d	dk}|i|_|id
|_dSWqtj
oqXntdnX|idjo|i}|id
|_n7|idjo|i}|id
|_n
td|i||_|i|_qnd
|_d|_dS(NiiiiisWarning: bad COMM chunk sizeiiitNONEtG722tULAWis#cannot read compressed AIFF-C filestALAWsunsupported compression typesnot compressed(RRVRRiRStintR#RURyRGt	chunksizeRRmRRRxRRoRtImportErrorRRBRPRRt	G711_ULAWt	G711_ALAWtOpenDecompressorRAR(RZR\tkludgeRRRPtscheme((s /usr/local/lib/python2.5/aifc.pyRJsf

					cCst|}yjxct|D]U}t|}t|}t|}|p|o|ii|||fqqWWnOtj
oCdGt|iGt|idjodGndGdG|GHnXdS(Ns!Warning: MARK chunk contains onlyiRttmarkerss
instead of(RtrangeRRRCtappendRR)(RZR\tnmarkerstiRsRvtname((s /usr/local/lib/python2.5/aifc.pyRLs 
%
(RRR^RbRcRdRfRgRhRjRkRlRnRpRqRrRuRwR{RRRRJRL(((s /usr/local/lib/python2.5/aifc.pyR7s,$	7																						=t
Aifc_writecBs:eZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!d Z"d!Z#RS("cCsst|tdjo|}ti|d}nd}|i||ddjo
d|_n
d|_dS(NRtwbs???is.aiffii(R`RaRR^RG(RZRtfilename((s /usr/local/lib/python2.5/aifc.pyRb-s

cCs||_t|_d|_d|_d|_d|_d|_d|_	d|_
d|_d|_d|_
d|_g|_d|_d|_dS(NRsnot compressedii(REt
_AIFC_versionR?RmRoR@t_compRBRVRSRURit_nframeswrittent_datawrittent_datalengthRCt_marklengthRG(RZR((s /usr/local/lib/python2.5/aifc.pyR^:s 															cCs|io|indS(N(RERf(RZ((s /usr/local/lib/python2.5/aifc.pyt__del__Ls
cCs$|io
tdnd|_dS(Ns0cannot change parameters after starting to writei(RRRG(RZ((s /usr/local/lib/python2.5/aifc.pytaiffSs

cCs$|io
tdnd|_dS(Ns0cannot change parameters after starting to writei(RRRG(RZ((s /usr/local/lib/python2.5/aifc.pytaifcXs

cCs>|io
tdn|djo
tdn||_dS(Ns0cannot change parameters after starting to writeisbad # of channels(RRRV(RZt	nchannels((s /usr/local/lib/python2.5/aifc.pytsetnchannels]s




cCs|ip
tdn|iS(Nsnumber of channels not set(RVR(RZ((s /usr/local/lib/python2.5/aifc.pyRhds

cCsK|io
tdn|djp
|djo
tdn||_dS(Ns0cannot change parameters after starting to writeiisbad sample width(RRRS(RZt	sampwidth((s /usr/local/lib/python2.5/aifc.pytsetsampwidthis



cCs|ip
tdn|iS(Nssample width not set(RSR(RZ((s /usr/local/lib/python2.5/aifc.pyRkps

cCs>|io
tdn|djo
tdn||_dS(Ns0cannot change parameters after starting to writeisbad frame rate(RRRU(RZt	framerate((s /usr/local/lib/python2.5/aifc.pytsetframerateus




cCs|ip
tdn|iS(Nsframe rate not set(RUR(RZ((s /usr/local/lib/python2.5/aifc.pyRl|s

cCs$|io
tdn||_dS(Ns0cannot change parameters after starting to write(RRRi(RZRz((s /usr/local/lib/python2.5/aifc.pyt
setnframess

cCs|iS(N(R(RZ((s /usr/local/lib/python2.5/aifc.pyRjscCsG|io
tdn|djo
tdn||_||_dS(Ns0cannot change parameters after starting to writeRRRRsunsupported compression type(sNONEsULAWsALAWsG722(RRRmRo(RZtcomptypetcompname((s /usr/local/lib/python2.5/aifc.pytsetcomptypes



	cCs|iS(N(Rm(RZ((s /usr/local/lib/python2.5/aifc.pyRnscCs|iS(N(Ro(RZ((s /usr/local/lib/python2.5/aifc.pyRpscCs|\}}}}}}|io
tdn|djo
tdn|i||i||i||i||i||dS(Ns0cannot change parameters after starting to writeRRRRsunsupported compression type(sNONEsULAWsALAWsG722(RRRRRRR(RZt.1RRRRzRR((s /usr/local/lib/python2.5/aifc.pyt	setparamss







cCsV|ip|ip|io
tdn|i|i|i|i|i|ifS(Nsnot all parameters set(RVRSRURRiRmRo(RZ((s /usr/local/lib/python2.5/aifc.pyRqs!
cCs|djo
tdn|djo
tdnt|tdjo
tdnxStt|iD]<}||i|djo|||f|i|<dSqpqpW|ii|||fdS(Nismarker ID must be > 0smarker position must be >= 0Rsmarker name must be a string(RR`RR)RCR(RZRsRvRR((s /usr/local/lib/python2.5/aifc.pytsetmarks




cCsAx*|iD]}||djo|Sq
q
Wtd|fdS(Nismarker %r does not exist(RCR(RZRsRt((s /usr/local/lib/python2.5/aifc.pyRus

cCs%t|idjodSn|iS(Ni(R)RCR@(RZ((s /usr/local/lib/python2.5/aifc.pyRrscCs|iS(N(R(RZ((s /usr/local/lib/python2.5/aifc.pyRgscCs|it|t||i|i}|io|i|}n|ii||i||_|it||_dS(N(	t_ensure_header_writtenR)RSRVRBRER$RR(RZRRz((s /usr/local/lib/python2.5/aifc.pytwriteframesraws
cCsE|i||i|ijp|i|ijo|indS(N(RRRiRRt_patchheader(RZR((s /usr/local/lib/python2.5/aifc.pytwriteframess
cCs|id|id@o*|iitd|id|_n|i|i|ijp|i|ijp
|i	o|i
n|io|iid|_n|iid|_dS(Nii(RRRER$R+t
_writemarkersRRiRRRRtCloseCompressorR@tflush(RZ((s /usr/local/lib/python2.5/aifc.pyRfs






cCs^ddk}|ii|it|}|ii|it|}|ii|i|S(Ni(RPRR|R}R)tCOMPRESSED_BUFFER_SIZEtCompressRi(RZRRPR((s /usr/local/lib/python2.5/aifc.pyt
_comp_datascCsddk}|i|dS(Nii(Rtlin2ulaw(RZRR((s /usr/local/lib/python2.5/aifc.pyt	_lin2ulawscCsNddk}t|dp
d|_n|i|d|i\}|_|S(NiRi(RRR@Rt	lin2adpcm(RZRR((s /usr/local/lib/python2.5/aifc.pyt
_lin2adpcms
cCs|ip|id
jo8|ip
d|_n|idjo
tdqRn|idjo8|ip
d|_n|idjo
tdqn|ip
tdn|ip
tdn|ip
td	n|i|ndS(NRRis9sample width must be 2 when compressing with ULAW or ALAWRs:sample width must be 2 when compressing with G7.22 (ADPCM)s# channels not specifiedssample width not specifiedssampling rate not specified(sULAWsALAW(RRmRSRRVRUt
_write_header(RZtdatasize((s /usr/local/lib/python2.5/aifc.pyRs$










cCs|idjo|i|_dSnyddk}Wnftj
oZ|idjo:y ddk}|i|_dSWqtj
oqXntdnX|idjo
|i}n'|idjo
|i	}n
td|i
||_|id|i
|id|i|i|id	|id	g
}|id
jo|i|d
<n+|idjo|i|d
<n
td|ii||iidd
}|i|_dS(NRiRs$cannot write compressed AIFF-C filesRsunsupported compression typeiiidiis$cannot compress more than 2 channelsR(RmRRBRPRRRRRRtOpenCompressorRRQRRRSRTRUR}RRVRWRXRYRR(RZRPRRR]R((s /usr/local/lib/python2.5/aifc.pyt_init_compressionsB	

				cCs|io|idjo|in|iid|ip||i|i|_n|i|i|i|_|id@o|id|_n|io|idjo6|id|_|id@o|id|_q3q7|idjo:|idd	|_|id@o|id|_q3q7n|ii	|_
|i|i}|ioG|iid
|iidt|id	t|i|i
n|iid|iid
t|i|t|i|i|ii	|_t|i|it|i|idt|i|i|io*|ii|it|i|in|iid|ii	|_t|i|idt|idt|iddS(NRR8iRRiRiiR:R=R9R;iR<i(sULAWsALAW(RGRmRRER$RiRVRSRRgt_form_length_post_write_form_lengthR(R?R't_nframes_posR5RUR-Rot_ssnd_length_pos(RZt
initlengtht
commlength((s /usr/local/lib/python2.5/aifc.pyR8sP



cCs{|io6d	t|i}|d@o|d}nd}n
d}d}t|id||id|d||S(
Niiiiiiiii(RGR)RoR(RER(RZt
datalengthRt
verslength((s /usr/local/lib/python2.5/aifc.pyRcs

	"cCs?|ii}|id@o'|id}|iitdn
|i}||ijo>|i|ijo+|idjo|ii	|ddSn|ii	|i
d|i|}|ii	|idt
|i|i|ii	|idt
|i|d|ii	|d|i|_||_dS(Niii(RERgRR$R+RRiRRRxRRRR(R(RZtcurposRR((s /usr/local/lib/python2.5/aifc.pyRps&
	cCs!t|idjodSn|iidd}x]|iD]R}|\}}}|t|dd}t|d@djo|d}q>q>Wt|i||d|_t|it|ixP|iD]E}|\}}}t|i|t|i|t|i|qWdS(NiR>iiii(R)RCRER$R(RR'R-(RZRRtRsRvR((s /usr/local/lib/python2.5/aifc.pyRs&


($RRRbR^RRRRRhRRkRRlRRjRRnRpRRqRRuRrRgRRRfRRRRRRRRR(((s /usr/local/lib/python2.5/aifc.pyRsD	
																		
												&	+	
	cCsw|djo't|do
|i}q4d}n|djot|Sn%|djot|Sn
tddS(	NtmodeR_trtwRs$mode must be 'r', 'rb', 'w', or 'wb'(Rsrb(Rswb(R@RRR7RR(RR((s /usr/local/lib/python2.5/aifc.pyRs




t__main__is/usr/demos/data/audio/bach.aiffRtReadingsnchannels =snframes   =ssampwidth =sframerate =scomptype  =scompname  =itWritingRisDone.(-t__doc__R
Rat__all__t	ExceptionRRRMRRRRRR#R'R(R-R5R\R6R7RR@RRRtsystargvRtfnRRhRjRkRlRnRptgntgRRqR{RRRf(((s /usr/local/lib/python2.5/aifc.pys<module>sd				
					!


	
	



Man Man