我无法弄清楚我的代码是什么问题
import wave,struct,math
waveFile = wave.open("F:/mayaSound/ChillingMusic.wav", "rb")
volume = []
frames = waveFile.getnframes()
rate = waveFile.getframerate()
length = frames / int(rate)
for i in range (0,length):
waveData = waveFile.readframes(1)
data = struct.unpack("<h",waveData)
temp = (int(data[0])-128) / 128
volume.append(20*math.log10(abs(temp) + 1))
print volume
waveFile.close()
它给了我
Error: error: file <maya console> line 14: unpack requires a string argument of length 2 #