def _read_data_chunk(fid, format_tag, channels, bit_depth, is_big_endian, mmap=False):
    if is_big_endian:
        fmt = '>I'
    else:
        fmt = '<I'
    size = struct.unpack(fmt, fid.read(4))[0]
    bytes_per_sample = (bit_depth // 8)
    if (bit_depth == 8):
        dtype = 'u1'
    else:
        if is_big_endian:
            dtype = '>'
        else:
            dtype = '<'
        if (format_tag == WAVE_FORMAT_PCM):
            dtype += ('i%d' % bytes_per_sample)
        else:
            dtype += ('f%d' % bytes_per_sample)
    if (not mmap):
        data = numpy.frombuffer(fid.read(size), dtype=dtype)
    else:
        start = fid.tell()
        data = numpy.memmap(fid, dtype=dtype, mode='c', offset=start, shape=((size // bytes_per_sample),))
        fid.seek((start + size))
    if (channels > 1):
        data = data.reshape((- 1), channels)
    return data
def _read_data_chunk(fid, format_tag, channels, bit_depth, is_big_endian, mmap=False):
    if is_big_endian:
        fmt = '>I'
    else:
        fmt = '<I'
    size = struct.unpack(fmt, fid.read(4))[0]
    bytes_per_sample = (bit_depth // 8)
    if (bit_depth == 8):
        dtype = 'u1'
    else:
        if is_big_endian:
            dtype = '>'
        else:
            dtype = '<'
        if (format_tag == WAVE_FORMAT_PCM):
            dtype += ('i%d' % bytes_per_sample)
        else:
            dtype += ('f%d' % bytes_per_sample)
    if (not mmap):
        data = numpy.frombuffer(fid.read(size), dtype=dtype)
    else:
        start = fid.tell()
        data = numpy.memmap(fid, dtype=dtype, mode='c', offset=start, shape=((size // bytes_per_sample),))
        fid.seek((start + size))
    if (channels > 1):
        data = data.reshape((- 1), channels)
    return data