Back to index

python3.2  3.2.2
Classes | Functions | Variables
aifc Namespace Reference

Classes

class  Error
class  Aifc_read
class  Aifc_write

Functions

def _read_long
def _read_ulong
def _read_short
def _read_string
def _read_float
def _write_short
def _write_long
def _write_string
def _write_float
def getparams
 def getversion(self): return self._version
def getmarkers
def getmark
def setpos
def readframes
def _alaw2lin
def _ulaw2lin
def _adpcm2lin
def _read_comm_chunk
def _readmark
def setparams
 def setversion(self, version): if self._nframeswritten: raise Error, 'cannot change parameters after starting to write' self._version = version
def setmark
def tell
def writeframesraw
def writeframes
def close
def _lin2alaw
def _lin2ulaw
def _lin2adpcm
def _ensure_header_written
def _init_compression
def _write_header
def _write_form_length
def _patchheader
def _writemarkers
def open

Variables

list __all__ = ["Error", "open", "openfp"]
int _AIFC_version = 0xA2805140
float _HUGE_VAL = 1.79769313486231e+308
 openfp = open
list fn = sys.argv[1]
tuple f = open(fn, 'r')
list gn = sys.argv[2]
tuple g = open(gn, 'w')
tuple data = f.readframes(1024)
 _soundpos
 _ssnd_seek_needed
 _adpcmstate
 _nchannels
 _nframes
 _sampwidth
 _framerate
 _framesize
 _comptype
 _compname
 _convert
 _nframeswritten
 _datawritten
 _datalength
 _form_length_pos
 _nframes_pos
 _ssnd_length_pos
 _marklength

Detailed Description

Stuff 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.

Function Documentation

def aifc._adpcm2lin (   self,
  data 
) [private]

Definition at line 412 of file aifc.py.

00412 
00413     def _adpcm2lin(self, data):
00414         import audioop
00415         if not hasattr(self, '_adpcmstate'):
00416             # first time
00417             self._adpcmstate = None
00418         data, self._adpcmstate = audioop.adpcm2lin(data, 2, self._adpcmstate)
00419         return data

def aifc._alaw2lin (   self,
  data 
) [private]

Definition at line 404 of file aifc.py.

00404 
00405     def _alaw2lin(self, data):
00406         import audioop
00407         return audioop.alaw2lin(data, 2)

def aifc._ensure_header_written (   self,
  datasize 
) [private]

Definition at line 717 of file aifc.py.

00717 
00718     def _ensure_header_written(self, datasize):
00719         if not self._nframeswritten:
00720             if self._comptype in (b'ULAW', b'ALAW'):
00721                 if not self._sampwidth:
00722                     self._sampwidth = 2
00723                 if self._sampwidth != 2:
00724                     raise Error('sample width must be 2 when compressing '
00725                                 'with ulaw/ULAW or alaw/ALAW')
00726             if self._comptype == b'G722':
00727                 if not self._sampwidth:
00728                     self._sampwidth = 2
00729                 if self._sampwidth != 2:
00730                     raise Error('sample width must be 2 when compressing '
00731                                 'with G7.22 (ADPCM)')
00732             if not self._nchannels:
00733                 raise Error('# channels not specified')
00734             if not self._sampwidth:
00735                 raise Error('sample width not specified')
00736             if not self._framerate:
00737                 raise Error('sampling rate not specified')
00738             self._write_header(datasize)

def aifc._init_compression (   self) [private]

Definition at line 739 of file aifc.py.

00739 
00740     def _init_compression(self):
00741         if self._comptype == b'G722':
00742             self._convert = self._lin2adpcm
00743         elif self._comptype in (b'ulaw', b'ULAW'):
00744             self._convert = self._lin2ulaw
00745         elif self._comptype in (b'alaw', b'ALAW'):
00746             self._convert = self._lin2alaw
00747         else:
00748             raise Error('unsupported compression type')

def aifc._lin2adpcm (   self,
  data 
) [private]

Definition at line 710 of file aifc.py.

00710 
00711     def _lin2adpcm(self, data):
00712         import audioop
00713         if not hasattr(self, '_adpcmstate'):
00714             self._adpcmstate = None
00715         data, self._adpcmstate = audioop.lin2adpcm(data, 2, self._adpcmstate)
00716         return data

def aifc._lin2alaw (   self,
  data 
) [private]

Definition at line 702 of file aifc.py.

00702 
00703     def _lin2alaw(self, data):
00704         import audioop
00705         return audioop.lin2alaw(data, 2)

def aifc._lin2ulaw (   self,
  data 
) [private]

Definition at line 706 of file aifc.py.

00706 
00707     def _lin2ulaw(self, data):
00708         import audioop
00709         return audioop.lin2ulaw(data, 2)

def aifc._patchheader (   self) [private]

Definition at line 805 of file aifc.py.

00805 
00806     def _patchheader(self):
00807         curpos = self._file.tell()
00808         if self._datawritten & 1:
00809             datalength = self._datawritten + 1
00810             self._file.write(b'\x00')
00811         else:
00812             datalength = self._datawritten
00813         if datalength == self._datalength and \
00814               self._nframes == self._nframeswritten and \
00815               self._marklength == 0:
00816             self._file.seek(curpos, 0)
00817             return
00818         self._file.seek(self._form_length_pos, 0)
00819         dummy = self._write_form_length(datalength)
00820         self._file.seek(self._nframes_pos, 0)
00821         _write_long(self._file, self._nframeswritten)
00822         self._file.seek(self._ssnd_length_pos, 0)
00823         _write_long(self._file, datalength + 8)
00824         self._file.seek(curpos, 0)
00825         self._nframes = self._nframeswritten
00826         self._datalength = datalength

def aifc._read_comm_chunk (   self,
  chunk 
) [private]

Definition at line 420 of file aifc.py.

00420 
00421     def _read_comm_chunk(self, chunk):
00422         self._nchannels = _read_short(chunk)
00423         self._nframes = _read_long(chunk)
00424         self._sampwidth = (_read_short(chunk) + 7) // 8
00425         self._framerate = int(_read_float(chunk))
00426         self._framesize = self._nchannels * self._sampwidth
00427         if self._aifc:
00428             #DEBUG: SGI's soundeditor produces a bad size :-(
00429             kludge = 0
00430             if chunk.chunksize == 18:
00431                 kludge = 1
00432                 print('Warning: bad COMM chunk size')
00433                 chunk.chunksize = 23
00434             #DEBUG end
00435             self._comptype = chunk.read(4)
00436             #DEBUG start
00437             if kludge:
00438                 length = ord(chunk.file.read(1))
00439                 if length & 1 == 0:
00440                     length = length + 1
00441                 chunk.chunksize = chunk.chunksize + length
00442                 chunk.file.seek(-1, 1)
00443             #DEBUG end
00444             self._compname = _read_string(chunk)
00445             if self._comptype != b'NONE':
00446                 if self._comptype == b'G722':
00447                     self._convert = self._adpcm2lin
00448                     self._framesize = self._framesize // 4
00449                 elif self._comptype in (b'ulaw', b'ULAW'):
00450                     self._convert = self._ulaw2lin
00451                     self._framesize = self._framesize // 2
00452                 elif self._comptype in (b'alaw', b'ALAW'):
00453                     self._convert = self._alaw2lin
00454                     self._framesize = self._framesize // 2
00455                 else:
00456                     raise Error('unsupported compression type')
00457         else:
00458             self._comptype = b'NONE'
00459             self._compname = b'not compressed'

def aifc._read_float (   f) [private]

Definition at line 177 of file aifc.py.

00177 
00178 def _read_float(f): # 10 bytes
00179     expon = _read_short(f) # 2 bytes
00180     sign = 1
00181     if expon < 0:
00182         sign = -1
00183         expon = expon + 0x8000
00184     himant = _read_ulong(f) # 4 bytes
00185     lomant = _read_ulong(f) # 4 bytes
00186     if expon == himant == lomant == 0:
00187         f = 0.0
00188     elif expon == 0x7FFF:
00189         f = _HUGE_VAL
00190     else:
00191         expon = expon - 16383
00192         f = (himant * 0x100000000 + lomant) * pow(2.0, expon - 63)
00193     return sign * f

Here is the call graph for this function:

def aifc._read_long (   file) [private]

Definition at line 147 of file aifc.py.

00147 
00148 def _read_long(file):
00149     try:
00150         return struct.unpack('>l', file.read(4))[0]
00151     except struct.error:
00152         raise EOFError

def aifc._read_short (   file) [private]

Definition at line 159 of file aifc.py.

00159 
00160 def _read_short(file):
00161     try:
00162         return struct.unpack('>h', file.read(2))[0]
00163     except struct.error:
00164         raise EOFError

Here is the caller graph for this function:

def aifc._read_string (   file) [private]

Definition at line 165 of file aifc.py.

00165 
00166 def _read_string(file):
00167     length = ord(file.read(1))
00168     if length == 0:
00169         data = b''
00170     else:
00171         data = file.read(length)
00172     if length & 1 == 0:
00173         dummy = file.read(1)
00174     return data

Here is the call graph for this function:

def aifc._read_ulong (   file) [private]

Definition at line 153 of file aifc.py.

00153 
00154 def _read_ulong(file):
00155     try:
00156         return struct.unpack('>L', file.read(4))[0]
00157     except struct.error:
00158         raise EOFError

Here is the caller graph for this function:

def aifc._readmark (   self,
  chunk 
) [private]

Definition at line 460 of file aifc.py.

00460 
00461     def _readmark(self, chunk):
00462         nmarkers = _read_short(chunk)
00463         # Some files appear to contain invalid counts.
00464         # Cope with this by testing for EOF.
00465         try:
00466             for i in range(nmarkers):
00467                 id = _read_short(chunk)
00468                 pos = _read_long(chunk)
00469                 name = _read_string(chunk)
00470                 if pos or name:
00471                     # some files appear to have
00472                     # dummy markers consisting of
00473                     # a position 0 and name ''
00474                     self._markers.append((id, pos, name))
00475         except EOFError:
00476             print('Warning: MARK chunk contains only', end=' ')
00477             print(len(self._markers), end=' ')
00478             if len(self._markers) == 1: print('marker', end=' ')
00479             else: print('markers', end=' ')
00480             print('instead of', nmarkers)

Here is the call graph for this function:

def aifc._ulaw2lin (   self,
  data 
) [private]

Definition at line 408 of file aifc.py.

00408 
00409     def _ulaw2lin(self, data):
00410         import audioop
00411         return audioop.ulaw2lin(data, 2)

def aifc._write_float (   f,
  x 
) [private]

Definition at line 208 of file aifc.py.

00208 
00209 def _write_float(f, x):
00210     import math
00211     if x < 0:
00212         sign = 0x8000
00213         x = x * -1
00214     else:
00215         sign = 0
00216     if x == 0:
00217         expon = 0
00218         himant = 0
00219         lomant = 0
00220     else:
00221         fmant, expon = math.frexp(x)
00222         if expon > 16384 or fmant >= 1:     # Infinity or NaN
00223             expon = sign|0x7FFF
00224             himant = 0
00225             lomant = 0
00226         else:                   # Finite
00227             expon = expon + 16382
00228             if expon < 0:           # denormalized
00229                 fmant = math.ldexp(fmant, expon)
00230                 expon = 0
00231             expon = expon | sign
00232             fmant = math.ldexp(fmant, 32)
00233             fsmant = math.floor(fmant)
00234             himant = int(fsmant)
00235             fmant = math.ldexp(fmant - fsmant, 32)
00236             fsmant = math.floor(fmant)
00237             lomant = int(fsmant)
00238     _write_short(f, expon)
00239     _write_long(f, himant)
00240     _write_long(f, lomant)

Here is the call graph for this function:

def aifc._write_form_length (   self,
  datalength 
) [private]

Definition at line 792 of file aifc.py.

00792 
00793     def _write_form_length(self, datalength):
00794         if self._aifc:
00795             commlength = 18 + 5 + len(self._compname)
00796             if commlength & 1:
00797                 commlength = commlength + 1
00798             verslength = 12
00799         else:
00800             commlength = 18
00801             verslength = 0
00802         _write_long(self._file, 4 + verslength + self._marklength + \
00803                     8 + commlength + 16 + datalength)
00804         return commlength

Here is the call graph for this function:

def aifc._write_header (   self,
  initlength 
) [private]

Definition at line 749 of file aifc.py.

00749 
00750     def _write_header(self, initlength):
00751         if self._aifc and self._comptype != b'NONE':
00752             self._init_compression()
00753         self._file.write(b'FORM')
00754         if not self._nframes:
00755             self._nframes = initlength // (self._nchannels * self._sampwidth)
00756         self._datalength = self._nframes * self._nchannels * self._sampwidth
00757         if self._datalength & 1:
00758             self._datalength = self._datalength + 1
00759         if self._aifc:
00760             if self._comptype in (b'ulaw', b'ULAW', b'alaw', b'ALAW'):
00761                 self._datalength = self._datalength // 2
00762                 if self._datalength & 1:
00763                     self._datalength = self._datalength + 1
00764             elif self._comptype == b'G722':
00765                 self._datalength = (self._datalength + 3) // 4
00766                 if self._datalength & 1:
00767                     self._datalength = self._datalength + 1
00768         self._form_length_pos = self._file.tell()
00769         commlength = self._write_form_length(self._datalength)
00770         if self._aifc:
00771             self._file.write(b'AIFC')
00772             self._file.write(b'FVER')
00773             _write_long(self._file, 4)
00774             _write_long(self._file, self._version)
00775         else:
00776             self._file.write(b'AIFF')
00777         self._file.write(b'COMM')
00778         _write_long(self._file, commlength)
00779         _write_short(self._file, self._nchannels)
00780         self._nframes_pos = self._file.tell()
00781         _write_long(self._file, self._nframes)
00782         _write_short(self._file, self._sampwidth * 8)
00783         _write_float(self._file, self._framerate)
00784         if self._aifc:
00785             self._file.write(self._comptype)
00786             _write_string(self._file, self._compname)
00787         self._file.write(b'SSND')
00788         self._ssnd_length_pos = self._file.tell()
00789         _write_long(self._file, self._datalength + 8)
00790         _write_long(self._file, 0)
00791         _write_long(self._file, 0)

def aifc._write_long (   f,
  x 
) [private]

Definition at line 197 of file aifc.py.

00197 
00198 def _write_long(f, x):
00199     f.write(struct.pack('>L', x))

Here is the caller graph for this function:

def aifc._write_short (   f,
  x 
) [private]

Definition at line 194 of file aifc.py.

00194 
00195 def _write_short(f, x):
00196     f.write(struct.pack('>h', x))

Here is the caller graph for this function:

def aifc._write_string (   f,
  s 
) [private]

Definition at line 200 of file aifc.py.

00200 
00201 def _write_string(f, s):
00202     if len(s) > 255:
00203         raise ValueError("string exceeds maximum pstring length")
00204     f.write(struct.pack('b', len(s)))
00205     f.write(s)
00206     if len(s) & 1 == 0:
00207         f.write(b'\x00')

def aifc._writemarkers (   self) [private]

Definition at line 827 of file aifc.py.

00827 
00828     def _writemarkers(self):
00829         if len(self._markers) == 0:
00830             return
00831         self._file.write(b'MARK')
00832         length = 2
00833         for marker in self._markers:
00834             id, pos, name = marker
00835             length = length + len(name) + 1 + 6
00836             if len(name) & 1 == 0:
00837                 length = length + 1
00838         _write_long(self._file, length)
00839         self._marklength = length + 8
00840         _write_short(self._file, len(self._markers))
00841         for marker in self._markers:
00842             id, pos, name = marker
00843             _write_short(self._file, id)
00844             _write_long(self._file, pos)
00845             _write_string(self._file, name)

Here is the call graph for this function:

def aifc.close (   self)

Definition at line 683 of file aifc.py.

00683 
00684     def close(self):
00685         self._ensure_header_written(0)
00686         if self._datawritten & 1:
00687             # quick pad to even size
00688             self._file.write(b'\x00')
00689             self._datawritten = self._datawritten + 1
00690         self._writemarkers()
00691         if self._nframeswritten != self._nframes or \
00692               self._datalength != self._datawritten or \
00693               self._marklength:
00694             self._patchheader()
00695         # Prevent ref cycles
00696         self._convert = None
00697         self._file.close()

def aifc.getmark (   self,
  id 
)

Definition at line 371 of file aifc.py.

00371 
00372     def getmark(self, id):
00373         for marker in self._markers:
00374             if id == marker[0]:
00375                 return marker
00376         raise Error('marker {0!r} does not exist'.format(id))

def aifc.getmarkers (   self)

Definition at line 366 of file aifc.py.

00366 
00367     def getmarkers(self):
00368         if len(self._markers) == 0:
00369             return None
00370         return self._markers

def aifc.getparams (   self)

def getversion(self): return self._version

Definition at line 361 of file aifc.py.

00361 
00362     def getparams(self):
00363         return self.getnchannels(), self.getsampwidth(), \
00364               self.getframerate(), self.getnframes(), \
00365               self.getcomptype(), self.getcompname()

def aifc.open (   f,
  mode = None 
)

Definition at line 846 of file aifc.py.

00846 
00847 def open(f, mode=None):
00848     if mode is None:
00849         if hasattr(f, 'mode'):
00850             mode = f.mode
00851         else:
00852             mode = 'rb'
00853     if mode in ('r', 'rb'):
00854         return Aifc_read(f)
00855     elif mode in ('w', 'wb'):
00856         return Aifc_write(f)
00857     else:
00858         raise Error("mode must be 'r', 'rb', 'w', or 'wb'")

Here is the caller graph for this function:

def aifc.readframes (   self,
  nframes 
)

Definition at line 383 of file aifc.py.

00383 
00384     def readframes(self, nframes):
00385         if self._ssnd_seek_needed:
00386             self._ssnd_chunk.seek(0)
00387             dummy = self._ssnd_chunk.read(8)
00388             pos = self._soundpos * self._framesize
00389             if pos:
00390                 self._ssnd_chunk.seek(pos + 8)
00391             self._ssnd_seek_needed = 0
00392         if nframes == 0:
00393             return b''
00394         data = self._ssnd_chunk.read(nframes * self._framesize)
00395         if self._convert and data:
00396             data = self._convert(data)
00397         self._soundpos = self._soundpos + len(data) // (self._nchannels
00398                                                         * self._sampwidth)
00399         return data

def aifc.setmark (   self,
  id,
  pos,
  name 
)

Definition at line 641 of file aifc.py.

00641 
00642     def setmark(self, id, pos, name):
00643         if id <= 0:
00644             raise Error('marker ID must be > 0')
00645         if pos < 0:
00646             raise Error('marker position must be >= 0')
00647         if not isinstance(name, str):
00648             raise Error('marker name must be a string')
00649         for i in range(len(self._markers)):
00650             if id == self._markers[i][0]:
00651                 self._markers[i] = id, pos, name
00652                 return
00653         self._markers.append((id, pos, name))

def aifc.setparams (   self,
  params 
)

def setversion(self, version): if self._nframeswritten: raise Error, 'cannot change parameters after starting to write' self._version = version

Definition at line 622 of file aifc.py.

00622 
00623     def setparams(self, params):
00624         nchannels, sampwidth, framerate, nframes, comptype, compname = params
00625         if self._nframeswritten:
00626             raise Error('cannot change parameters after starting to write')
00627         if comptype not in (b'NONE', b'ulaw', b'ULAW',
00628                             b'alaw', b'ALAW', b'G722'):
00629             raise Error('unsupported compression type')
00630         self.setnchannels(nchannels)
00631         self.setsampwidth(sampwidth)
00632         self.setframerate(framerate)
00633         self.setnframes(nframes)
00634         self.setcomptype(comptype, compname)

def aifc.setpos (   self,
  pos 
)

Definition at line 377 of file aifc.py.

00377 
00378     def setpos(self, pos):
00379         if pos < 0 or pos > self._nframes:
00380             raise Error('position not in range')
00381         self._soundpos = pos
00382         self._ssnd_seek_needed = 1

def aifc.tell (   self)

Definition at line 665 of file aifc.py.

00665 
00666     def tell(self):
00667         return self._nframeswritten

def aifc.writeframes (   self,
  data 
)

Definition at line 677 of file aifc.py.

00677 
00678     def writeframes(self, data):
00679         self.writeframesraw(data)
00680         if self._nframeswritten != self._nframes or \
00681               self._datalength != self._datawritten:
00682             self._patchheader()

def aifc.writeframesraw (   self,
  data 
)

Definition at line 668 of file aifc.py.

00668 
00669     def writeframesraw(self, data):
00670         self._ensure_header_written(len(data))
00671         nframes = len(data) // (self._sampwidth * self._nchannels)
00672         if self._convert:
00673             data = self._convert(data)
00674         self._file.write(data)
00675         self._nframeswritten = self._nframeswritten + nframes
00676         self._datawritten = self._datawritten + len(data)


Variable Documentation

list aifc.__all__ = ["Error", "open", "openfp"]

Definition at line 140 of file aifc.py.

Definition at line 416 of file aifc.py.

int aifc._AIFC_version = 0xA2805140

Definition at line 145 of file aifc.py.

Definition at line 443 of file aifc.py.

Definition at line 434 of file aifc.py.

Definition at line 446 of file aifc.py.

Definition at line 755 of file aifc.py.

Definition at line 675 of file aifc.py.

Definition at line 767 of file aifc.py.

Definition at line 424 of file aifc.py.

Definition at line 425 of file aifc.py.

float aifc._HUGE_VAL = 1.79769313486231e+308

Definition at line 175 of file aifc.py.

Definition at line 814 of file aifc.py.

Definition at line 421 of file aifc.py.

Definition at line 422 of file aifc.py.

Definition at line 779 of file aifc.py.

Definition at line 674 of file aifc.py.

Definition at line 423 of file aifc.py.

Definition at line 380 of file aifc.py.

Definition at line 787 of file aifc.py.

Definition at line 381 of file aifc.py.

tuple aifc.data = f.readframes(1024)

Definition at line 880 of file aifc.py.

tuple aifc.f = open(fn, 'r')

Definition at line 866 of file aifc.py.

list aifc.fn = sys.argv[1]

Definition at line 865 of file aifc.py.

tuple aifc.g = open(gn, 'w')

Definition at line 877 of file aifc.py.

list aifc.gn = sys.argv[2]

Definition at line 875 of file aifc.py.

Definition at line 859 of file aifc.py.