from scipy.io import wavfile
import matplotlib.pyplot as plt
import numpy as np
# import librosa
# samples,sr = librosa.load('usersay.wav',sr=None)
sr,samples = wavfile.read('usersay.wav')
# 采样率sampling rate录音设备在一秒钟内对声音信号的采样次数,音频数据
sample_num = samples.shape[0] # 采样数
total_time = int(sample_num/sr) # 总时长
print(sr)
print(samples)
print(type(samples))
print(sample_num)
print(total_time)
# 音调-频率,响度-振幅,音色-形状
times = np.linspace(0,total_time,sample_num) # 采样时间点们
plt.plot(times,samples)
plt.show()