1 2 3 4 5 6 7 8 9
| import wave import numpy as np
wav=wave.open('test.wav','rb') print(wav.getframerate(),wav.getnchannels(),wav.getnframes(),wav.getsampwidth()) c=wav.readframes(int(0.025*wav.getframerate())) npc=np.frombuffer(c,dtype=np.short) npc=npc.reshape((-1,2)).T[0] print(npc,npc.shape,int(0.025*wav.getframerate()))
|
参考链接:numpy数组选取每一行的第一列
创建于2023.3.17/15.21,修改于2023.3.17/15.21