class_docstr: Variables used in this class:
  
  These variables are user settable through appropriate methods
  of this class:
  _file -- the open file with methods write(), close(), tell(), seek()
            set through the __init__() method
  _comptype -- the AIFF-C compression type ('NONE' in AIFF)
            set through the setcomptype() or setparams() method
  _compname -- the human-readable AIFF-C compression type
            set through the setcomptype() or setparams() method
  _nchannels -- the number of audio channels
            set through the setnchannels() or setparams() method
  _sampwidth -- the number of bytes per audio sample
            set through the setsampwidth() or setparams() method
  _framerate -- the sampling frequency
            set through the setframerate() or setparams() method
  _nframes -- the number of audio frames written to the header
            set through the setnframes() or setparams() method
  
  These variables are used internally only:
  _datalength -- the size of the audio samples written to the header
  _nframeswritten -- the number of frames actually written
  _datawritten -- the size of the audio samples actually written
class_docstr_tok: ["Variables","used","in","this","class",":","These","variables","are","user","settable","through","appropriate","methods","of","this","class",":","_file","--","the","open","file","with","methods","write","(",")",",","close","(",")",",","tell","(",")",",","seek","(",")","set","through","the","__init__","(",")","method","_comptype","--","the","AIFF-C","compression","type","(","'NONE","'","in","AIFF",")","set","through","the","setcomptype","(",")","or","setparams","(",")","method","_compname","--","the","human-readable","AIFF-C","compression","type","set","through","the","setcomptype","(",")","or","setparams","(",")","method","_nchannels","--","the","number","of","audio","channels","set","through","the","setnchannels","(",")","or","setparams","(",")","method","_sampwidth","--","the","number","of","bytes","per","audio","sample","set","through","the","setsampwidth","(",")","or","setparams","(",")","method","_framerate","--","the","sampling","frequency","set","through","the","setframerate","(",")","or","setparams","(",")","method","_nframes","--","the","number","of","audio","frames","written","to","the","header","set","through","the","setnframes","(",")","or","setparams","(",")","method","These","variables","are","used","internally","only",":","_datalength","--","the","size","of","the","audio","samples","written","to","the","header","_nframeswritten","--","the","number","of","frames","actually","written","_datawritten","--","the","size","of","the","audio","samples","actually","written"]
code: def _write_header(self, initlength):
      assert not self._headerwritten
      self._file.write(b"RIFF")
      if not self._nframes:
          self._nframes = initlength // (
              self._nchannels * self._sampwidth
          )
      self._datalength = (
          self._nframes * self._nchannels * self._sampwidth
      )
      try:
          self._form_length_pos = self._file.tell()
      except (AttributeError, OSError):
          self._form_length_pos = None
      self._file.write(
          struct.pack(
              "<L4s4sLHHLLHH4s",
              36 + self._datalength,
              b"WAVE",
              b"fmt ",
              16,
              WAVE_FORMAT_PCM,
              self._nchannels,
              self._framerate,
              self._nchannels * self._framerate * self._sampwidth,
              self._nchannels * self._sampwidth,
              self._sampwidth * 8,
              b"data",
          )
      )
      if self._form_length_pos is not None:
          self._data_length_pos = self._file.tell()
      self._file.write(struct.pack("<L", self._datalength))
      self._headerwritten = True
  
imports: from collections import namedtuple
  import builtins
  import struct
  import sys
label_desc: Use image node_id 27 for calling the Wave_write obj's underlying member method code with example usage: obj._write_header(initlength) without return types