scipy.io.wavfile.read返回解释



我知道我可以在https://docs.scipy.org/doc/scipy/reference/generated/scipy.io.wavfile.read.html上读它,但是我太笨了,看不懂它。

from scipy.io.wavfile import read
sample_rate, data = read("./drive/MyDrive/PSD.wav")
print(len(data))
print(data)

data的长度数组是怎样表示的?我有输出1500000,但它是什么意思,或者它使用的单位是什么?和sample_rate是488000,我想我理解它,但我不确定。

当我打印数据时它给了我输出

[[  0   0]
[  0   0]
[  0   0]
...
[-25 -25]
[ 18  18]
[ -4  -4]]

我知道它有左信道和右信道,但振幅单位是什么?

如果你有一个两列数组,这意味着你的波文件有两个通道(立体声,左/右)。采样率给出了每秒的采样数,因此采样周期为(1 / sample_rate)

你也可以画出来

import matplotlib.pyplot as plt
import numpy as np
# time for each sample
t = np.arange(len(data)) / sample_rate
plt.subplot(211)
plt.plot(t, data[:,0]);
plt.subplot(212)
plt.plot(t, data[:,1]);

最新更新