class_docstr: Variables used in this class:
  
  These variables are available to the user though appropriate
  methods of this class:
  _file -- the open file with methods read(), close(), and seek()
            set through the __init__() method
  _nchannels -- the number of audio channels
            available through the getnchannels() method
  _nframes -- the number of audio frames
            available through the getnframes() method
  _sampwidth -- the number of bytes per audio sample
            available through the getsampwidth() method
  _framerate -- the sampling frequency
            available through the getframerate() method
  _comptype -- the AIFF-C compression type ('NONE' if AIFF)
            available through the getcomptype() method
  _compname -- the human-readable AIFF-C compression type
            available through the getcomptype() method
  _soundpos -- the position in the audio stream
            available through the tell() method, set through the
            setpos() method
  
  These variables are used internally only:
  _fmt_chunk_read -- 1 iff the FMT chunk has been read
  _data_seek_needed -- 1 iff positioned correctly in audio
            file for readframes()
  _data_chunk -- instantiation of a chunk class for the DATA chunk
  _framesize -- size of one frame in the file
class_docstr_tok: ["Variables","used","in","this","class",":","These","variables","are","available","to","the","user","though","appropriate","methods","of","this","class",":","_file","--","the","open","file","with","methods","read","(",")",",","close","(",")",",","and","seek","(",")","set","through","the","__init__","(",")","method","_nchannels","--","the","number","of","audio","channels","available","through","the","getnchannels","(",")","method","_nframes","--","the","number","of","audio","frames","available","through","the","getnframes","(",")","method","_sampwidth","--","the","number","of","bytes","per","audio","sample","available","through","the","getsampwidth","(",")","method","_framerate","--","the","sampling","frequency","available","through","the","getframerate","(",")","method","_comptype","--","the","AIFF-C","compression","type","(","'NONE","'","if","AIFF",")","available","through","the","getcomptype","(",")","method","_compname","--","the","human-readable","AIFF-C","compression","type","available","through","the","getcomptype","(",")","method","_soundpos","--","the","position","in","the","audio","stream","available","through","the","tell","(",")","method",",","set","through","the","setpos","(",")","method","These","variables","are","used","internally","only",":","_fmt_chunk_read","--","1","iff","the","FMT","chunk","has","been","read","_data_seek_needed","--","1","iff","positioned","correctly","in","audio","file","for","readframes","(",")","_data_chunk","--","instantiation","of","a","chunk","class","for","the","DATA","chunk","_framesize","--","size","of","one","frame","in","the","file"]
code: def _read_fmt_chunk(self, chunk):
      try:
          (
              wFormatTag,
              self._nchannels,
              self._framerate,
              dwAvgBytesPerSec,
              wBlockAlign,
          ) = struct.unpack_from("<HHLLH", chunk.read(14))
      except struct.error:
          raise EOFError from None
      if wFormatTag == WAVE_FORMAT_PCM:
          try:
              sampwidth = struct.unpack_from("<H", chunk.read(2))[0]
          except struct.error:
              raise EOFError from None
          self._sampwidth = (sampwidth + 7) // 8
          if not self._sampwidth:
              raise Error("bad sample width")
      else:
          raise Error("unknown format: %r" % (wFormatTag,))
      if not self._nchannels:
          raise Error("bad # of channels")
      self._framesize = self._nchannels * self._sampwidth
      self._comptype = "NONE"
      self._compname = "not compressed"
  
imports: from collections import namedtuple
  import builtins
  import struct
  import sys
label_desc: Use image node_id 21 for calling the Wave_read obj's underlying member method code with example usage: obj._read_fmt_chunk(chunk) without return types