可以通过设置plt.xlim()函数来让两个波形的横坐标位置完全一致,如下所示:

plt.subplot(211) plt.plot(time1, samples1) plt.title("原音频时域波形") plt.xlabel("时长(秒)") plt.ylabel("振幅") plt.xlim(time1[0], time1[-1]) # 设置横坐标范围

plt.subplot(212) plt.plot(time2, samples2) plt.title("降噪后音频时域波形") plt.xlabel("时长(秒)") plt.ylabel("振幅") plt.xlim(time2[0], time2[-1]) # 设置横坐标范围

def displayWaveformsample1 sample2 # 显示语音时域波形 display waveform of a given speech sample param sample_name speech sample name param fs sample frequency return samples1 sr1 = libr

原文地址: https://www.cveoy.top/t/topic/ffE9 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录