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

Function test_wav

tools/python-3.11.9-amd64/Lib/sndhdr.py:166–178  ·  view source on GitHub ↗

WAV file

(h, f)

Source from the content-addressed store, hash-verified

164
165
166def test_wav(h, f):
167 """WAV file"""
168 import wave
169 # 'RIFF' <len> 'WAVE' 'fmt ' <len>
170 if not h.startswith(b'RIFF') or h[8:12] != b'WAVE' or h[12:16] != b'fmt ':
171 return None
172 f.seek(0)
173 try:
174 w = wave.open(f, 'r')
175 except (EOFError, wave.Error):
176 return None
177 return ('wav', w.getframerate(), w.getnchannels(),
178 w.getnframes(), 8*w.getsampwidth())
179
180tests.append(test_wav)
181

Callers

nothing calls this directly

Calls 7

startswithMethod · 0.80
seekMethod · 0.45
openMethod · 0.45
getframerateMethod · 0.45
getnchannelsMethod · 0.45
getnframesMethod · 0.45
getsampwidthMethod · 0.45

Tested by

no test coverage detected