MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / readframes

Method readframes

tools/python-3.11.9-amd64/Lib/wave.py:353–368  ·  view source on GitHub ↗
(self, nframes)

Source from the content-addressed store, hash-verified

351 self._data_seek_needed = 1
352
353 def readframes(self, nframes):
354 if self._data_seek_needed:
355 self._data_chunk.seek(0, 0)
356 pos = self._soundpos * self._framesize
357 if pos:
358 self._data_chunk.seek(pos, 0)
359 self._data_seek_needed = 0
360 if nframes == 0:
361 return b''
362 data = self._data_chunk.read(nframes * self._framesize)
363 if self._sampwidth != 1 and sys.byteorder == 'big':
364 data = _byteswap(data, self._sampwidth)
365 if self._convert and data:
366 data = self._convert(data)
367 self._soundpos = self._soundpos + len(data) // (self._nchannels * self._sampwidth)
368 return data
369
370 #
371 # Internal methods.

Callers

nothing calls this directly

Calls 3

_byteswapFunction · 0.85
seekMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected