from scipy.io.wavfile import read
filepath = glob.glob('*.wav')
rates = []
datas = []
for fp in filepath:
rate, data = read(fp)
rates.append(rate)
datas.append(data)
我得到一个列表“数据”,它是:
[array([0, 0, 0, ..., 0, 0, 0], dtype=int16), array([0, 0, 0, ..., 0, 0, 1], dtype=int16), array([0, 0, 0, ..., 0, 0, 0], dtype=int16),..., array([0, 0, 0, ..., 0, 0, 0], dtype=int16)]
我用
new_array = numpy.vstack([datas])
获取 new_array :
[[array([0, 0, 0, ..., 0, 0, 0], dtype=int16)
array([0, 0, 0, ..., 0, 0, 1], dtype=int16)
array([0, 0, 0, ..., 0, 0, 0], dtype=int16)
...
array([0, 0, 0, ..., 0, 0, 0], dtype=int16)]]
但我真的更喜欢一个是:
(array([[ 0, 0, 0, ..., 0, 0, 0],
[ 0, 0, 0, ..., 0, 0, 1],
[ 0, 0, 0, ..., 0, 0, 0],
...,
[ 0, 0, 0, ..., 0, 0, 0]], dtype=int16)
我应该使用哪个功能?
谢谢。