python wav频谱分析
时间: 2023-09-04 22:17:07 浏览: 122
Python可以使用频谱分析对.wav音频文件进行处理。频谱分析是语音识别领域中的基本数据处理过程,也为后续的特征分析提供了数据准备。你可以使用Python库中的一些函数和方法进行频谱分析。下面是一个示例Python代码,可以绘制.wav音频文件的频谱图:
```python
import wave
import struct
import numpy
from scipy import *
from pylab import *
def Plot_fft_freq_chart(filename, plot=False):
wavefile = wave.open(filename, 'r')
nchannels = wavefile.getnchannels()
sample_width = wavefile.getsampwidth()
framerate = wavefile.getframerate()
numframes = wavefile.getnframes()
y = numpy.zeros(numframes)
for i in range(numframes):
val = wavefile.readframes(1)
left = val = v
Fs = framerate
try:
data, freqs, bins, im = specgram(y, NFFT=1024, Fs=Fs, noverlap=900)
mm=data<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [使用Python对音频进行频谱分析](https://blog.csdn.net/jeffrey2010/article/details/77427451)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [使用python绘制wav 音频文件频谱图](https://blog.csdn.net/es15071848238/article/details/121827343)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [62 - Python 漏斗分析案例](https://download.csdn.net/download/weixin_44510615/88233736)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文