{
    "mode": "pydoc",
    "parameter": "wave",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/pydoc/wave/json",
    "generated": "2026-06-02T15:02:16Z",
    "sections": {
        "NAME": {
            "content": "wave - Stuff to parse WAVE files.\n",
            "subsections": []
        },
        "MODULE REFERENCE": {
            "content": "https://docs.python.org/3.10/library/wave.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": "Usage.\n\nReading WAVE files:\nf = wave.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().\nWhen the setpos() and rewind() methods are not used, the seek()\nmethod 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 linear samples)\ngetcompname()   -- returns human-readable version of\ncompression type ('not compressed' linear samples)\ngetparams()     -- returns a namedtuple consisting of all of the\nabove in the above order\ngetmarkers()    -- returns None (for compatibility with the\naifc module)\ngetmark(id)     -- raises an error since the mark does not\nexist (for compatibility with the aifc module)\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() and the position given to setpos()\nare compatible and have nothing to do with the actual position in the\nfile.\nThe close() method is called automatically when the class instance\nis destroyed.\n\nWriting WAVE files:\nf = wave.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:\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\ntell()          -- return current position in output file\nwriteframesraw(data)\n-- write audio frames without patching 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": "The close() method is called automatically when the class instance\nis destroyed.\n"
                }
            ]
        },
        "CLASSES": {
            "content": "builtins.Exception(builtins.BaseException)\nError\nbuiltins.object\nWaveread\nWavewrite\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"
                },
                {
                    "name": "class Wave_read",
                    "content": "|  Waveread(f)\n|\n|  Variables used in this class:\n|\n|  These variables are available to the user though appropriate\n|  methods of this class:\n|  file -- the open file with methods read(), close(), and seek()\n|            set through the init() method\n|  nchannels -- the number of audio channels\n|            available through the getnchannels() method\n|  nframes -- the number of audio frames\n|            available through the getnframes() method\n|  sampwidth -- the number of bytes per audio sample\n|            available through the getsampwidth() method\n|  framerate -- the sampling frequency\n|            available through the getframerate() method\n|  comptype -- the AIFF-C compression type ('NONE' if AIFF)\n|            available through the getcomptype() method\n|  compname -- the human-readable AIFF-C compression type\n|            available through the getcomptype() method\n|  soundpos -- the position in the audio stream\n|            available through the tell() method, set through the\n|            setpos() method\n|\n|  These variables are used internally only:\n|  fmtchunkread -- 1 iff the FMT chunk has been read\n|  dataseekneeded -- 1 iff positioned correctly in audio\n|            file for readframes()\n|  datachunk -- instantiation of a chunk class for the DATA chunk\n|  framesize -- size of one frame in the file\n|\n|  Methods defined here:\n|\n|  del(self)\n|\n|  enter(self)\n|\n|  exit(self, *args)\n|\n|  init(self, f)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  close(self)\n|\n|  getcompname(self)\n|\n|  getcomptype(self)\n|\n|  getfp(self)\n|      # User visible methods.\n|\n|  getframerate(self)\n|\n|  getmark(self, id)\n|\n|  getmarkers(self)\n|\n|  getnchannels(self)\n|\n|  getnframes(self)\n|\n|  getparams(self)\n|\n|  getsampwidth(self)\n|\n|  initfp(self, file)\n|\n|  readframes(self, nframes)\n|\n|  rewind(self)\n|\n|  setpos(self, pos)\n|\n|  tell(self)\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  dict\n|      dictionary for instance variables (if defined)\n|\n|  weakref\n|      list of weak references to the object (if defined)\n"
                },
                {
                    "name": "class Wave_write",
                    "content": "|  Wavewrite(f)\n|\n|  Variables used in this class:\n|\n|  These variables are user settable through appropriate methods\n|  of this class:\n|  file -- the open file with methods write(), close(), tell(), seek()\n|            set through the init() method\n|  comptype -- the AIFF-C compression type ('NONE' in AIFF)\n|            set through the setcomptype() or setparams() method\n|  compname -- the human-readable AIFF-C compression type\n|            set through the setcomptype() or setparams() method\n|  nchannels -- the number of audio channels\n|            set through the setnchannels() or setparams() method\n|  sampwidth -- the number of bytes per audio sample\n|            set through the setsampwidth() or setparams() method\n|  framerate -- the sampling frequency\n|            set through the setframerate() or setparams() method\n|  nframes -- the number of audio frames written to the header\n|            set through the setnframes() or setparams() method\n|\n|  These variables are used internally only:\n|  datalength -- the size of the audio samples written to the header\n|  nframeswritten -- the number of frames actually written\n|  datawritten -- the size of the audio samples actually written\n|\n|  Methods defined here:\n|\n|  del(self)\n|\n|  enter(self)\n|\n|  exit(self, *args)\n|\n|  init(self, f)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  close(self)\n|\n|  getcompname(self)\n|\n|  getcomptype(self)\n|\n|  getframerate(self)\n|\n|  getmark(self, id)\n|\n|  getmarkers(self)\n|\n|  getnchannels(self)\n|\n|  getnframes(self)\n|\n|  getparams(self)\n|\n|  getsampwidth(self)\n|\n|  initfp(self, file)\n|\n|  setcomptype(self, comptype, compname)\n|\n|  setframerate(self, framerate)\n|\n|  setmark(self, id, pos, name)\n|\n|  setnchannels(self, nchannels)\n|      # User visible methods.\n|\n|  setnframes(self, nframes)\n|\n|  setparams(self, params)\n|\n|  setsampwidth(self, sampwidth)\n|\n|  tell(self)\n|\n|  writeframes(self, data)\n|\n|  writeframesraw(self, data)\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  dict\n|      dictionary for instance variables (if defined)\n|\n|  weakref\n|      list of weak references to the object (if defined)\n"
                }
            ]
        },
        "FUNCTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "open",
                    "content": ""
                }
            ]
        },
        "DATA": {
            "content": "all = ['open', 'Error', 'Waveread', 'Wavewrite']\n",
            "subsections": []
        },
        "FILE": {
            "content": "/usr/lib/python3.10/wave.py\n\n",
            "subsections": []
        }
    },
    "summary": "wave - Stuff to parse WAVE files.",
    "flags": [],
    "examples": [],
    "see_also": []
}