code: def read(filename, mmap=False):
      """
      Open a WAV file
  
      Return the sample rate (in samples/sec) and data from a WAV file.
  
      Parameters
      ----------
      filename : string or open file handle
          Input wav file.
      mmap : bool, optional
          Whether to read data as memory-mapped.
          Only to be used on real files (Default: False).
  
          .. versionadded:: 0.12.0
  
      Returns
      -------
      rate : int
          Sample rate of wav file.
      data : numpy array
          Data read from wav file.  Data-type is determined from the file;
          see Notes.
  
      Notes
      -----
      This function cannot read wav files with 24-bit data.
  
      Common data types: [1]_
  
      =====================  ===========  ===========  =============
           WAV format            Min          Max       NumPy dtype
      =====================  ===========  ===========  =============
      32-bit floating-point  -1.0         +1.0         float32
      32-bit PCM             -2147483648  +2147483647  int32
      16-bit PCM             -32768       +32767       int16
      8-bit PCM              0            255          uint8
      =====================  ===========  ===========  =============
  
      Note that 8-bit PCM is unsigned.
  
      References
      ----------
      .. [1] IBM Corporation and Microsoft Corporation, "Multimedia Programming
         Interface and Data Specifications 1.0", section "Data Format of the
         Samples", August 1991
         http://www.tactilemedia.com/info/MCI_Control_Info.html
  
      """
      if hasattr(filename, "read"):
          fid = filename
          mmap = False
      else:
          fid = open(filename, "rb")
  
      try:
          file_size, is_big_endian = _read_riff_chunk(fid)
          fmt_chunk_received = False
          channels = 1
          bit_depth = 8
          format_tag = WAVE_FORMAT_PCM
          while fid.tell() < file_size:
              # read the next chunk
              chunk_id = fid.read(4)
  
              if not chunk_id:
                  raise ValueError("Unexpected end of file.")
              elif len(chunk_id) < 4:
                  raise ValueError("Incomplete wav chunk.")
  
              if chunk_id == b"fmt ":
                  fmt_chunk_received = True
                  fmt_chunk = _read_fmt_chunk(fid, is_big_endian)
                  format_tag, channels, fs = fmt_chunk[1:4]
                  bit_depth = fmt_chunk[6]
                  if bit_depth not in (8, 16, 32, 64, 96, 128):
                      raise ValueError(
                          "Unsupported bit depth: the wav file "
                          "has {}-bit data.".format(bit_depth)
                      )
              elif chunk_id == b"fact":
                  _skip_unknown_chunk(fid, is_big_endian)
              elif chunk_id == b"data":
                  if not fmt_chunk_received:
                      raise ValueError("No fmt chunk before data")
                  data = _read_data_chunk(
                      fid,
                      format_tag,
                      channels,
                      bit_depth,
                      is_big_endian,
                      mmap,
                  )
              elif chunk_id == b"LIST":
                  # Someday this could be handled properly but for now skip it
                  _skip_unknown_chunk(fid, is_big_endian)
              elif chunk_id in (b"JUNK", b"Fake"):
                  # Skip alignment chunks without warning
                  _skip_unknown_chunk(fid, is_big_endian)
              else:
                  warnings.warn(
                      "Chunk (non-data) not understood, skipping it.",
                      WavFileWarning,
                  )
                  _skip_unknown_chunk(fid, is_big_endian)
      finally:
          if not hasattr(filename, "read"):
              fid.close()
          else:
              fid.seek(0)
  
      return fs, data
  
file_path: catboost/contrib/python/scipy/py2/scipy/io/wavfile.py
imports: from __future__ import division, print_function, absolute_import
  import sys
  import numpy
  import struct
  import warnings
label_desc: Use image node_id 5 for calling a global function with example usage: read(filename, mmap) and returns: fs,  data