MCPcopy Create free account
hub / github.com/ipython/ipython / read_wav

Function read_wav

IPython/lib/tests/test_display.py:258–262  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

256 return numpy.sin(2 * numpy.pi * 440 * numpy.linspace(0, 1, 44100)) * scale
257
258def read_wav(data):
259 with wave.open(BytesIO(data)) as wave_file:
260 wave_data = wave_file.readframes(wave_file.getnframes())
261 num_samples = wave_file.getnframes() * wave_file.getnchannels()
262 return struct.unpack('<%sh' % num_samples, wave_data)
263
264def test_code_from_file():
265 c = display.Code(filename=__file__)

Calls

no outgoing calls

Tested by

no test coverage detected