有一个代码:
import wave
import numpy as np
import math
wav = wave.open("music.wav", mode="r")
(nchannels, sampwidth, framerate, nframes, comptype, compname) = wav.getparams()
content = wav.readframes(nframes)
samples = np.fromstring(content, dtype=types[sampwidth])
for n in range(nchannels):
channel = samples[n::nchannels]
print channel
因此:
[0 0 0 ..., 0 0 8]
[0 0 0 ..., 0 0 0]
类型:
<type 'numpy.ndarray'>
<type 'numpy.ndarray'>
我不知道下一步该做什么......我会很高兴另一个解决方案:)