{
    "mode": "pydoc",
    "parameter": "aifc",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/pydoc/aifc/json",
    "generated": "2026-06-02T13:24:49Z",
    "sections": {
        "NAME": {
            "content": "aifc - Stuff to parse AIFF-C and AIFF files.\n",
            "subsections": []
        },
        "MODULE REFERENCE": {
            "content": "https://docs.python.org/3.10/library/aifc.html\n\nThe following documentation is automatically generated from the Python\nsource files.  It may be incomplete, incorrect or include features that\nare considered implementation detail and may vary between Python\nimplementations.  When in doubt, consult the module reference at the\nlocation listed above.\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Unless explicitly stated otherwise, the description below is true\nboth for AIFF-C files and AIFF files.\n\nAn AIFF-C file has the following structure.\n\n+-----------------+\n| FORM            |\n+-----------------+\n| <size>          |\n+----+------------+\n|    | AIFC       |\n|    +------------+\n|    | <chunks>   |\n|    |    .       |\n|    |    .       |\n|    |    .       |\n+----+------------+\n\nAn AIFF file has the string \"AIFF\" instead of \"AIFC\".\n\nA chunk consists of an identifier (4 bytes) followed by a size (4 bytes,\nbig endian order), followed by the data.  The size field does not include\nthe size of the 8 byte header.\n\nThe following chunk types are recognized.\n\nFVER\n<version number of AIFF-C defining document> (AIFF-C only).\nMARK\n<# of markers> (2 bytes)\nlist of markers:\n<marker ID> (2 bytes, must be > 0)\n<position> (4 bytes)\n<marker name> (\"pstring\")\nCOMM\n<# of channels> (2 bytes)\n<# of sound frames> (4 bytes)\n<size of the samples> (2 bytes)\n<sampling frequency> (10 bytes, IEEE 80-bit extended\nfloating point)\nin AIFF-C files only:\n<compression type> (4 bytes)\n<human-readable version of compression type> (\"pstring\")\nSSND\n<offset> (4 bytes, not used by this program)\n<blocksize> (4 bytes, not used by this program)\n<sound data>\n\nA pstring consists of 1 byte length, a string of characters, and 0 or 1\nbyte pad to make the total length even.\n\nUsage.\n\nReading AIFF files:\nf = aifc.open(file, 'r')\nwhere file is either the name of a file or an open file pointer.\nThe open file pointer must have methods read(), seek(), and close().\nIn some types of audio files, if the setpos() method is not used,\nthe seek() method is not necessary.\n\nThis returns an instance of a class with the following public methods:\ngetnchannels()  -- returns number of audio channels (1 for\nmono, 2 for stereo)\ngetsampwidth()  -- returns sample width in bytes\ngetframerate()  -- returns sampling frequency\ngetnframes()    -- returns number of audio frames\ngetcomptype()   -- returns compression type ('NONE' for AIFF files)\ngetcompname()   -- returns human-readable version of\ncompression type ('not compressed' for AIFF files)\ngetparams() -- returns a namedtuple consisting of all of the\nabove in the above order\ngetmarkers()    -- get the list of marks in the audio file or None\nif there are no marks\ngetmark(id) -- get mark with the specified id (raises an error\nif the mark does not exist)\nreadframes(n)   -- returns at most n frames of audio\nrewind()    -- rewind to the beginning of the audio stream\nsetpos(pos) -- seek to the specified position\ntell()      -- return the current position\nclose()     -- close the instance (make it unusable)\nThe position returned by tell(), the position given to setpos() and\nthe position of marks are all compatible and have nothing to do with\nthe actual position in the file.\nThe close() method is called automatically when the class instance\nis destroyed.\n\nWriting AIFF files:\nf = aifc.open(file, 'w')\nwhere file is either the name of a file or an open file pointer.\nThe open file pointer must have methods write(), tell(), seek(), and",
            "subsections": [
                {
                    "name": "close",
                    "content": "This returns an instance of a class with the following public methods:\naiff()      -- create an AIFF file (AIFF-C default)\naifc()      -- create an AIFF-C file\nsetnchannels(n) -- set the number of channels\nsetsampwidth(n) -- set the sample width\nsetframerate(n) -- set the frame rate\nsetnframes(n)   -- set the number of frames\nsetcomptype(type, name)\n-- set the compression type and the\nhuman-readable compression type\nsetparams(tuple)\n-- set all parameters at once\nsetmark(id, pos, name)\n-- add specified mark to the list of marks\ntell()      -- return current position in output file (useful\nin combination with setmark())\nwriteframesraw(data)\n-- write audio frames without pathing up the\nfile header\nwriteframes(data)\n-- write audio frames and patch up the file header\nclose()     -- patch up the file header and close the\noutput file\nYou should set the parameters before the first writeframesraw or\nwriteframes.  The total number of frames does not need to be set,\nbut when it is set to the correct value, the header does not have to\nbe patched up.\nIt is best to first set all parameters, perhaps possibly the\ncompression type, and then write audio frames using writeframesraw.\nWhen all frames have been written, either call writeframes(b'') or"
                },
                {
                    "name": "close",
                    "content": "Marks can be added anytime.  If there are any marks, you must call"
                },
                {
                    "name": "close",
                    "content": "The close() method is called automatically when the class instance\nis destroyed.\n\nWhen a file is opened with the extension '.aiff', an AIFF file is\nwritten, otherwise an AIFF-C file is written.  This default can be\nchanged by calling aiff() or aifc() before the first writeframes or\nwriteframesraw.\n"
                }
            ]
        },
        "CLASSES": {
            "content": "builtins.Exception(builtins.BaseException)\nError\n",
            "subsections": [
                {
                    "name": "class Error",
                    "content": "|  Method resolution order:\n|      Error\n|      builtins.Exception\n|      builtins.BaseException\n|      builtins.object\n|\n|  Data descriptors defined here:\n|\n|  weakref\n|      list of weak references to the object (if defined)\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.Exception:\n|\n|  init(self, /, *args, kwargs)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Static methods inherited from builtins.Exception:\n|\n|  new(*args, kwargs) from builtins.type\n|      Create and return a new object.  See help(type) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.BaseException:\n|\n|  delattr(self, name, /)\n|      Implement delattr(self, name).\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  reduce(...)\n|      Helper for pickle.\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  setattr(self, name, value, /)\n|      Implement setattr(self, name, value).\n|\n|  setstate(...)\n|\n|  str(self, /)\n|      Return str(self).\n|\n|  withtraceback(...)\n|      Exception.withtraceback(tb) --\n|      set self.traceback to tb and return self.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from builtins.BaseException:\n|\n|  cause\n|      exception cause\n|\n|  context\n|      exception context\n|\n|  dict\n|\n|  suppresscontext\n|\n|  traceback\n|\n|  args\n"
                }
            ]
        },
        "FUNCTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "open",
                    "content": ""
                }
            ]
        },
        "DATA": {
            "content": "all = ['Error', 'open']\n",
            "subsections": []
        },
        "FILE": {
            "content": "/usr/lib/python3.10/aifc.py\n\n",
            "subsections": []
        }
    },
    "summary": "aifc - Stuff to parse AIFF-C and AIFF files.",
    "flags": [],
    "examples": [],
    "see_also": []
}