python wav的fft
时间: 2023-10-15 15:29:29 浏览: 204
wav.rar_FFT wav_fft 声音_wav_wav读取_对声音FFT
要进行Python中wav文件的FFT(快速傅里叶变换),可以使用以下代码:
```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绘制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%"]
- *2* [Python 科学计算](https://download.csdn.net/download/yanghefeng22/10679321)[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* [python读取wav文件并进行FFT变换](https://blog.csdn.net/taw19960426/article/details/102502305)[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 ]
阅读全文