Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _wav2feats(wavname):
"""
"""
ext = os.path.splitext(wavname)[-1]
assert ext.lower() == '.wav' or ext.lower() == '.wave'
sig, read_framerate, sampwidth = read_wav(wavname)
shp = sig.shape
# wav should contain a single channel
assert len(shp) == 1 or (len(shp) == 2 and shp[1] == 1)
# wav sample rate should be 16000 Hz
assert read_framerate == 16000
assert sampwidth == 2
sig *= (2**(15-sampwidth))
_, loge, _, mspec = mfcc(sig.astype(np.float32), get_mspec=True)
return mspec, loge